kio
kbookmarkmenu.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __kbookmarkmenu_h__
00023 #define __kbookmarkmenu_h__
00024
00025 #include <sys/types.h>
00026
00027 #include <qptrlist.h>
00028 #include <qptrstack.h>
00029 #include <qobject.h>
00030 #include <qlistview.h>
00031
00032 #include <kdialogbase.h>
00033 #include <klocale.h>
00034 #include <kaction.h>
00035
00036 #include "kbookmark.h"
00037 #include "kbookmarkmanager.h"
00038
00039 class QString;
00040 class QPopupMenu;
00041 class QPushButton;
00042 class QListView;
00043 class KLineEdit;
00044 class KBookmark;
00045 class KBookmarkGroup;
00046 class KAction;
00047 class KActionMenu;
00048 class KActionCollection;
00049 class KBookmarkOwner;
00050 class KBookmarkMenu;
00051 class KPopupMenu;
00052
00053 namespace KIO { class Job; }
00054
00079 class KIO_EXPORT KBookmarkMenu : public QObject
00080 {
00081 Q_OBJECT
00082 friend class KBookmarkMenuNSImporter;
00083 friend class RMB;
00084 public:
00104 KBookmarkMenu( KBookmarkManager* mgr,
00105 KBookmarkOwner * owner, KPopupMenu * parentMenu,
00106 KActionCollection * collec, bool root, bool add = true,
00107 const QString & parentAddress = "" );
00108
00109 ~KBookmarkMenu();
00110
00116 void fillBookmarkMenu();
00117
00122 void ensureUpToDate();
00123
00129
00130 struct DynMenuInfo {
00131 bool show;
00132 QString location;
00133 QString type;
00134 QString name;
00135 class DynMenuInfoPrivate *d;
00136 };
00137
00142 static DynMenuInfo showDynamicBookmarks( const QString &id );
00143
00152 static void setDynamicBookmarks( const QString &id, const DynMenuInfo &info );
00153
00158 static QStringList dynamicBookmarksList();
00159
00160 signals:
00161 void aboutToShowContextMenu( const KBookmark &, QPopupMenu * );
00165 void openBookmark( const QString& url, Qt::ButtonState state );
00166
00167 public slots:
00168 void slotBookmarksChanged( const QString & );
00169
00170 protected slots:
00171 void slotAboutToShow();
00172 void slotAboutToShowContextMenu( KPopupMenu *, int, QPopupMenu * );
00173 void slotActionHighlighted( KAction * );
00174
00175 void slotRMBActionRemove( int );
00176 void slotRMBActionInsert( int );
00177 void slotRMBActionCopyLocation( int );
00178 void slotRMBActionEditAt( int );
00179 void slotRMBActionProperties( int );
00180
00181 void slotBookmarkSelected();
00185 void slotBookmarkSelected( KAction::ActivationReason reason, Qt::ButtonState state );
00186 void slotAddBookmarksList();
00187 void slotAddBookmark();
00188 void slotNewFolder();
00189
00193 void slotNSLoad();
00194
00195 protected:
00196 KExtendedBookmarkOwner* extOwner();
00197 void refill();
00198 void addAddBookmark();
00199 void addAddBookmarksList();
00200 void addEditBookmarks();
00201 void addNewFolder();
00202
00203 void fillContextMenu( QPopupMenu *, const QString &, int );
00204
00205 bool m_bIsRoot:1;
00206 bool m_bAddBookmark:1;
00207 bool m_bDirty:1;
00208 bool m_bNSBookmark:1;
00209 bool m_bAddShortcuts:1;
00210
00211 KBookmarkManager * m_pManager;
00212 KBookmarkOwner *m_pOwner;
00217 KPopupMenu * m_parentMenu;
00221 QPtrList<KBookmarkMenu> m_lstSubMenus;
00222 KActionCollection * m_actionCollection;
00226 QPtrList<KAction> m_actions;
00230 QString m_parentAddress;
00231
00232
00233 static QString s_highlightedAddress;
00234 static QString s_highlightedImportLocation;
00235 static QString s_highlightedImportType;
00236 };
00237
00241 class KIO_EXPORT KBookmarkMenuNSImporter : public QObject
00242 {
00243 Q_OBJECT
00244 public:
00245 KBookmarkMenuNSImporter( KBookmarkManager* mgr, KBookmarkMenu * menu, KActionCollection * act ) :
00246 m_menu(menu), m_actionCollection(act), m_pManager(mgr) {}
00247
00248 void openNSBookmarks();
00249 void openBookmarks( const QString &location, const QString &type );
00250 void connectToImporter( const QObject &importer );
00251
00252 protected slots:
00253 void newBookmark( const QString & text, const QCString & url, const QString & );
00254 void newFolder( const QString & text, bool, const QString & );
00255 void newSeparator();
00256 void endFolder();
00257
00258 protected:
00259 QPtrStack<KBookmarkMenu> mstack;
00260 KBookmarkMenu * m_menu;
00261 KActionCollection * m_actionCollection;
00262 KBookmarkManager* m_pManager;
00263 };
00264
00265 #endif