00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef HISTORY_MODULE_H
00020 #define HISTORY_MODULE_H
00021
00022 #include <tqdatetime.h>
00023 #include <tqobject.h>
00024 #include <tqdict.h>
00025 #include <tqpixmap.h>
00026
00027 #include <kglobal.h>
00028 #include <klocale.h>
00029 #include <konq_sidebartreemodule.h>
00030
00031 #include "history_item.h"
00032
00033 class KActionCollection;
00034 class KDialogBase;
00035 class KonqSidebarHistorySettings;
00036 class KonqSidebarTree;
00037 class KonqSidebarTreeItem;
00038
00039 class KonqSidebarHistoryModule : public TQObject, public KonqSidebarTreeModule
00040 {
00041 Q_OBJECT
00042
00043 public:
00044 enum {
00045 ModuleContextMenu = 1,
00046 EntryContextMenu = 2
00047 };
00048
00049 KonqSidebarHistoryModule( KonqSidebarTree * parentTree, const char * name = 0 );
00050 virtual ~KonqSidebarHistoryModule();
00051
00052 virtual void addTopLevelItem( KonqSidebarTreeTopLevelItem * item );
00053 virtual bool handleTopLevelContextMenu( KonqSidebarTreeTopLevelItem *item, const TQPoint& pos );
00054
00055 void showPopupMenu( int which, const TQPoint& pos );
00056
00057
00058 void showPopupMenu();
00059 void groupOpened( KonqSidebarHistoryGroupItem *item, bool open );
00060 const TQDateTime& currentTime() const { return m_currentTime; }
00061 bool sortsByName() const { return m_sortsByName; }
00062
00063 static TQString groupForURL( const KURL& url ) {
00064 static const TQString& misc = KGlobal::staticQString(i18n("Miscellaneous"));
00065 return url.host().isEmpty() ? misc : url.host();
00066 }
00067
00068 public slots:
00069 void clear();
00070
00071 private slots:
00072 void slotCreateItems();
00073 void slotEntryAdded( const KonqHistoryEntry * );
00074 void slotEntryRemoved( const KonqHistoryEntry * );
00075
00076 void slotNewWindow();
00077 void slotRemoveEntry();
00078 void slotPreferences();
00079 void slotSettingsChanged();
00080
00081 void slotItemExpanded( TQListViewItem * );
00082
00083 void slotSortByName();
00084 void slotSortByDate();
00085
00086 void slotClearHistory();
00087
00088 private:
00089 KonqSidebarHistoryGroupItem *getGroupItem( const KURL& url );
00090
00091 void sortingChanged();
00092 typedef TQDictIterator<KonqSidebarHistoryGroupItem> HistoryItemIterator;
00093 TQDict<KonqSidebarHistoryGroupItem> m_dict;
00094
00095 KonqSidebarTreeTopLevelItem * m_topLevelItem;
00096
00097 KActionCollection *m_collection;
00098
00099 KDialogBase *m_dlg;
00100 TQPixmap m_folderClosed;
00101 TQPixmap m_folderOpen;
00102 bool m_initialized;
00103 bool m_sortsByName;
00104 TQDateTime m_currentTime;
00105 static KonqSidebarHistorySettings *s_settings;
00106 };
00107
00108 #endif // HISTORY_MODULE_H