Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / lib / konq / konq_popupmenu.h
blob504445f44e50e43620d3fd3642766940f150183f
1 /* This file is part of the KDE project
2 Copyright (C) 1998-2008 David Faure <faure@kde.org>
3 Copyright (C) 2001 Holger Freyther <freyther@yahoo.com>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef __konqpopupmenu_h
22 #define __konqpopupmenu_h
24 #include <sys/types.h>
26 #include <QtCore/QMap>
27 #include <QtGui/QMenu>
29 #include <kaction.h>
30 #include <kactioncollection.h>
31 #include <kfileitem.h>
32 #include <kparts/browserextension.h>
33 #include <kservice.h>
35 #include <libkonq_export.h>
37 class KNewMenu;
38 class KBookmarkManager;
39 class KonqPopupMenuPrivate;
41 /**
42 * This class implements the popup menu for URLs in konqueror and kdesktop
43 * It's usage is very simple : on right click, create the KonqPopupMenu instance
44 * with the correct arguments, then exec() to make it appear, then destroy it.
46 * Users of KonqPopupMenu include: konqueror, the media applet, the trash applet
47 * (and the desktop icons, in kde3)
49 class LIBKONQ_EXPORT KonqPopupMenu : public QMenu
51 Q_OBJECT
52 public:
54 /**
55 * Flags set by the calling application (e.g. konqueror), unlike
56 * KParts::BrowserExtension::PopupFlags, which are set by the calling part
58 typedef uint Flags;
59 enum { NoFlags = 0,
60 ShowNewWindow = 1 };
61 // WARNING: bitfield. Next item is 2
63 /**
64 * Constructor
65 * @param manager the bookmark manager for the "add to bookmark" action
66 * Only used if KParts::BrowserExtension::ShowBookmark is set
67 * @param items the list of file items the popupmenu should be shown for
68 * @param viewURL the URL shown in the view, to test for RMB click on view background
69 * @param actions list of actions the caller wants to see in the menu
70 * @param newMenu "New" menu, shared with the File menu, in konqueror
71 * @param parentWidget the widget we're showing this popup for. Helps destroying
72 * the popup if the widget is destroyed before the popup.
73 * @param appFlags flags from the KonqPopupMenu::Flags enum, set by the calling application
74 * @param partFlags flags from the BrowserExtension enum, set by the calling part
76 * The actions to pass in include :
77 * showmenubar, go_back, go_forward, go_up, cut, copy, paste, pasteto
78 * The others items are automatically inserted.
80 * @todo that list is probably not be up-to-date
82 KonqPopupMenu( const KFileItemList &items,
83 const KUrl& viewURL,
84 KActionCollection & actions,
85 KNewMenu * newMenu,
86 Flags appFlags,
87 KParts::BrowserExtension::PopupFlags partFlags /*= KParts::BrowserExtension::DefaultPopupItems*/,
88 QWidget * parentWidget,
89 KBookmarkManager *manager = 0,
90 const KParts::BrowserExtension::ActionGroupMap& actionGroups = KParts::BrowserExtension::ActionGroupMap()
93 /**
94 * Don't forget to destroy the object
96 ~KonqPopupMenu();
98 /**
99 * Set the title of the URL, when the popupmenu is opened for a single URL.
100 * This is used if the user chooses to add a bookmark for this URL.
102 void setURLTitle( const QString& urlTitle );
104 private:
105 Q_PRIVATE_SLOT(d, void slotPopupNewDir())
106 Q_PRIVATE_SLOT(d, void slotPopupNewView())
107 Q_PRIVATE_SLOT(d, void slotPopupEmptyTrashBin())
108 Q_PRIVATE_SLOT(d, void slotPopupRestoreTrashedItems())
109 Q_PRIVATE_SLOT(d, void slotPopupAddToBookmark())
110 Q_PRIVATE_SLOT(d, void slotPopupMimeType())
111 Q_PRIVATE_SLOT(d, void slotPopupProperties())
112 Q_PRIVATE_SLOT(d, void slotOpenShareFileDialog())
114 private:
115 KonqPopupMenuPrivate *d;
118 #endif