The sidebar history module is back - now based on Pino's nice history model + proxymodel.

BUG: 205521
CCBUG: 206155

svn path=/trunk/KDE/kdebase/apps/; revision=1042654
This commit is contained in:
David Faure 2009-10-30 12:31:41 +00:00
parent e4500b9786
commit 9efcbcdc34
42 changed files with 629 additions and 1457 deletions

View file

@ -1,8 +1,10 @@
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory( test )
add_subdirectory( trees )
add_subdirectory( web_module )
add_subdirectory( history_module )
add_subdirectory( default_entries )
add_subdirectory( test )
########### konqsidebarplugin lib: contains the base class for plugins ###############

View file

@ -0,0 +1,8 @@
install( FILES
home.desktop
root.desktop
bookmarks.desktop
services.desktop
remote.desktop
history.desktop
DESTINATION ${DATA_INSTALL_DIR}/konqsidebartng/entries )

View file

@ -173,7 +173,4 @@ Comment[xh]=Le yimbali yee URL obusandukuzindwendwela. Ungazibeka ngendlela ezin
Comment[x-test]=xxThis is the history of the URLs you have recently visited. You can sort them in many ways.xx
Comment[zh_CN]= URL
Comment[zh_TW]= URL
Open=false
X-KDE-TreeModule=History
X-KDE-SearchableTreeModule=true
X-KDE-KonqSidebarModule=konqsidebar_tree
X-KDE-KonqSidebarModule=konqsidebar_history

View file

@ -0,0 +1,24 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../src # konqueror dir (for konqhistory*.h)
${CMAKE_CURRENT_SOURCE_DIR}/.. # sidebar dir
)
########### the sidebar module ###############
kde4_add_plugin(konqsidebar_history history_module.cpp)
target_link_libraries(konqsidebar_history konqsidebarplugin konquerorprivate konq ${KDE4_KDEUI_LIBS})
install(TARGETS konqsidebar_history DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES konqsidebar_history.desktop DESTINATION ${DATA_INSTALL_DIR}/konqsidebartng/plugins)
########### the KCM for the history ###############
set(kcm_history_SRCS kcmhistory.cpp ../../src/konqhistorysettings.cpp)
kde4_add_ui_files(kcm_history_SRCS history_dlg.ui )
kde4_add_plugin(kcm_history ${kcm_history_SRCS})
# konquerorprivate is only needed for konqhistorysettings...
target_link_libraries(kcm_history konquerorprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KDEUI_LIBS} )
install(TARGETS kcm_history DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kcmhistory.desktop DESTINATION ${SERVICES_INSTALL_DIR})

View file

@ -0,0 +1,138 @@
/*
Copyright (c) 2009 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License or ( at
your option ) version 3 or, at the discretion of KDE e.V. ( which shall
act as a proxy as in section 14 of the GPLv3 ), any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "history_module.h"
#include <kdebug.h>
#include <konqhistoryview.h>
#include <QAction>
#include <QApplication>
#include <QDebug>
#include <QTreeView>
#include <kicon.h>
#include <klocale.h>
#include <kpluginfactory.h>
KonqSidebarHistoryModule::KonqSidebarHistoryModule(const KComponentData &componentData, QWidget *parent,
const KConfigGroup& configGroup)
: KonqSidebarModule(componentData, parent, configGroup)
{
m_historyView = new KonqHistoryView(parent);
connect(m_historyView->treeView(), SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex)));
connect(m_historyView->treeView(), SIGNAL(pressed(QModelIndex)), this, SLOT(slotPressed(QModelIndex)));
connect(m_historyView->treeView(), SIGNAL(clicked(QModelIndex)), this, SLOT(slotClicked(QModelIndex)));
}
KonqSidebarHistoryModule::~KonqSidebarHistoryModule()
{
}
QWidget * KonqSidebarHistoryModule::getWidget()
{
return m_historyView;
}
// LMB activation (single or double click) handling
void KonqSidebarHistoryModule::slotActivated(const QModelIndex& index)
{
if (m_lastPressedButtons == Qt::MidButton) // already handled by slotClicked
return;
const KUrl url = m_historyView->urlForIndex(index);
if (url.isValid()) {
emit openUrlRequest(url);
}
}
// Needed for MMB handling; no convenient API in QAbstractItemView
void KonqSidebarHistoryModule::slotPressed(const QModelIndex& index)
{
Q_UNUSED(index);
m_lastPressedButtons = qApp->mouseButtons();
}
// MMB handling
void KonqSidebarHistoryModule::slotClicked(const QModelIndex& index)
{
if (m_lastPressedButtons & Qt::MidButton) {
const KUrl url = m_historyView->urlForIndex(index);
if (url.isValid()) {
createNewWindow(url);
}
}
}
class KonqSidebarHistoryPlugin : public KonqSidebarPlugin
{
public:
KonqSidebarHistoryPlugin(QObject* parent, const QVariantList& args)
: KonqSidebarPlugin(parent, args) {}
virtual ~KonqSidebarHistoryPlugin() {}
virtual KonqSidebarModule* createModule(const KComponentData &componentData, QWidget *parent,
const KConfigGroup& configGroup,
const QString &desktopname,
const QVariant& unused)
{
Q_UNUSED(unused);
Q_UNUSED(desktopname);
return new KonqSidebarHistoryModule(componentData, parent, configGroup);
}
virtual QList<QAction*> addNewActions(QObject* parent,
const QList<KConfigGroup>& existingModules,
const QVariant& unused)
{
Q_UNUSED(unused);
Q_UNUSED(existingModules);
QAction* action = new QAction(parent);
action->setText(i18nc("@action:inmenu Add", "History Sidebar Module"));
action->setIcon(KIcon("view-history"));
return QList<QAction *>() << action;
}
virtual QString templateNameForNewModule(const QVariant& actionData,
const QVariant& unused) const
{
Q_UNUSED(actionData);
Q_UNUSED(unused);
return QString::fromLatin1("historyplugin%1.desktop");
}
virtual bool createNewModule(const QVariant& actionData, KConfigGroup& configGroup,
QWidget* parentWidget,
const QVariant& unused)
{
Q_UNUSED(parentWidget);
Q_UNUSED(actionData);
Q_UNUSED(unused);
configGroup.writeEntry("Type", "Link");
configGroup.writeEntry("Icon", "view-history");
configGroup.writeEntry("Name", i18nc("@title:tab", "History"));
configGroup.writeEntry("X-KDE-KonqSidebarModule", "konqsidebar_history");
return true;
}
};
K_PLUGIN_FACTORY(KonqSidebarHistoryPluginFactory, registerPlugin<KonqSidebarHistoryPlugin>(); )
K_EXPORT_PLUGIN(KonqSidebarHistoryPluginFactory())
#include "history_module.moc"

View file

@ -0,0 +1,47 @@
/*
Copyright (c) 2009 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License or ( at
your option ) version 3 or, at the discretion of KDE e.V. ( which shall
act as a proxy as in section 14 of the GPLv3 ), any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HISTORY_MODULE_H
#define HISTORY_MODULE_H
#include <konqsidebarplugin.h>
class QModelIndex;
class KonqHistoryView;
class KonqSidebarHistoryModule : public KonqSidebarModule
{
Q_OBJECT
public:
KonqSidebarHistoryModule(const KComponentData &componentData, QWidget *parent,
const KConfigGroup& configGroup);
virtual ~KonqSidebarHistoryModule();
virtual QWidget *getWidget();
private Q_SLOTS:
void slotActivated(const QModelIndex& index);
void slotPressed(const QModelIndex& index);
void slotClicked(const QModelIndex& index);
private:
KonqHistoryView* m_historyView;
Qt::MouseButtons m_lastPressedButtons;
};
#endif // HISTORY_MODULE_H

View file

@ -43,7 +43,7 @@
#include <KPluginFactory>
#include <KPluginLoader>
#include <konqhistorymanager.h>
#include <konq_historyprovider.h>
#include <konqhistorysettings.h>
// Local
@ -58,8 +58,7 @@ HistorySidebarConfig::HistorySidebarConfig( QWidget *parent, const QVariantList
{
KGlobal::locale()->insertCatalog("konqueror");
m_settings = new KonqHistorySettings( this );
m_settings->readSettings( false );
m_settings = KonqHistorySettings::self();
QVBoxLayout *topLayout = new QVBoxLayout(this);
dialog = new KonqSidebarHistoryDlg(this);
@ -153,8 +152,8 @@ void HistorySidebarConfig::save()
quint32 age = dialog->cbExpire->isChecked() ? dialog->spinExpire->value() : 0;
quint32 count = dialog->spinEntries->value();
KonqHistoryManager::kself()->emitSetMaxAge( age );
KonqHistoryManager::kself()->emitSetMaxCount( count );
KonqHistoryProvider::self()->emitSetMaxAge( age );
KonqHistoryProvider::self()->emitSetMaxCount( count );
m_settings->m_valueYoungerThan = dialog->spinNewer->value();
m_settings->m_valueOlderThan = dialog->spinOlder->value();
@ -253,7 +252,7 @@ void HistorySidebarConfig::slotClearHistory()
"the entire history?"),
i18n("Clear History?"), guiitem )
== KMessageBox::Continue ) {
KonqHistoryManager::kself()->emitClear();
KonqHistoryProvider::self()->emitClear();
}
}

View file

@ -0,0 +1,5 @@
[Desktop Entry]
Type=Service
Icon=view-history
Name=History SideBar Module
X-KDE-Library=konqsidebar_history

View file

@ -36,7 +36,10 @@ KonqSidebarModule::~KonqSidebarModule() { }
const KComponentData &KonqSidebarModule::parentComponentData() const { return m_parentComponentData; }
void KonqSidebarModule::openUrl(const KUrl& url){handleURL(url);}
void KonqSidebarModule::openUrl(const KUrl& url)
{
handleURL(url);
}
void KonqSidebarModule::openPreview(const KFileItemList& items)
{

View file

@ -65,14 +65,13 @@ public:
KConfigGroup configGroup();
protected:
virtual void handleURL(const KUrl &url)=0;
/**
* Called by the sidebar's openUrl. Reimplement this in order to
* follow the navigation happening in konqueror's current view.
*/
virtual void handleURL(const KUrl &url) { Q_UNUSED(url); }
virtual void handlePreview(const KFileItemList & items);
virtual void handlePreviewOnMouseOver(const KFileItem &items); //not used yet
KComponentData m_parentComponentData;
private:
KConfigGroup m_configGroup;
KonqSidebarModulePrivate* const d;
Q_SIGNALS:
void started(KIO::Job *);
@ -93,20 +92,28 @@ public Q_SLOTS:
*/
Q_SIGNALS:
void openUrlRequest(const KUrl &url, const KParts::OpenUrlArguments& args = KParts::OpenUrlArguments(),
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments());
void createNewWindow(const KUrl &url, const KParts::OpenUrlArguments& args = KParts::OpenUrlArguments(),
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments(),
const KParts::WindowArgs& = KParts::WindowArgs());
/* signals, which could be, but need not to be added
void openUrlRequest( const KUrl &url, const KParts::URLArgs &args = KParts::URLArgs() );
void createNewWindow( const KUrl &url, const KParts::URLArgs &args = KParts::URLArgs() );
/* signals, which sidebar_widget.cpp connects by name. TODO: define the useful ones here, remove
* the others
void enableAction( const char * name, bool enabled );
void started(KIO::Job *);
void completed();
void submitFormRequest(const char*,const QString&,const QByteArray&,const QString&,const QString&,const QString&);
void
void popupMenu( ... );
void showError(QString &); //for later extension
void showMessage(QString &); //for later extension
*/
private:
KComponentData m_parentComponentData;
KConfigGroup m_configGroup;
KonqSidebarModulePrivate* const d;
};
/**

View file

@ -543,7 +543,6 @@ bool Sidebar_Widget::eventFilter(QObject *obj, QEvent *ev)
buttonPopup->addAction(KIcon("edit-delete"), i18n("Remove"), this, SLOT(slotRemove()));
buttonPopup->addSeparator();
buttonPopup->addMenu(m_menu);
buttonPopup->setItemEnabled(2,!currentButtonInfo().URL.isEmpty());
buttonPopup->exec(QCursor::pos());
delete buttonPopup;
}
@ -716,13 +715,13 @@ void Sidebar_Widget::submitFormRequest(const char *action,
void Sidebar_Widget::openUrlRequest( const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs)
{
getExtension()->openUrlRequest(url,args, browserArgs);
getExtension()->openUrlRequest(url, args, browserArgs);
}
void Sidebar_Widget::createNewWindow( const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs,
const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart **part )
void Sidebar_Widget::createNewWindow(const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs,
const KParts::WindowArgs &windowArgs)
{
getExtension()->createNewWindow(url,args,browserArgs, windowArgs,part);
getExtension()->createNewWindow(url, args, browserArgs, windowArgs);
}
void Sidebar_Widget::enableAction( const char * name, bool enabled )
@ -827,10 +826,10 @@ void Sidebar_Widget::connectModule(QObject *mod)
this,SLOT(popupMenu( const QPoint &, const KFileItemList & )));
}
if (mod->metaObject()->indexOfSignal("openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)") != -1) {
connect(mod,SIGNAL(openUrlRequest( const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)),
this,SLOT(openUrlRequest( const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)));
}
connect(mod, SIGNAL(openUrlRequest( const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)),
this, SLOT(openUrlRequest( const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)));
connect(mod, SIGNAL(createNewWindow(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs)),
this, SLOT(createNewWindow(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs)));
if (mod->metaObject()->indexOfSignal("submitFormRequest(const char*,QString,QByteArray,QString,QString,QString)") != -1) {
connect(mod,
@ -843,11 +842,6 @@ void Sidebar_Widget::connectModule(QObject *mod)
connect(mod,SIGNAL(enableAction( const char *, bool)),
this,SLOT(enableAction(const char *, bool)));
}
if (mod->metaObject()->indexOfSignal("createNewWindow(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs,KParts::ReadOnlyPart**)") != -1) {
connect(mod,SIGNAL(createNewWindow(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs,KParts::ReadOnlyPart**)),
this,SLOT(createNewWindow(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs,KParts::ReadOnlyPart**)));
}
}
Sidebar_Widget::~Sidebar_Widget()

View file

@ -125,16 +125,15 @@ Q_SIGNALS:
void fileSelection(const KFileItemList& iems);
void fileMouseOver(const KFileItem& item);
public:
/* The following public slots are wrappers for browserextension fields */
public Q_SLOTS:
/* The following public slots are wrappers for browserextension signals */
public Q_SLOTS:
void openUrlRequest( const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs );
/* @internal
* ### KDE4 remove me
*/
void submitFormRequest(const char*,const QString&,const QByteArray&,const QString&,const QString&,const QString&);
void createNewWindow( const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs,
const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart **part );
void createNewWindow(const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs,
const KParts::WindowArgs &windowArgs);
void popupMenu( const QPoint &global, const KFileItemList &items );
void popupMenu( const QPoint &global, const KUrl &url,

View file

@ -11,7 +11,6 @@ endif(WIN32)
add_subdirectory( init )
add_subdirectory( dirtree_module )
add_subdirectory( history_module )
########### next target ###############

View file

@ -1,34 +0,0 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../../src # konqueror dir (for konqhistorymanager.h)
${CMAKE_CURRENT_SOURCE_DIR}/../../ # sidebar dir
${CMAKE_CURRENT_SOURCE_DIR}/../ # trees dir
${CMAKE_CURRENT_BINARY_DIR}/../ # trees dir
)
########### next target ###############
# dummy module
kde4_add_plugin(konq_sidebartree_history dummy.cpp)
target_link_libraries(konq_sidebartree_history ${QT_QT3SUPPORT_LIBRARY} ${QT_QTCORE_LIBRARY})
install(TARGETS konq_sidebartree_history DESTINATION ${PLUGIN_INSTALL_DIR})
########### next target ###############
set(kcm_history_SRCS kcmhistory.cpp ../../../src/konqhistorysettings.cpp)
kde4_add_ui_files(kcm_history_SRCS history_dlg.ui )
kde4_add_plugin(kcm_history ${kcm_history_SRCS})
target_link_libraries(kcm_history konquerorprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KDEUI_LIBS} )
install(TARGETS kcm_history DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kcmhistory.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -1,23 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Pino Toscano <pino@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <konq_sidebartreemodule.h>
extern "C"
{
}

View file

@ -1,249 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
// Own
#include "history_item.h"
// std
#include <assert.h>
// Qt
#include <QtGui/QPainter>
// KDE
#include <kbookmark.h>
#include <kprotocolinfo.h>
#include <kiconloader.h>
// Local
#include "history_module.h"
#include "history_settings.h"
#define MYMODULE static_cast<KonqSidebarHistoryModule*>(module())
#define MYGROUP static_cast<KonqSidebarHistoryGroupItem*>(parent())
KonqSidebarHistorySettings * KonqSidebarHistoryItem::s_settings = 0L;
KonqSidebarHistoryItem::KonqSidebarHistoryItem( const KonqHistoryEntry& entry,
KonqSidebarTreeItem * parentItem,
KonqSidebarTreeTopLevelItem *topLevelItem )
: KonqSidebarTreeItem( parentItem, topLevelItem )
{
setExpandable( false );
update( entry );
}
KonqSidebarHistoryItem::~KonqSidebarHistoryItem()
{
}
void KonqSidebarHistoryItem::update( const KonqHistoryEntry& entry )
{
m_entry = entry;
QString title( entry.title );
if ( !title.trimmed().isEmpty() &&
title != entry.url.url() )
setText( 0, title );
else {
QString path( entry.url.path() );
if ( path.isEmpty() )
path += '/';
setText( 0, path );
}
KonqSidebarHistoryGroupItem *group = MYGROUP;
assert(group);
QString path = entry.url.path();
if ( group->hasFavIcon() && (path.isNull() || path == "/") )
{
const QPixmap *pm = group->pixmap(0);
if (pm)
setPixmap( 0, *pm );
}
else
{
setPixmap( 0, SmallIcon(KProtocolInfo::icon( entry.url.protocol() )));
}
group->itemUpdated( this ); // update for sorting
}
void KonqSidebarHistoryItem::itemSelected()
{
tree()->enableActions( true, true, false, false, false, false );
}
void KonqSidebarHistoryItem::rightButtonPressed()
{
MYMODULE->showPopupMenu();
}
bool KonqSidebarHistoryItem::populateMimeData( QMimeData* mimeData, bool /*move*/ )
{
QString icon = KMimeType::favIconForUrl( m_entry.url );
KBookmark bookmark = KBookmark::standaloneBookmark( m_entry.title,
m_entry.url, icon );
bookmark.populateMimeData( mimeData );
return true;
}
// new items go on top
QString KonqSidebarHistoryItem::key( int column, bool ascending ) const
{
if ( MYMODULE->sortsByName() )
return KonqSidebarTreeItem::key( column, ascending );
QString tmp;
tmp.sprintf( "%08x", m_entry.lastVisited.secsTo(MYMODULE->currentTime()));
return tmp;
}
QString KonqSidebarHistoryItem::toolTipText() const
{
if ( s_settings->m_detailedTips ) {
return i18n("<qt><center><b>%1</b></center><hr />Last visited: %2<br />"
"First visited: %3<br />Number of times visited: %4</qt>",
m_entry.url.url(),
KGlobal::locale()->formatDateTime( m_entry.lastVisited ),
KGlobal::locale()->formatDateTime( m_entry.firstVisited ),
m_entry.numberOfTimesVisited);
}
return m_entry.url.url();
}
void KonqSidebarHistoryItem::paintCell( QPainter *p, const QColorGroup & cg,
int column, int width, int alignment )
{
QDateTime dt;
QDateTime current = QDateTime::currentDateTime();
if ( s_settings->m_metricYoungerThan == KonqSidebarHistorySettings::DAYS )
dt = current.addDays( - (int)s_settings->m_valueYoungerThan );
else
dt = current.addSecs( - ((int)s_settings->m_valueYoungerThan * 60) );
if ( m_entry.lastVisited > dt )
p->setFont( s_settings->m_fontYoungerThan );
else {
if ( s_settings->m_metricOlderThan == KonqSidebarHistorySettings::DAYS )
dt = current.addDays( - (int)s_settings->m_valueOlderThan );
else
dt = current.addSecs( - ((int)s_settings->m_valueOlderThan * 60) );
if ( m_entry.lastVisited < dt )
p->setFont( s_settings->m_fontOlderThan );
}
KonqSidebarTreeItem::paintCell( p, cg, column, width, alignment );
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
KonqSidebarHistoryGroupItem::KonqSidebarHistoryGroupItem( const KUrl& url,
KonqSidebarTreeTopLevelItem *topLevelItem)
: KonqSidebarTreeItem( topLevelItem, topLevelItem ),
m_hasFavIcon( false ),
m_url( url )
{
}
void KonqSidebarHistoryGroupItem::setFavIcon( const QPixmap& pix )
{
setPixmap( 0, pix );
m_hasFavIcon = true;
}
// the group item itself will be removed automatically,
// when the last child is removed
void KonqSidebarHistoryGroupItem::remove()
{
KUrl::List list;
KonqSidebarHistoryItem *child = static_cast<KonqSidebarHistoryItem*>( firstChild() );
while( child ) {
list.append( child->externalURL() );
child = static_cast<KonqSidebarHistoryItem*>( child->nextSibling() );
}
if ( !list.isEmpty() )
KonqHistoryManager::kself()->emitRemoveListFromHistory( list );
}
KonqSidebarHistoryItem * KonqSidebarHistoryGroupItem::findChild(const KonqHistoryEntry& entry) const
{
Q3ListViewItem *child = firstChild();
KonqSidebarHistoryItem *item = 0L;
while ( child ) {
item = static_cast<KonqSidebarHistoryItem *>( child );
if ( item->entry().url == entry.url )
return item;
child = child->nextSibling();
}
return 0L;
}
void KonqSidebarHistoryGroupItem::itemSelected()
{
tree()->enableActions( false, false, false,
false, false, false );
}
void KonqSidebarHistoryGroupItem::rightButtonPressed()
{
MYMODULE->showPopupMenu();
}
// let the module change our pixmap (opened/closed)
void KonqSidebarHistoryGroupItem::setOpen( bool open )
{
MYMODULE->groupOpened( this, open );
KonqSidebarTreeItem::setOpen( open );
}
// new items go on top
QString KonqSidebarHistoryGroupItem::key( int column, bool ascending ) const
{
if ( !m_lastVisited.isValid() || MYMODULE->sortsByName() )
return KonqSidebarTreeItem::key( column, ascending );
QString tmp;
tmp.sprintf( "%08x", m_lastVisited.secsTo( MYMODULE->currentTime() ));
return tmp;
}
void KonqSidebarHistoryGroupItem::itemUpdated( KonqSidebarHistoryItem *item )
{
if ( !m_lastVisited.isValid() || m_lastVisited < item->lastVisited() )
m_lastVisited = item->lastVisited();
}
bool KonqSidebarHistoryGroupItem::populateMimeData( QMimeData* mimeData, bool /*move*/ )
{
QString icon = KMimeType::favIconForUrl( m_url );
KBookmark bookmark = KBookmark::standaloneBookmark( QString(), m_url,
icon );
bookmark.populateMimeData( mimeData );
return true;
}

View file

@ -1,112 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HISTORY_ITEM_H
#define HISTORY_ITEM_H
#include <kurl.h>
#include <konqhistorymanager.h>
#include "konq_sidebartreeitem.h"
class QDropEvent;
class QPainter;
class KonqSidebarHistorySettings;
class QStrList;
class KonqSidebarHistoryItem : public KonqSidebarTreeItem
{
public:
KonqSidebarHistoryItem( const KonqHistoryEntry& entry,
KonqSidebarTreeItem *parentItem,
KonqSidebarTreeTopLevelItem *topLevelItem );
~KonqSidebarHistoryItem();
virtual void rightButtonPressed();
virtual void itemSelected();
// The URL to open when this link is clicked
virtual KUrl externalURL() const { return m_entry.url; }
const KUrl& url() const { return m_entry.url; } // a faster one
virtual QString toolTipText() const;
QString host() const { return m_entry.url.host(); }
QString path() const { return m_entry.url.path(); }
const QDateTime& lastVisited() const { return m_entry.lastVisited; }
void update( const KonqHistoryEntry& entry );
const KonqHistoryEntry& entry() const { return m_entry; }
virtual bool populateMimeData( QMimeData* mimeData, bool move );
virtual QString key( int column, bool ascending ) const;
static void setSettings( KonqSidebarHistorySettings *s ) { s_settings = s; }
virtual void paintCell( QPainter *, const QColorGroup & cg, int column,
int width, int alignment );
private:
KonqHistoryEntry m_entry;
static KonqSidebarHistorySettings *s_settings;
};
class KonqSidebarHistoryGroupItem : public KonqSidebarTreeItem
{
public:
KonqSidebarHistoryGroupItem( const KUrl& url, KonqSidebarTreeTopLevelItem * );
/**
* removes itself and all its children from the history (not just the view)
*/
void remove();
KonqSidebarHistoryItem * findChild( const KonqHistoryEntry& entry ) const;
virtual void rightButtonPressed();
virtual void setOpen( bool open );
virtual QString key( int column, bool ascending ) const;
void itemUpdated( KonqSidebarHistoryItem *item );
bool hasFavIcon() const { return m_hasFavIcon; }
void setFavIcon( const QPixmap& pix );
virtual bool populateMimeData( QMimeData* mimeData, bool move );
virtual void itemSelected();
// we don't support the following of KonqSidebarTreeItem
bool acceptsDrops( const QStrList& ) { return false; }
virtual void drop( QDropEvent * ) {}
virtual KUrl externalURL() const { return KUrl(); }
private:
bool m_hasFavIcon;
const KUrl m_url;
QDateTime m_lastVisited;
};
#endif // HISTORY_ITEM_H

View file

@ -1,388 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
// Own
#include "history_module.h"
// Qt
#include <QtGui/QApplication>
#include <QtGui/QMenu>
// KDE
#include <kaction.h>
#include <kactioncollection.h>
#include <kapplication.h>
#include <kcursor.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kicon.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <krun.h>
#include <k3staticdeleter.h>
#include <ktoggleaction.h>
#include <kconfiggroup.h>
// Local
#include "history_settings.h"
static K3StaticDeleter<KonqSidebarHistorySettings> sd;
KonqSidebarHistorySettings * KonqSidebarHistoryModule::s_settings = 0L;
KonqSidebarHistoryModule::KonqSidebarHistoryModule( KonqSidebarTree * parentTree, const char *name )
: QObject( 0L ), KonqSidebarTreeModule( parentTree ),
m_dict( 349 ),
m_topLevelItem( 0L ),
m_initialized( false )
{
setObjectName( name );
if ( !s_settings ) {
sd.setObject( s_settings,
new KonqSidebarHistorySettings(0));
s_settings->readSettings( true );
}
connect( s_settings, SIGNAL( settingsChanged() ), SLOT( slotSettingsChanged() ));
m_dict.setAutoDelete( true );
m_currentTime = QDateTime::currentDateTime();
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
m_sortsByName = cs.readEntry( "SortHistory", "byDate" ) == "byName";
KonqHistoryManager *manager = KonqHistoryManager::kself();
connect( manager, SIGNAL( loadingFinished() ), SLOT( slotCreateItems() ));
connect( manager, SIGNAL( cleared() ), SLOT( clear() ));
connect( manager, SIGNAL( entryAdded( const KonqHistoryEntry & ) ),
SLOT( slotEntryAdded( const KonqHistoryEntry & ) ));
connect( manager, SIGNAL( entryRemoved( const KonqHistoryEntry &) ),
SLOT( slotEntryRemoved( const KonqHistoryEntry &) ));
connect( parentTree, SIGNAL( expanded( Q3ListViewItem * )),
SLOT( slotItemExpanded( Q3ListViewItem * )));
m_collection = new KActionCollection( this );
QAction *action = m_collection->addAction("open_new");
action->setIcon( KIcon("window-new") );
action->setText( i18n("New &Window") );
connect(action, SIGNAL(triggered(bool)), SLOT( slotNewWindow() ));
action = m_collection->addAction("remove");
action->setIcon( KIcon("edit-delete") );
action->setText( i18n("&Remove Entry") );
connect(action, SIGNAL(triggered(bool)), SLOT( slotRemoveEntry() ));
action = m_collection->addAction("clear");
action->setIcon( KIcon("edit-clear-history") );
action->setText( i18n("C&lear History") );
connect(action, SIGNAL(triggered(bool)), SLOT( slotClearHistory() ));
action = m_collection->addAction("preferences");
action->setIcon( KIcon("configure") );
action->setText( i18n("&Preferences...") );
connect(action, SIGNAL(triggered(bool)), SLOT( slotPreferences()));
QActionGroup* sortGroup = new QActionGroup(this);
sortGroup->setExclusive(true);
KToggleAction *sort;
sort = new KToggleAction( i18n("By &Name"), this );
m_collection->addAction( "byName", sort );
connect(sort, SIGNAL(triggered(bool) ), SLOT( slotSortByName() ));
sort->setActionGroup(sortGroup);
sort->setChecked( m_sortsByName );
sort = new KToggleAction( i18n("By &Date"), this );
m_collection->addAction( "byDate", sort );
connect(sort, SIGNAL(triggered(bool) ), SLOT( slotSortByDate() ));
sort->setActionGroup(sortGroup);
sort->setChecked( !m_sortsByName );
m_folderClosed = SmallIcon( "folder" );
m_folderOpen = SmallIcon( "folder-open" );
slotSettingsChanged(); // read the settings
}
KonqSidebarHistoryModule::~KonqSidebarHistoryModule()
{
HistoryItemIterator it( m_dict );
QStringList openGroups;
while ( it.current() ) {
if ( it.current()->isOpen() )
openGroups.append( it.currentKey() );
++it;
}
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
cs.writeEntry("OpenGroups", openGroups);
kc->sync();
}
void KonqSidebarHistoryModule::slotSettingsChanged()
{
KonqSidebarHistoryItem::setSettings( s_settings );
tree()->triggerUpdate();
}
void KonqSidebarHistoryModule::slotCreateItems()
{
QApplication::setOverrideCursor( Qt::WaitCursor );
clear();
KonqSidebarHistoryItem *item;
KonqHistoryList entries( KonqHistoryManager::kself()->entries() );
m_currentTime = QDateTime::currentDateTime();
// the group item and the item of the serverroot '/' get a fav-icon
// if available. All others get the protocol icon.
KonqHistoryList::const_iterator it = entries.constBegin();
const KonqHistoryList::const_iterator end = entries.constEnd();
for ( ; it != end ; ++it ) {
KonqSidebarHistoryGroupItem *group = getGroupItem( (*it).url );
item = new KonqSidebarHistoryItem( (*it), group, m_topLevelItem );
}
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
const QStringList openGroups = cs.readEntry("OpenGroups",QStringList());
QStringList::const_iterator it2 = openGroups.constBegin();
KonqSidebarHistoryGroupItem *group;
while ( it2 != openGroups.constEnd() ) {
group = m_dict.find( *it2 );
if ( group )
group->setOpen( true );
++it2;
}
QApplication::restoreOverrideCursor();
m_initialized = true;
}
// deletes the listview items but does not affect the history backend
void KonqSidebarHistoryModule::clear()
{
m_dict.clear();
}
void KonqSidebarHistoryModule::slotEntryAdded( const KonqHistoryEntry& entry )
{
if ( !m_initialized )
return;
m_currentTime = QDateTime::currentDateTime();
KonqSidebarHistoryGroupItem *group = getGroupItem( entry.url );
KonqSidebarHistoryItem *item = group->findChild( entry );
if ( !item )
item = new KonqSidebarHistoryItem( entry, group, m_topLevelItem );
else
item->update( entry );
// QListView scrolls when calling sort(), so we have to hack around that
// (we don't want no scrolling every time an entry is added)
KonqSidebarTree *t = tree();
t->lockScrolling( true );
group->sort();
m_topLevelItem->sort();
qApp->processOneEvent(); // #####
t->lockScrolling( false );
}
void KonqSidebarHistoryModule::slotEntryRemoved( const KonqHistoryEntry& entry )
{
if ( !m_initialized )
return;
QString groupKey = groupForURL( entry.url );
KonqSidebarHistoryGroupItem *group = m_dict.find( groupKey );
if ( !group )
return;
delete group->findChild( entry );
if ( group->childCount() == 0 )
m_dict.remove( groupKey );
}
void KonqSidebarHistoryModule::addTopLevelItem( KonqSidebarTreeTopLevelItem * item )
{
m_topLevelItem = item;
}
bool KonqSidebarHistoryModule::handleTopLevelContextMenu( KonqSidebarTreeTopLevelItem *,
const QPoint& pos )
{
showPopupMenu( ModuleContextMenu, pos );
return true;
}
void KonqSidebarHistoryModule::showPopupMenu()
{
showPopupMenu( EntryContextMenu | ModuleContextMenu, QCursor::pos() );
}
void KonqSidebarHistoryModule::showPopupMenu( int which, const QPoint& pos )
{
QMenu *sortMenu = new QMenu;
sortMenu->addAction( m_collection->action("byName") );
sortMenu->addAction( m_collection->action("byDate") );
QMenu *menu = new QMenu;
if ( which & EntryContextMenu )
{
menu->addAction( m_collection->action("open_new") );
menu->addSeparator();
menu->addAction( m_collection->action("remove") );
}
menu->addAction( m_collection->action("clear") );
menu->addSeparator();
menu->insertItem( i18nc("@action:inmenu Parent of 'By Name' and 'By Date'", "Sort"), sortMenu );
menu->addSeparator();
menu->addAction( m_collection->action("preferences") );
menu->exec( pos );
delete menu;
delete sortMenu;
}
void KonqSidebarHistoryModule::slotNewWindow()
{
kDebug(1201)<<"void KonqSidebarHistoryModule::slotNewWindow()";
Q3ListViewItem *item = tree()->selectedItem();
KonqSidebarHistoryItem *hi = dynamic_cast<KonqSidebarHistoryItem*>( item );
if ( hi )
{
kDebug(1201)<<"void KonqSidebarHistoryModule::slotNewWindow(): emitting createNewWindow";
emit tree()->createNewWindow( hi->url() );
}
}
void KonqSidebarHistoryModule::slotRemoveEntry()
{
Q3ListViewItem *item = tree()->selectedItem();
KonqSidebarHistoryItem *hi = dynamic_cast<KonqSidebarHistoryItem*>( item );
if ( hi ) // remove a single entry
KonqHistoryManager::kself()->emitRemoveFromHistory( hi->externalURL());
else { // remove a group of entries
KonqSidebarHistoryGroupItem *gi = dynamic_cast<KonqSidebarHistoryGroupItem*>( item );
if ( gi )
gi->remove();
}
}
void KonqSidebarHistoryModule::slotPreferences()
{
// Run the history sidebar settings.
KRun::run( "kcmshell4 kcmhistory", KUrl::List(), tree());
}
void KonqSidebarHistoryModule::slotSortByName()
{
m_sortsByName = true;
sortingChanged();
}
void KonqSidebarHistoryModule::slotSortByDate()
{
m_sortsByName = false;
sortingChanged();
}
void KonqSidebarHistoryModule::sortingChanged()
{
m_topLevelItem->sort();
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
cs.writeEntry( "SortHistory", m_sortsByName ? "byName" : "byDate" );
kc->sync();
}
void KonqSidebarHistoryModule::slotItemExpanded( Q3ListViewItem *item )
{
if ( item == m_topLevelItem && !m_initialized )
slotCreateItems();
}
void KonqSidebarHistoryModule::groupOpened( KonqSidebarHistoryGroupItem *item, bool open )
{
if ( item->hasFavIcon() )
return;
if ( open )
item->setPixmap( 0, m_folderOpen );
else
item->setPixmap( 0, m_folderClosed );
}
KonqSidebarHistoryGroupItem * KonqSidebarHistoryModule::getGroupItem( const KUrl& url )
{
const QString& groupKey = groupForURL( url );
KonqSidebarHistoryGroupItem *group = m_dict.find( groupKey );
if ( !group ) {
group = new KonqSidebarHistoryGroupItem( url, m_topLevelItem );
QString icon = KMimeType::favIconForUrl( url );
if ( icon.isEmpty() )
group->setPixmap( 0, m_folderClosed );
else
group->setFavIcon( SmallIcon( icon ) );
group->setText( 0, groupKey );
m_dict.insert( groupKey, group );
}
return group;
}
void KonqSidebarHistoryModule::slotClearHistory()
{
KGuiItem guiitem = KStandardGuiItem::clear();
guiitem.setIcon( KIcon("edit-clear-history"));
if ( KMessageBox::warningContinueCancel( tree(),
i18n("Do you really want to clear "
"the entire history?"),
i18n("Clear History?"), guiitem )
== KMessageBox::Continue )
KonqHistoryManager::kself()->emitClear();
}
extern "C"
{
KDE_EXPORT KonqSidebarTreeModule* create_konq_sidebartree_history(KonqSidebarTree* par, const bool)
{
return new KonqSidebarHistoryModule(par);
}
}
#include "history_module.moc"

View file

@ -1,105 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HISTORY_MODULE_H
#define HISTORY_MODULE_H
#include <QtCore/QDate>
#include <QtCore/QObject>
#include <Qt3Support/Q3Dict>
#include <QtGui/QPixmap>
#include <kglobal.h>
#include <klocale.h>
#include <konq_sidebartreemodule.h>
#include "history_item.h"
class KActionCollection;
class KonqSidebarHistorySettings;
class KonqSidebarTree;
class KonqSidebarHistoryModule : public QObject, public KonqSidebarTreeModule
{
Q_OBJECT
public:
enum {
ModuleContextMenu = 1,
EntryContextMenu = 2
};
explicit KonqSidebarHistoryModule( KonqSidebarTree * parentTree, const char * name = 0 );
virtual ~KonqSidebarHistoryModule();
virtual void addTopLevelItem( KonqSidebarTreeTopLevelItem * item );
virtual bool handleTopLevelContextMenu( KonqSidebarTreeTopLevelItem *item, const QPoint& pos );
void showPopupMenu( int which, const QPoint& pos );
// called by the items
void showPopupMenu();
void groupOpened( KonqSidebarHistoryGroupItem *item, bool open );
const QDateTime& currentTime() const { return m_currentTime; }
bool sortsByName() const { return m_sortsByName; }
static QString groupForURL( const KUrl& url ) {
static const QString& misc = KGlobal::staticQString(i18n("Miscellaneous"));
return url.host().isEmpty() ? misc : url.host();
}
public Q_SLOTS:
void clear();
private Q_SLOTS:
void slotCreateItems();
void slotEntryAdded( const KonqHistoryEntry & );
void slotEntryRemoved( const KonqHistoryEntry & );
void slotNewWindow();
void slotRemoveEntry();
void slotPreferences();
void slotSettingsChanged();
void slotItemExpanded( Q3ListViewItem * );
void slotSortByName();
void slotSortByDate();
void slotClearHistory();
private:
KonqSidebarHistoryGroupItem *getGroupItem( const KUrl& url );
void sortingChanged();
typedef Q3DictIterator<KonqSidebarHistoryGroupItem> HistoryItemIterator;
Q3Dict<KonqSidebarHistoryGroupItem> m_dict;
KonqSidebarTreeTopLevelItem * m_topLevelItem;
KActionCollection *m_collection;
QPixmap m_folderClosed;
QPixmap m_folderOpen;
bool m_initialized;
bool m_sortsByName;
QDateTime m_currentTime; // used for sorting the items by date
static KonqSidebarHistorySettings *s_settings;
};
#endif // HISTORY_MODULE_H

View file

@ -3,6 +3,5 @@ add_subdirectory( services )
########### install files ###############
install( FILES history_module.desktop dirtree_module.desktop bookmarks_module.desktop DESTINATION ${DATA_INSTALL_DIR}/konqsidebartng/dirtree )
install( FILES home.desktop root.desktop history.desktop bookmarks.desktop services.desktop remote.desktop DESTINATION ${DATA_INSTALL_DIR}/konqsidebartng/entries )
install( FILES dirtree_module.desktop bookmarks_module.desktop DESTINATION ${DATA_INSTALL_DIR}/konqsidebartng/dirtree )

View file

@ -3,4 +3,4 @@ Note: increase the version in konq_tree.cpp when you add
when the user already has old versions.
i.e.
const int currentVersion = 5; <-- change this in konq_tree.cpp
const int currentVersion = 5; <-- change this in konq_sidebartree.cpp

View file

@ -1,180 +0,0 @@
[Desktop Entry]
Type=Link
URL=
Icon=view-history
Name=History
Name[af]=Geskiedenis
Name[ar]=التاريخ
Name[as]=ি
Name[be]=Гісторыя
Name[be@latin]=Historyja
Name[bg]=История
Name[bn]=ি
Name[bn_IN]=
Name[br]=Istor
Name[ca]=Historial
Name[ca@valencia]=Historial
Name[cs]=Historie
Name[csb]=Historëjô
Name[cy]=Hanes
Name[da]=Historik
Name[de]=Verlaufsspeicher
Name[el]=Ιστορικό
Name[en_GB]=History
Name[eo]=Historio
Name[es]=Historial
Name[et]=Ajalugu
Name[eu]=Historia
Name[fa]=تاریخچه
Name[fi]=Historia
Name[fr]=Historique
Name[fy]=Histoarje
Name[ga]=Stair
Name[gl]=Historial
Name[gu]=િ
Name[he]=היסטוריה
Name[hi]=ि
Name[hne]=ि
Name[hr]=Povijest
Name[hsb]=Předchadne přikazy
Name[hu]=Napló
Name[id]=Riwayat
Name[is]=Saga
Name[it]=Cronologia
Name[ja]=
Name[ka]=
Name[kk]=Журнал
Name[km]=
Name[kn]=ಿ
Name[ko]=
Name[ku]=Dîrok
Name[lt]=Istorija
Name[lv]=Vēsture
Name[mai]=ि
Name[mk]=Историја
Name[ml]=ി
Name[mr]=ि
Name[ms]=Sejarah
Name[nb]=Historie
Name[nds]=Vörgeschicht
Name[ne]=ि
Name[nl]=Geschiedenis
Name[nn]=Historie
Name[oc]=Istoric
Name[or]=
Name[pa]=
Name[pl]=Historia
Name[pt]=Histórico
Name[pt_BR]=Histórico
Name[ro]=Istoric
Name[ru]=Журнал
Name[se]=Historihkka
Name[si]=
Name[sk]=História
Name[sl]=Zgodovina
Name[sr]=Историјат
Name[sr@latin]=Istorijat
Name[sv]=Historik
Name[ta]=
Name[te]=ి
Name[tg]=Таърих
Name[th]=
Name[tr]=Geçmiş
Name[uk]=Історія
Name[uz]=Tarix
Name[uz@cyrillic]=Тарих
Name[vi]=Lch s
Name[wa]=Istwere
Name[xh]=Imbali
Name[x-test]=xxHistoryxx
Name[zh_CN]=
Name[zh_TW]=
Comment=This is the history of the URLs you have recently visited. You can sort them in many ways.
Comment[af]=Hierdie is die geskiedenis van die Urls jy het onlangse besoekte. jy kan sorteer hulle in veel maniere.
Comment[ar]=هنا عناوين المواقع التي زرتها مؤخراً يمكنك معاينتها بطرق عدة
Comment[as]= ি URL ি ি িি
Comment[be]=Гэта гісторыя спасылак URL, якія вы раней наведалі. Вы можаце ўпарадкаваць іх рознымі спосабамі.
Comment[be@latin]=Historyja nadoječy naviedanych adrasoŭ. Hety śpis možna paradkavać u roznyja sposaby.
Comment[bg]=История на скоро посетените адреси
Comment[bn]=ি ি --- ি ি ি িি
Comment[ca]=Aquest és l'historial amb els URL que heu visitat recentment. Podeu ordenar-los de moltes maneres.
Comment[ca@valencia]=Este és l'historial amb els URL que heu visitat recentment. Podeu ordenar-los de moltes maneres.
Comment[cs]=Toto je historie URL, které jste naposledy navštívili. Můžete si je různými způsoby setřídit.
Comment[csb]=Historëjô slédno òbzérónëch adresów URL. Mòże jã na wszelejaczé ôrte zortowac.
Comment[cy]=Dyma hanes y safleoedd rydych wedi ymweld a nhw. Gallwch eu didoli mewn sawl ffordd.
Comment[da]=Dette er historikken for de URL'er du har besøgt for nyligt. Du kan sortere dem på mange måder.
Comment[de]=Dies ist ein Ordner für alle Adressen, die Sie in letzter Zeit besucht haben. Sie können sie auf vielerlei Weise sortieren.
Comment[el]=Αυτό είναι το ιστορικό των URL που επισκεφθήκατε πρόσφατα. Μπορείτε να τα ταξινομήσετε με πολλούς τρόπους.
Comment[en_GB]=This is the history of the URLs you have recently visited. You can sort them in many ways.
Comment[eo]=Jen la historio de la vizititaj URLoj. Vi povas ordigi ilin diversmaniere.
Comment[es]=Este es el historial con las URLs que ha visitado recientemente. Puede ordenarlas de diversos modos.
Comment[et]=Sinu viimati külastatud saitide ajalugu. Ajalugu on võimalik mitmel moel sorteerida.
Comment[eu]=Hau bisitatu berri dituzun URLen historia da. Era askotan antola ditzakezu
Comment[fa]=این تاریخچۀ نشانیهای وبی است که اخیراً بازدید کردهاید. میتوانید آنها را به روشهای زیادی مرتب کنید.
Comment[fi]=Tämä on historia selatuista verkko-osoitteista. Ne voidaan järjestää monella tavalla.
Comment[fr]=Voici la liste des URL que vous avez récemment visitées. Vous pouvez les trier de multiples façons.
Comment[fy]=Dit is de histoarje fan de URL-adressen wêr jo koartlyn west ha. Jo kinne se op ferskate manieren sortearje.
Comment[ga]=Seo é an liosta URLanna a rinneadh cuairt orthu le déanaí. Is féidir iad a shórtáil ar a lán bealaí.
Comment[gl]=Este é o historial dos URL que visitou recentemente. Pode ordenalos de varios xeitos.
Comment[gu]= URL િ . .
Comment[he]=זוהי היסטוריית הכתובות בהן ביקרת לאחרונה. באפשרותך לסדר אותה במגוון דרכים.
Comment[hi]= ि ि , ि . .
Comment[hne]= , ि . .
Comment[hr]=Povijest nedavno posjećenih URL adresa koji je moguće preslagivati na različite načine
Comment[hsb]=Tu je lisćina URLow, hdźež sće njedawno pobyli. Móžeće je wšelako sortěrować.
Comment[hu]=Itt láthatók a legutóbb meglátogatott URL-ek. Többféle szempont szerint is sorba rendezhetők.
Comment[id]=Ini adalah riwayat URL yang baru saja anda kunjungi. Anda dapat mengurutkannya dalam banyak cara.
Comment[is]=Þetta er saga þeirra heimasíðna sem þú hefur heimsótt. Þú getur raðað þessum lista á ýmsan hátt.
Comment[it]=Questa è la cronologia degli indirizzi URL che hai visitato recentemente. Puoi ordinarli in vari modi.
Comment[ja]= URL
Comment[ka]= URL- .
Comment[kk]=Жуырда жолыққан URL адрестер. Өз ыңғайыңызға қарай реттеп алуға болады.
Comment[km]= URL    
Comment[kn]= ಿ ಿ URL ಿ . ಿಿ ಿ ()
Comment[ko]= URL . .
Comment[ku]=Ev dîroka URl'yên ku te di dawiyê de vekirine ye. Dikarî wan bi gelek awayan rêz bikî
Comment[lt]=Tai Jūsų neseniai aplankytų URL istorija, Jūs galite surūšiuoti juos įvairiais būdais.
Comment[lv]=Šī ir nesen apmeklēto URL vēsture. jūs varat tos sakārtot daudzos veidos.
Comment[mai]= ि , ' ि ि. .
Comment[mk]=Ова е историја на URL кои скоро сте ги посетиле. Може да ги подредувате на разни начини.
Comment[ml]= ി ി ി ി. ി ി ിി.
Comment[mr]= ि URL ि . .
Comment[ms]=Ini ialah sejarah URL yang baru anda lawati. Anda tidak boleh isihkan ia dalam banyak cara.
Comment[nb]=Dette er en liste over de nettadressene du har vært innom nylig. Du kan sortere dem på ulike måter.
Comment[nds]=Dit is de Vörgeschicht vun Sieden, de Du tolest besöcht hest. Du kannst se op mennige Oorden sorteren.
Comment[ne]= ि ि
Comment[nl]=Dit is de geschiedenis van de URL-adressen waar u recentelijk bent geweest. U kunt ze op meerdere manieren sorteren.
Comment[nn]=Dette er historia over adressene du nyleg har vitja. Du kan sortera lista på mange måtar.
Comment[or]= ି ି ିି URL ି ିି ି ି
Comment[pa]= URL ਿ , ਿ
Comment[pl]=Historia ostatnio odwiedzonych adresów URL. Można ją na różne sposoby posortować.
Comment[pt]=O histórico dos URLs visitados recentemente. É possível ordená-los de várias maneiras.
Comment[pt_BR]=Este é o histórico das URLs que você visitou recentemente. Você pode ordenar esta lista de várias maneiras.
Comment[ro]=Acesta este istoricul URL-urilor pe care le-ați vizitat recent. Le puteți sorta în diferite moduri.
Comment[ru]=Журнал недавно посещённых адресов. Его можно настраивать по своему усмотрению.
Comment[se]=Dán listtus oainnát čujuhusaid maid áiddo leat guossohan. Don sáhtát erohallat listtu máŋgga láhkai.
Comment[si]=This is the history of the URLs you have recently visited. You can sort them in many ways.
Comment[sk]=Toto je história URL, ktoré ste naposledy navštívili. Môžete ich utriediť rôznymi spôsobmi.
Comment[sl]=To je zgodovina URL-jev, ki ste jih pred kratkim obiskali. Lahko jih uredite na različne načine.
Comment[sr]=Историјат УРЛова које сте недавно посетили. Можете их поређати на неколико начина.
Comment[sr@latin]=Istorijat URLova koje ste nedavno posetili. Možete ih poređati na nekoliko načina.
Comment[sv]=Det här är historiken på de webbadresser du nyligen besökt. Du kan sortera dem på många sätt.
Comment[ta]= ி ி . ிி ி.
Comment[te]= ిి URLs ి. ిి ి .
Comment[tg]=Журнал недавно посещённых адресов. Его можно настраивать по своему усмотрению.
Comment[th]= URL
Comment[tr]=Bu sizim yakın geçmişte ziyaret ettiğiniz adreslerin bir listesidir. Bunları bir çok şekilde sıralayabilirsiniz.
Comment[uk]=Це - історія URL, які ви недавно відвідали. Ви можете також впорядкувати її будь-яким чином.
Comment[uz]=Yaqinda koʻrgan URL'larning tarixi. Ularni turlicha saralashingiz mumkin
Comment[uz@cyrillic]=Яқинда кўрган URL'ларнинг тарихи. Уларни турлича саралашингиз мумкин
Comment[vi]=Đây là danh sách các đa ch URL bn đã xem gn đây. Bn có th sp xếp li chúng theo vài cách khác nhau.
Comment[wa]=Çouchal c' est l' istwere des hårdêyes ki vos avoz vizité dierinnmint. Vos les ploz relére di sacwantès manires diferinnes.
Comment[xh]=Le yimbali yee URL obusandukuzindwendwela. Ungazibeka ngendlela ezininzi.
Comment[x-test]=xxThis is the history of the URLs you have recently visited. You can sort them in many ways.xx
Comment[zh_CN]= URL
Comment[zh_TW]= URL
Open=false
X-KDE-TreeModule=History
X-KDE-SearchableTreeModule=true
X-KDE-TreeModule-Lib=konq_sidebartree_history
X-KDE-Default-URL=

View file

@ -35,11 +35,6 @@ class KonqSidebar_Tree: public KonqSidebarModule
void del();
void rename();
Q_SIGNALS:
void openUrlRequest( const KUrl &url, const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments());
void createNewWindow( const KUrl &url, const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments(),
const KParts::WindowArgs &windowArgs = KParts::WindowArgs(), KParts::ReadOnlyPart **part = 0 );
void popupMenu( const QPoint &global, const KUrl &url,
const QString &mimeType, mode_t mode = (mode_t)-1 );
void popupMenu( const QPoint &global, const KFileItemList &items );

View file

@ -57,9 +57,9 @@ KonqSideBarWebModule::KonqSideBarWebModule(const KComponentData &componentData,
connect(_htmlPart,
SIGNAL(setAutoReload()), this, SLOT( setAutoReload() ));
connect(_htmlPart,
SIGNAL(openUrlNewWindow(const QString&, KParts::OpenUrlArguments, KParts::BrowserArguments)),
SIGNAL(openUrlNewWindow(QString,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs)),
this,
SLOT(urlNewWindow(const QString&, KParts::OpenUrlArguments, KParts::BrowserArguments)));
SLOT(urlNewWindow(QString,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs)));
connect(_htmlPart,
SIGNAL(submitFormRequest(const char*,const QString&,const QByteArray&,const QString&,const QString&,const QString&)),
this,
@ -116,9 +116,9 @@ void KonqSideBarWebModule::handleURL(const KUrl &) {
}
void KonqSideBarWebModule::urlNewWindow(const QString& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs)
void KonqSideBarWebModule::urlNewWindow(const QString& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs, const KParts::WindowArgs& windowArgs)
{
emit createNewWindow(KUrl(url), args, browserArgs);
emit createNewWindow(KUrl(url), args, browserArgs, windowArgs);
}

View file

@ -73,7 +73,8 @@ class KHTMLSideBar : public KHTMLPart
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments() );
void openUrlNewWindow(const QString& url,
const KParts::OpenUrlArguments& args = KParts::OpenUrlArguments(),
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments() );
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments(),
const KParts::WindowArgs& windowArgs = KParts::WindowArgs());
void reload();
void setAutoReload();
@ -149,16 +150,15 @@ class KonqSideBarWebModule : public KonqSidebarModule
virtual QWidget *getWidget();
Q_SIGNALS:
// TODO move to base class
void submitFormRequest(const char*,const QString&,const QByteArray&,const QString&,const QString&,const QString&);
void openUrlRequest(const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs);
void createNewWindow(const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs);
protected:
virtual void handleURL(const KUrl &url);
private Q_SLOTS:
void urlClicked(const QString& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs);
void formClicked(const KUrl& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs);
void urlNewWindow(const QString& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs);
void urlNewWindow(const QString& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs, const KParts::WindowArgs& windowArgs = KParts::WindowArgs());
void pageLoaded();
void loadFavicon();
void setTitle(const QString&);

View file

@ -1,89 +0,0 @@
[Desktop Entry]
Type=Link
URL=
Icon=applications-internet
Name=Web SideBar Module
Name[af]=Web kantbalk module
Name[ar]=وحدة الشريط الجانبي للشبكة
Name[as]=Web SideBar Module
Name[be]=Модуль cеціўнай бакавой панелі
Name[be@latin]=Modul bakavoj paneli dla sieciva
Name[bg]=Модул за страничния панел на браузъра
Name[bn]= ি
Name[bn_IN]= - ি
Name[ca]=Mòdul web SideBar
Name[ca@valencia]=Mòdul web SideBar
Name[cs]=Webový postranní panel
Name[csb]=Moduł bòczny lëstwë WWW
Name[cy]=Modiwl Bar Ochr Gwe
Name[da]=Netsidepanel-modul
Name[de]=Web-Navigationsbereich
Name[el]=Άρθρωμα πλευρικής μπάρας Ιστού
Name[en_GB]=Web SideBar Module
Name[eo]=TTT-flankzona modulo
Name[es]=Módulo de la barra lateral de web
Name[et]=Veebi külgriba moodul
Name[eu]=Web-eko alboko barraren modulua
Name[fa]=پیمانۀ میله جانبی وب
Name[fi]=Verkkosivupalkkimoduuli
Name[fr]=Module de barre de navigation sur le Web
Name[fy]=Web sydbalke module
Name[ga]=Modúl Barra Taoibh Gréasáin
Name[gl]=Módulo da barra lateral web
Name[gu]=
Name[he]=מודול סרגל צדדי אינטרנטי
Name[hi]=
Name[hne]=
Name[hr]=Modul za web trake
Name[hsb]=Modul za browserowy bóčny pas
Name[hu]=Webes oldalsáv-modul
Name[id]=Modul Batang Sisi Web
Name[is]=Vefhliðarslá
Name[it]=Modulo barra laterale web
Name[ja]=
Name[ka]= Web
Name[kk]=Веб бүйір панель модулі
Name[km]=
Name[kn]= ಿಿ
Name[ko]=
Name[ku]=Modula Darikê Kêlekê ê Webê
Name[lt]=Šoninės žiniatinklio juostos modulis
Name[lv]=Tīmekļa sānjoslas modulis
Name[mai]=
Name[mk]=Модул - Веб-странична лента
Name[ml]=
Name[mr]= ि
Name[ms]=Modul Bar Sisi Web
Name[nb]=Modul for nett-sidestolpe
Name[nds]=Sietpaneel för de Nettnavigatschoon
Name[ne]= ि
Name[nl]=Webzijbalkmodule
Name[nn]=Modul for nett-sidestolpe
Name[or]= ି
Name[pa]=
Name[pl]=Moduł paska bocznego WWW
Name[pt]=Módulo Web da Barra Lateral
Name[pt_BR]=Módulo da Internet da barra lateral
Name[ro]=Modul bară laterală web
Name[ru]=Модуль боковой панели Web
Name[se]=Neahtta-bálddalasholga moduvla
Name[si]=
Name[sk]=Modul bočného Web panelu
Name[sl]=Modul spletne stranske vrstice
Name[sr]=Модул веб бочне траке
Name[sr@latin]=Modul veb bočne trake
Name[sv]=Webbsidoradsmodul
Name[ta]= ி ி
Name[te]=
Name[tg]=Модуль боковой панели Web
Name[th]=
Name[tr]=Web Yan Çubuk Modülü
Name[uk]=Модуль бічної панелі Тенет
Name[uz]=Veb yon paneli moduli
Name[uz@cyrillic]=Веб ён панели модули
Name[vi]=Mô đun Thanh bên Trình duyt
Name[wa]=Module waibe del bår di costé
Name[x-test]=xxWeb SideBar Modulexx
Name[zh_CN]=
Name[zh_TW]=
X-KDE-KonqSidebarModule=konqsidebar_web

View file

@ -15,11 +15,17 @@ configure_file(config-konqueror.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-konqu
# For crc32 in konqhistorymanager.cpp
include_directories( ${ZLIB_INCLUDE_DIR} )
########### libkonquerorprivate, shared with sidebar modules ###############
########### libkonquerorprivate, shared with unit tests and sidebar modules ###############
set(konquerorprivate_SRCS
konqpixmapprovider.cpp
konqhistorymanager.cpp
konqhistorymanager.cpp # for unit tests
konqpixmapprovider.cpp # needed ?!?
# for the sidebar history module
konqhistorymodel.cpp
konqhistoryproxymodel.cpp
konqhistoryview.cpp
konqhistorysettings.cpp
)
qt4_add_dbus_interface(konquerorprivate_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/konq/favicons/org.kde.FavIcon.xml favicon_interface)
@ -65,10 +71,7 @@ set(konqueror_KDEINIT_SRCS
konqclosedwindowsmanager.cpp
konqsessionmanager.cpp
konqcloseditem.cpp
konqhistorymodel.cpp
konqhistoryproxymodel.cpp
konqhistorydialog.cpp
konqhistorysettings.cpp
)
kde4_add_kcfg_files(konqueror_KDEINIT_SRCS konqsettingsxt.kcfgc)

View file

@ -18,94 +18,39 @@
*/
#include "konqhistorydialog.h"
#include "konqhistoryview.h"
#include "konqhistory.h"
#include "konq_historyprovider.h"
#include "konqhistorymodel.h"
#include "konqhistoryproxymodel.h"
#include "konqhistorysettings.h"
#include "konqmisc.h"
#include <QtCore/QTimer>
#include <QtGui/QMenu>
#include <QtGui/QToolBar>
#include <QtGui/QToolButton>
#include <QtGui/QTreeView>
#include <QtGui/QVBoxLayout>
#include <QModelIndex>
#include <QTreeView>
#include <kaction.h>
#include <kactioncollection.h>
#include <kguiitem.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <krun.h>
#include <ktoggleaction.h>
K_GLOBAL_STATIC_WITH_ARGS(KonqHistorySettings, s_settings, (0))
KonqHistoryDialog::KonqHistoryDialog(QWidget *parent)
: KDialog(parent)
, m_searchTimer(0)
{
setCaption(i18n("History"));
setCaption(i18nc("@title:window", "History"));
setButtons(KDialog::Close);
if (!s_settings.exists()) {
s_settings->readSettings(true);
}
QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget());
mainLayout->setMargin(0);
m_treeView = new QTreeView(mainWidget());
m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
m_treeView->setHeaderHidden(true);
connect(m_treeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotOpenWindowForIndex(QModelIndex)));
m_historyProxyModel = new KonqHistoryProxyModel(s_settings, m_treeView);
connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
m_historyProxyModel->setDynamicSortFilter(true);
m_historyProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_historyModel = new KonqHistoryModel(m_historyProxyModel);
m_treeView->setModel(m_historyProxyModel);
m_historyProxyModel->setSourceModel(m_historyModel);
m_treeView->model()->sort(0);
m_historyView = new KonqHistoryView(mainWidget());
connect(m_historyView->treeView(), SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotOpenWindowForIndex(QModelIndex)));
connect(m_historyView, SIGNAL(openUrlInNewWindow(KUrl)), this, SLOT(slotOpenWindow(KUrl)));
m_collection = new KActionCollection(this);
QAction *action = m_collection->addAction("open_new");
action->setIcon(KIcon("window-new"));
action->setText(i18n("New &Window"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotNewWindow()));
action = m_collection->addAction("remove");
action->setIcon(KIcon("edit-delete"));
action->setText(i18n("&Remove Entry"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotRemoveEntry()));
action = m_collection->addAction("clear");
action->setIcon(KIcon("edit-clear-history"));
action->setText(i18n("C&lear History"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotClearHistory()));
action = m_collection->addAction("preferences");
action->setIcon(KIcon("configure"));
action->setText(i18n("&Preferences..."));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotPreferences()));
QActionGroup* sortGroup = new QActionGroup(this);
sortGroup->setExclusive(true);
action = m_collection->addAction("byName");
action->setText(i18n("By &Name"));
action->setCheckable(true);
action->setData(qVariantFromValue(0));
sortGroup->addAction(action);
action = m_collection->addAction("byDate");
action->setText(i18n("By &Date"));
action->setCheckable(true);
action->setData(qVariantFromValue(1));
sortGroup->addAction(action);
sortGroup->actions().at(s_settings->m_sortsByName ? 0 : 1)->setChecked(true);
connect(sortGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotSortChange(QAction *)));
KActionCollection* collection = m_historyView->actionCollection();
QToolBar *toolBar = new QToolBar(mainWidget());
toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@ -115,22 +60,15 @@ KonqHistoryDialog::KonqHistoryDialog(QWidget *parent)
sortButton->setPopupMode(QToolButton::InstantPopup);
sortButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QMenu *sortMenu = new QMenu(sortButton);
sortMenu->addAction(m_collection->action("byName"));
sortMenu->addAction(m_collection->action("byDate"));
sortMenu->addAction(collection->action("byName"));
sortMenu->addAction(collection->action("byDate"));
sortButton->setMenu(sortMenu);
toolBar->addWidget(sortButton);
toolBar->addSeparator();
toolBar->addAction(m_collection->action("preferences"));
m_searchLineEdit = new KLineEdit(mainWidget());
m_searchLineEdit->setClickMessage(i18n("Search in history"));
m_searchLineEdit->setClearButtonShown(true);
connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotFilterTextChanged(QString)));
toolBar->addAction(collection->action("preferences"));
mainLayout->addWidget(toolBar);
mainLayout->addWidget(m_searchLineEdit);
mainLayout->addWidget(m_treeView);
mainLayout->addWidget(m_historyView);
restoreDialogSize(KGlobal::config()->group("History Dialog"));
}
@ -146,116 +84,16 @@ QSize KonqHistoryDialog::sizeHint() const
return QSize(500, 400);
}
void KonqHistoryDialog::slotContextMenu(const QPoint &pos)
void KonqHistoryDialog::slotOpenWindow(const KUrl& url)
{
const QModelIndex index = m_treeView->indexAt(pos);
if (!index.isValid()) {
return;
}
const int nodeType = index.data(KonqHistory::TypeRole).toInt();
QMenu *menu = new QMenu(this);
if (nodeType == KonqHistory::HistoryType) {
menu->addAction(m_collection->action("open_new"));
menu->addSeparator();
}
menu->addAction(m_collection->action("remove"));
menu->addAction(m_collection->action("clear"));
menu->addSeparator();
QMenu *sortMenu = menu->addMenu(i18nc("@action:inmenu Parent of 'By Name' and 'By Date'", "Sort"));
sortMenu->addAction(m_collection->action("byName"));
sortMenu->addAction(m_collection->action("byDate"));
menu->addSeparator();
menu->addAction(m_collection->action("preferences"));
menu->exec(m_treeView->viewport()->mapToGlobal(pos));
delete menu;
}
void KonqHistoryDialog::slotNewWindow()
{
slotOpenWindowForIndex( m_treeView->currentIndex() );
KonqMisc::createNewWindow(url);
}
void KonqHistoryDialog::slotOpenWindowForIndex(const QModelIndex& index)
{
if (!index.isValid() || (index.data(KonqHistory::TypeRole).toInt() != KonqHistory::HistoryType)) {
return;
}
const KUrl url = index.data(KonqHistory::UrlRole).value<KUrl>();
if (!url.isValid()) {
return;
}
KonqMisc::createNewWindow(url);
}
void KonqHistoryDialog::slotRemoveEntry()
{
const QModelIndex index = m_treeView->currentIndex();
if (!index.isValid()) {
return;
}
m_historyModel->deleteItem(m_historyProxyModel->mapToSource(index));
}
void KonqHistoryDialog::slotClearHistory()
{
KGuiItem guiitem = KStandardGuiItem::clear();
guiitem.setIcon(KIcon("edit-clear-history"));
if (KMessageBox::warningContinueCancel(this,
i18n("Do you really want to clear the entire history?"),
i18n("Clear History?"), guiitem)
== KMessageBox::Continue) {
KonqHistoryProvider::self()->emitClear();
const KUrl url = m_historyView->urlForIndex(index);
if (url.isValid()) {
slotOpenWindow(url);
}
}
void KonqHistoryDialog::slotPreferences()
{
// Run the history sidebar settings.
KRun::run("kcmshell4 kcmhistory", KUrl::List(), this);
}
void KonqHistoryDialog::slotSortChange(QAction *action)
{
if (!action) {
return;
}
const int which = action->data().toInt();
switch (which) {
case 0:
s_settings->m_sortsByName = true;
break;
case 1:
s_settings->m_sortsByName = false;
break;
}
s_settings->applySettings();
}
void KonqHistoryDialog::slotFilterTextChanged(const QString &text)
{
Q_UNUSED(text);
if (!m_searchTimer) {
m_searchTimer = new QTimer(this);
m_searchTimer->setSingleShot(true);
connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(slotTimerTimeout()));
}
m_searchTimer->start(600);
}
void KonqHistoryDialog::slotTimerTimeout()
{
m_historyProxyModel->setFilterFixedString(m_searchLineEdit->text());
}
#include "konqhistorydialog.moc"

View file

@ -22,13 +22,8 @@
#include <kdialog.h>
class KonqHistoryView;
class QModelIndex;
class QTimer;
class QTreeView;
class KActionCollection;
class KLineEdit;
class KonqHistoryModel;
class KonqHistoryProxyModel;
class KonqHistoryDialog : public KDialog
{
@ -40,24 +35,12 @@ public:
QSize sizeHint() const;
private slots:
void slotContextMenu(const QPoint &pos);
void slotNewWindow();
void slotRemoveEntry();
void slotClearHistory();
void slotPreferences();
void slotSortChange(QAction *action);
void slotFilterTextChanged(const QString &text);
void slotTimerTimeout();
private Q_SLOTS:
void slotOpenWindow(const KUrl& url);
void slotOpenWindowForIndex(const QModelIndex& index);
private:
QTreeView *m_treeView;
KActionCollection *m_collection;
KonqHistoryModel *m_historyModel;
KonqHistoryProxyModel *m_historyProxyModel;
KLineEdit *m_searchLineEdit;
QTimer *m_searchTimer;
KonqHistoryView *m_historyView;
};
#endif // KONQ_HISTORYDIALOG_H

View file

@ -27,6 +27,7 @@ KonqHistoryProxyModel::KonqHistoryProxyModel(KonqHistorySettings *settings, QObj
, m_settings(settings)
{
setDynamicSortFilter(true);
setFilterCaseSensitivity(Qt::CaseInsensitive);
connect(m_settings, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged()));
}

View file

@ -27,8 +27,19 @@
#include <kglobal.h>
#include <kconfiggroup.h>
KonqHistorySettings::KonqHistorySettings( QObject *parent )
: QObject( parent )
struct KonqHistorySettingsSingleton
{
KonqHistorySettings self;
};
K_GLOBAL_STATIC(KonqHistorySettingsSingleton, globalHistorySettings);
KonqHistorySettings* KonqHistorySettings::self()
{
return &globalHistorySettings->self;
}
KonqHistorySettings::KonqHistorySettings()
: QObject( 0 )
{
m_fontOlderThan.setItalic( true ); // default
@ -38,21 +49,27 @@ KonqHistorySettings::KonqHistorySettings( QObject *parent )
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject( dbusPath, this );
dbus.connect(QString(), dbusPath, dbusInterface, "notifySettingsChanged", this, SLOT(slotSettingsChanged()));
readSettings(false);
}
KonqHistorySettings::~KonqHistorySettings()
{
}
void KonqHistorySettings::readSettings(bool global)
void KonqHistorySettings::readSettings(bool reparse)
{
KSharedConfigPtr config;
if (global)
if (KGlobal::mainComponent().componentName() == QLatin1String("konqueror"))
config = KGlobal::config();
else
config = KSharedConfig::openConfig("konquerorrc");
if (reparse) {
config->reparseConfiguration();
}
const KConfigGroup cg( config, "HistorySettings");
m_valueYoungerThan = cg.readEntry("Value youngerThan", 1 );
m_valueOlderThan = cg.readEntry("Value olderThan", 2 );
@ -94,7 +111,7 @@ void KonqHistorySettings::applySettings()
void KonqHistorySettings::slotSettingsChanged()
{
readSettings(false);
readSettings(true /*reparse*/);
emit settingsChanged();
}

View file

@ -38,10 +38,9 @@ class KonqHistorySettings : public QObject
public:
enum { MINUTES, DAYS };
KonqHistorySettings( QObject *parent );
static KonqHistorySettings* self();
virtual ~KonqHistorySettings();
void readSettings(bool global);
void applySettings();
uint m_valueYoungerThan;
@ -68,6 +67,12 @@ protected:
Q_SIGNALS:
// DBus signals
void notifySettingsChanged();
private:
void readSettings(bool reparse);
friend class KonqHistorySettingsSingleton;
KonqHistorySettings();
};
class KonqHistorySettingsAdaptor : public QDBusAbstractAdaptor

View file

@ -0,0 +1,212 @@
/* This file is part of the KDE project
Copyright 2009 Pino Toscano <pino@kde.org>
Copyright 2009 Daivd Faure <faure@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "konqhistoryview.h"
#include <QMenu>
#include "konqhistory.h"
#include "konq_historyprovider.h"
#include "konqhistorymodel.h"
#include "konqhistoryproxymodel.h"
#include "konqhistorysettings.h"
#include <QTreeView>
#include <QVBoxLayout>
#include <kactioncollection.h>
#include <kaction.h>
#include <kicon.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <krun.h>
KonqHistoryView::KonqHistoryView(QWidget* parent)
: QWidget(parent)
, m_searchTimer(0)
{
m_treeView = new QTreeView(this);
m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
m_treeView->setHeaderHidden(true);
m_historyProxyModel = new KonqHistoryProxyModel(KonqHistorySettings::self(), m_treeView);
connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
m_historyModel = new KonqHistoryModel(m_historyProxyModel);
m_treeView->setModel(m_historyProxyModel);
m_historyProxyModel->setSourceModel(m_historyModel);
m_historyProxyModel->sort(0);
m_collection = new KActionCollection(this);
QAction *action = m_collection->addAction("open_new");
action->setIcon(KIcon("window-new"));
action->setText(i18n("Open in New &Window"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotNewWindow()));
action = m_collection->addAction("remove");
action->setIcon(KIcon("edit-delete"));
action->setText(i18n("&Remove Entry"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotRemoveEntry()));
action = m_collection->addAction("clear");
action->setIcon(KIcon("edit-clear-history"));
action->setText(i18n("C&lear History"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotClearHistory()));
action = m_collection->addAction("preferences");
action->setIcon(KIcon("configure"));
action->setText(i18n("&Preferences..."));
connect(action, SIGNAL(triggered(bool)), this, SLOT(slotPreferences()));
QActionGroup* sortGroup = new QActionGroup(this);
sortGroup->setExclusive(true);
action = m_collection->addAction("byName");
action->setText(i18n("By &Name"));
action->setCheckable(true);
action->setData(qVariantFromValue(0));
sortGroup->addAction(action);
action = m_collection->addAction("byDate");
action->setText(i18n("By &Date"));
action->setCheckable(true);
action->setData(qVariantFromValue(1));
sortGroup->addAction(action);
KonqHistorySettings* settings = KonqHistorySettings::self();
sortGroup->actions().at(settings->m_sortsByName ? 0 : 1)->setChecked(true);
connect(sortGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotSortChange(QAction *)));
m_searchLineEdit = new KLineEdit(this);
m_searchLineEdit->setClickMessage(i18n("Search in history"));
m_searchLineEdit->setClearButtonShown(true);
connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotFilterTextChanged(QString)));
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);
mainLayout->addWidget(m_searchLineEdit);
mainLayout->addWidget(m_treeView);
}
void KonqHistoryView::slotContextMenu(const QPoint &pos)
{
const QModelIndex index = m_treeView->indexAt(pos);
if (!index.isValid()) {
return;
}
const int nodeType = index.data(KonqHistory::TypeRole).toInt();
QMenu *menu = new QMenu(this);
if (nodeType == KonqHistory::HistoryType) {
menu->addAction(m_collection->action("open_new"));
menu->addSeparator();
}
menu->addAction(m_collection->action("remove"));
menu->addAction(m_collection->action("clear"));
menu->addSeparator();
QMenu *sortMenu = menu->addMenu(i18nc("@action:inmenu Parent of 'By Name' and 'By Date'", "Sort"));
sortMenu->addAction(m_collection->action("byName"));
sortMenu->addAction(m_collection->action("byDate"));
menu->addSeparator();
menu->addAction(m_collection->action("preferences"));
menu->exec(m_treeView->viewport()->mapToGlobal(pos));
delete menu;
}
void KonqHistoryView::slotRemoveEntry()
{
const QModelIndex index = m_treeView->currentIndex();
if (!index.isValid()) {
return;
}
m_historyModel->deleteItem(m_historyProxyModel->mapToSource(index));
}
void KonqHistoryView::slotClearHistory()
{
KGuiItem guiitem = KStandardGuiItem::clear();
guiitem.setIcon(KIcon("edit-clear-history"));
if (KMessageBox::warningContinueCancel(this,
i18n("Do you really want to clear the entire history?"),
i18n("Clear History?"), guiitem)
== KMessageBox::Continue) {
KonqHistoryProvider::self()->emitClear();
}
}
void KonqHistoryView::slotPreferences()
{
// Run the history sidebar settings.
KRun::run("kcmshell4 kcmhistory", KUrl::List(), this);
}
void KonqHistoryView::slotSortChange(QAction *action)
{
if (!action) {
return;
}
const int which = action->data().toInt();
KonqHistorySettings* settings = KonqHistorySettings::self();
settings->m_sortsByName = (which == 0);
settings->applySettings();
}
void KonqHistoryView::slotFilterTextChanged(const QString &text)
{
Q_UNUSED(text);
if (!m_searchTimer) {
m_searchTimer = new QTimer(this);
m_searchTimer->setSingleShot(true);
connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(slotTimerTimeout()));
}
m_searchTimer->start(600);
}
void KonqHistoryView::slotTimerTimeout()
{
m_historyProxyModel->setFilterFixedString(m_searchLineEdit->text());
}
QTreeView* KonqHistoryView::treeView() const
{
return m_treeView;
}
void KonqHistoryView::slotNewWindow()
{
const KUrl url = urlForIndex(m_treeView->currentIndex());
if (url.isValid())
emit openUrlInNewWindow(url);
}
KUrl KonqHistoryView::urlForIndex(const QModelIndex& index) const
{
if (!index.isValid() || (index.data(KonqHistory::TypeRole).toInt() != KonqHistory::HistoryType)) {
return KUrl();
}
return index.data(KonqHistory::UrlRole).value<KUrl>();
}
#include "konqhistoryview.moc"

View file

@ -0,0 +1,77 @@
/* This file is part of the KDE project
Copyright 2009 Pino Toscano <pino@kde.org>
Copyright 2009 Daivd Faure <faure@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KONQHISTORYVIEW_H
#define KONQHISTORYVIEW_H
#include <konqprivate_export.h>
#include <QtGui/QWidget>
class KUrl;
class QModelIndex;
class QTreeView;
class QTimer;
class KLineEdit;
class KonqHistoryProxyModel;
class KonqHistoryModel;
class KActionCollection;
/**
* The widget containing the tree view showing the history,
* and the search lineedit on top of it.
*
* This widget is shared between the history dialog and the
* history sidebar module.
*/
class KONQUERORPRIVATE_EXPORT KonqHistoryView : public QWidget
{
Q_OBJECT
public:
explicit KonqHistoryView(QWidget* parent);
KActionCollection *actionCollection() { return m_collection; }
QTreeView* treeView() const;
KUrl urlForIndex(const QModelIndex& index) const;
Q_SIGNALS:
void openUrlInNewWindow(const KUrl& url);
private Q_SLOTS:
void slotContextMenu(const QPoint &pos);
void slotRemoveEntry();
void slotClearHistory();
void slotPreferences();
void slotSortChange(QAction *action);
void slotFilterTextChanged(const QString &text);
void slotTimerTimeout();
void slotNewWindow();
private:
QTreeView* m_treeView;
KActionCollection *m_collection;
KonqHistoryModel *m_historyModel;
KonqHistoryProxyModel *m_historyProxyModel;
KLineEdit *m_searchLineEdit;
QTimer *m_searchTimer;
};
#endif /* KONQHISTORYVIEW_H */