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 <kparts/browserextension.h> 00036 00037 #include "konq_xmlguiclient.h" 00038 00039 typedef QValueList<KDEDesktopMimeType::Service> ServiceList; 00040 00041 class KNewMenu; 00042 class KService; 00043 class KonqPopupMenuPlugin; 00044 class KBookmarkManager; 00051 class KonqPopupMenu : public QPopupMenu, public KonqXMLGUIClient 00052 { 00053 Q_OBJECT 00054 public: 00055 00060 typedef uint KonqPopupFlags; 00061 enum { NoFlags = 0, 00062 ShowProperties = 1, // whether to show the "Properties" menu item 00063 IsLink = 2, // HTML link. If set, we won't have cut/copy/paste, and we'll say "bookmark this link" 00064 ShowNewWindow = 4 }; 00065 // WARNING: bitfield. Next item is 8 00066 00072 KonqPopupMenu( KBookmarkManager* manager, 00073 const KFileItemList &items, 00074 KURL viewURL, 00075 KActionCollection & actions, 00076 KNewMenu * newMenu, 00077 bool showPropertiesAndFileType = true ) KDE_DEPRECATED; 00078 00083 KonqPopupMenu( KBookmarkManager* manager, 00084 const KFileItemList &items, 00085 KURL viewURL, 00086 KActionCollection & actions, 00087 KNewMenu * newMenu, 00088 QWidget * parentWidget, 00089 bool showPropertiesAndFileType = true ) KDE_DEPRECATED; 00090 00109 KonqPopupMenu( KBookmarkManager* manager, 00110 const KFileItemList &items, 00111 const KURL& viewURL, 00112 KActionCollection & actions, 00113 KNewMenu * newMenu, 00114 QWidget * parentWidget, 00115 KonqPopupFlags kpf, 00116 KParts::BrowserExtension::PopupFlags f /*= KParts::BrowserExtension::DefaultPopupItems*/); 00117 00121 ~KonqPopupMenu(); 00122 00127 void setURLTitle( const QString& urlTitle ); 00128 00129 class ProtocolInfo { 00130 public: 00131 ProtocolInfo(); 00132 bool supportsReading() const; 00133 bool supportsWriting() const; 00134 bool supportsDeleting() const; 00135 bool supportsMoving() const; 00136 bool trashIncluded() const; 00137 private: 00138 friend class KonqPopupMenu; 00139 bool m_Reading:1; 00140 bool m_Writing:1; 00141 bool m_Deleting:1; 00142 bool m_Moving:1; 00143 bool m_TrashIncluded:1; 00144 }; 00148 virtual KAction *action( const QDomElement &element ) const; 00149 00150 00151 virtual KActionCollection *actionCollection() const; 00152 QString mimeType( ) const; 00153 KURL url( ) const; 00154 KFileItemList fileItemList() const; 00155 KURL::List popupURLList( ) const; 00156 ProtocolInfo protocolInfo() const; 00157 00158 public slots: 00159 void slotPopupNewDir(); 00160 void slotPopupNewView(); 00161 void slotPopupEmptyTrashBin(); 00162 void slotPopupOpenWith(); 00163 void slotPopupAddToBookmark(); 00164 void slotRunService(); 00165 void slotPopupMimeType(); 00166 void slotPopupProperties(); 00167 void slotOpenShareFileDialog(); 00168 protected: 00169 KActionCollection &m_actions; 00170 KActionCollection m_ownActions; 00171 00172 private: 00173 void init (QWidget * parentWidget, KonqPopupFlags kpf, KParts::BrowserExtension::PopupFlags itemFlags); 00174 void setup(KonqPopupFlags kpf); 00175 void addPlugins( ); 00176 int insertServicesSubmenus(const QMap<QString, ServiceList>& list, QDomElement& menu, bool isBuiltin); 00177 int insertServices(const ServiceList& list, QDomElement& menu, bool isBuiltin); 00178 bool KIOSKAuthorizedAction(KConfig& cfg); 00179 00180 class KonqPopupMenuPrivate; 00181 KonqPopupMenuPrivate *d; 00182 KNewMenu *m_pMenuNew; 00183 KURL m_sViewURL; 00184 QString m_sMimeType; 00185 KFileItemList m_lstItems; 00186 KURL::List m_lstPopupURLs; 00187 QMap<int,KService::Ptr> m_mapPopup; 00188 QMap<int,KDEDesktopMimeType::Service> m_mapPopupServices; 00189 bool m_bHandleEditOperations; 00190 KXMLGUIFactory *m_factory; 00191 KXMLGUIBuilder *m_builder; 00192 QString attrName; 00193 ProtocolInfo m_info; 00194 QPtrList<KonqPopupMenuPlugin> m_pluginList; 00195 KBookmarkManager* m_pManager; 00196 }; 00197 00198 class KonqPopupMenuPlugin : public QObject, public KonqXMLGUIClient { 00199 Q_OBJECT 00200 public: 00208 KonqPopupMenuPlugin( KonqPopupMenu *_popup, const char *name ); // this should also be the parent 00209 virtual ~KonqPopupMenuPlugin ( ); 00210 }; 00211 00212 #endif 00213
KDE Logo
This file is part of the documentation for libkonq Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 16 15:59:26 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003