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