libkonq Library API Documentation

konq_popupmenu.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 David Faure <faure@kde.org>
00003    Copyright (C) 2001 Holger Freyther <freyther@yahoo.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __konqpopupmenu_h
00022 #define __konqpopupmenu_h
00023 
00024 #include <sys/types.h>
00025 
00026 #include <qpopupmenu.h>
00027 #include <qmap.h>
00028 #include <kaction.h>
00029 
00030 #include <qstringlist.h>
00031 
00032 #include <kfileitem.h>
00033 #include <kmimetype.h> // for KDEDesktopMimeType
00034 
00035 #include "konq_xmlguiclient.h"
00036 
00037 class KNewMenu;
00038 class KService;
00039 class KonqPopupMenuPlugin;
00040 class KBookmarkManager;
00047 class KonqPopupMenu : public QPopupMenu, public KonqXMLGUIClient
00048 {
00049   Q_OBJECT
00050 public:
00051 
00066   KonqPopupMenu( KBookmarkManager* manager,
00067                  const KFileItemList &items,
00068                  KURL viewURL,
00069                  KActionCollection & actions,
00070                  KNewMenu * newMenu, bool showPropertiesAndFileType = true );
00071 
00072   KonqPopupMenu( KBookmarkManager* manager,
00073                  const KFileItemList &items,
00074                  KURL viewURL,
00075                  KActionCollection & actions,
00076                  KNewMenu * newMenu, 
00077                  QWidget * parentWidget,
00078                  bool showPropertiesAndFileType = true );
00079     
00083   ~KonqPopupMenu();
00084 
00089   void setURLTitle( const QString& urlTitle );
00090 
00091   class ProtocolInfo {
00092    public:
00093     ProtocolInfo();
00094     bool supportsReading()  const;
00095     bool supportsWriting()  const;
00096     bool supportsDeleting() const;
00097     bool supportsMoving()   const;
00098     bool trashIncluded()    const;
00099    private:
00100     friend class KonqPopupMenu;
00101     bool m_Reading:1;
00102     bool m_Writing:1;
00103     bool m_Deleting:1;
00104     bool m_Moving:1;
00105     bool m_TrashIncluded:1;
00106   };
00110   virtual KAction *action( const QDomElement &element ) const;
00111 
00112 
00113   virtual KActionCollection *actionCollection() const;
00114   QString mimeType( ) const;
00115   KURL url( ) const;
00116   KFileItemList fileItemList() const;
00117   KURL::List popupURLList( ) const;
00118   ProtocolInfo protocolInfo() const;
00119 
00120 public slots:
00121   void slotPopupNewDir();
00122   void slotPopupNewView();
00123   void slotPopupEmptyTrashBin();
00124   void slotPopupOpenWith();
00125   void slotPopupAddToBookmark();
00126   void slotRunService();
00127   void slotPopupMimeType();
00128   void slotPopupProperties();
00129   void slotOpenShareFileDialog();
00130 protected:
00131   KActionCollection &m_actions;
00132   KActionCollection m_ownActions;
00133 
00134 private:
00135   void setup(bool showPropertiesAndFileType);
00136   void addPlugins( );
00137   class KonqPopupMenuPrivate;
00138   KonqPopupMenuPrivate *d;
00139   KNewMenu *m_pMenuNew;
00140   KURL m_sViewURL;
00141   QString m_sMimeType;
00142   KFileItemList m_lstItems;
00143   KURL::List m_lstPopupURLs;
00144   QMap<int,KService::Ptr> m_mapPopup;
00145   QMap<int,KDEDesktopMimeType::Service> m_mapPopupServices;
00146   bool m_bHandleEditOperations;
00147   KXMLGUIFactory *m_factory;
00148   KXMLGUIBuilder *m_builder;
00149   QString attrName;
00150   ProtocolInfo m_info;
00151   QPtrList<KonqPopupMenuPlugin> m_pluginList;
00152   KBookmarkManager* m_pManager;
00153 };
00154 
00155 class KonqPopupMenuPlugin : public QObject, public KonqXMLGUIClient {
00156         Q_OBJECT
00157 public:
00165   KonqPopupMenuPlugin( KonqPopupMenu *_popup, const char *name ); // this should also be the parent
00166   virtual ~KonqPopupMenuPlugin ( );
00167 };
00168 
00169 #endif
00170 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Thu Jan 29 23:03:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001