kio Library API Documentation

kbookmarkmenu.h

00001 //  -*- c-basic-offset:4; indent-tabs-mode:nil -*-
00002 // vim: set ts=4 sts=4 sw=4 et:
00003 /* This file is part of the KDE project
00004    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
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 
00035 #include "kbookmark.h"
00036 #include "kbookmarkmanager.h"
00037 
00038 class QString;
00039 class QPopupMenu;
00040 class QPushButton;
00041 class QListView;
00042 class KLineEdit;
00043 class KBookmark;
00044 class KBookmarkGroup;
00045 class KAction;
00046 class KActionMenu;
00047 class KActionCollection;
00048 class KBookmarkOwner;
00049 class KBookmarkMenu;
00050 class KPopupMenu;
00051 
00052 namespace KIO { class Job; }
00053 
00078 class KBookmarkMenu : public QObject
00079 {
00080   Q_OBJECT
00081   friend class KBookmarkMenuNSImporter;
00082   friend class RMB;
00083 public:
00102   KBookmarkMenu( KBookmarkManager* mgr,
00103                  KBookmarkOwner * owner, KPopupMenu * parentMenu,
00104                  KActionCollection * collec, bool root, bool add = true,
00105                  const QString & parentAddress = "" );
00106 
00107   ~KBookmarkMenu();
00108 
00114   void fillBookmarkMenu();
00115 
00120   void ensureUpToDate();
00121 
00127   // TODO - transform into class
00128   struct DynMenuInfo {
00129      bool show;
00130      QString location;
00131      QString type;
00132      QString name;
00133      class DynMenuInfoPrivate *d;
00134   };
00135 
00140   static DynMenuInfo showDynamicBookmarks( const QString &id );
00141 
00150   static void setDynamicBookmarks( const QString &id, const DynMenuInfo &info );
00151 
00156   static QStringList dynamicBookmarksList();
00157 
00158 signals:
00159   void aboutToShowContextMenu( const KBookmark &, QPopupMenu * );
00160 
00161 public slots: // public for bookmark bar
00162   void slotBookmarksChanged( const QString & );
00163 
00164 protected slots:
00165   void slotAboutToShow();
00166   void slotAboutToShowContextMenu( KPopupMenu *, int, QPopupMenu * );
00167   void slotActionHighlighted( KAction * );
00168 
00169   void slotRMBActionRemove( int );
00170   void slotRMBActionInsert( int );
00171   void slotRMBActionCopyLocation( int );
00172   void slotRMBActionEditAt( int );
00173   void slotRMBActionProperties( int );
00174 
00175   void slotBookmarkSelected();
00176   void slotAddBookmarksList();
00177   void slotAddBookmark();
00178   void slotNewFolder();
00179 
00183   void slotNSLoad();
00184 
00185 protected:
00186   KExtendedBookmarkOwner* extOwner();
00187   void refill();
00188   void addAddBookmark();
00189   void addAddBookmarksList();
00190   void addEditBookmarks();
00191   void addNewFolder();
00192 
00193   void fillContextMenu( QPopupMenu *, const QString &, int );
00194 
00195   bool m_bIsRoot:1;
00196   bool m_bAddBookmark:1;
00197   bool m_bDirty:1;
00198   bool m_bNSBookmark:1;
00199   bool m_bAddShortcuts:1;
00200 
00201   KBookmarkManager * m_pManager;
00202   KBookmarkOwner *m_pOwner;
00207   KPopupMenu * m_parentMenu;
00211   QPtrList<KBookmarkMenu> m_lstSubMenus;
00212   KActionCollection * m_actionCollection;
00216   QPtrList<KAction> m_actions;
00220   QString m_parentAddress;
00221 
00222   // TODO make non static!
00223   static QString s_highlightedAddress;
00224   static QString s_highlightedImportLocation;
00225   static QString s_highlightedImportType;
00226 };
00227 
00231 class KBookmarkMenuNSImporter : public QObject
00232 {
00233   Q_OBJECT
00234 public:
00235   KBookmarkMenuNSImporter( KBookmarkManager* mgr, KBookmarkMenu * menu, KActionCollection * act ) :
00236      m_menu(menu), m_actionCollection(act), m_pManager(mgr) {}
00237 
00238   void openNSBookmarks();
00239   void openBookmarks( const QString &location, const QString &type );
00240   void connectToImporter( const QObject &importer );
00241 
00242 protected slots:
00243   void newBookmark( const QString & text, const QCString & url, const QString & );
00244   void newFolder( const QString & text, bool, const QString & );
00245   void newSeparator();
00246   void endFolder();
00247 
00248 protected:
00249   QPtrStack<KBookmarkMenu> mstack;
00250   KBookmarkMenu * m_menu;
00251   KActionCollection * m_actionCollection;
00252   KBookmarkManager* m_pManager;
00253 };
00254 
00255 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 3 19:23:39 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003