1
/* This file is part of the KDE project
2
Copyright (C) 1998-2009 David Faure <faure@kde.org>
4
This library is free software; you can redistribute it and/or modify
5
it under the terms of the GNU Library General Public License as published
6
by the Free Software Foundation; either version 2 of the License or
7
( at your option ) version 3 or, at the discretion of KDE e.V.
8
( which shall act as a proxy as in section 14 of the GPLv3 ), 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 KONQ_MENUACTIONS_H
22
#define KONQ_MENUACTIONS_H
24
#include <kfileitem.h>
25
#include <libkonq_export.h>
27
class KFileItemActions;
28
class KFileItemListProperties;
30
class KonqPopupMenuInformation;
34
* This class handles the user-defined actions for a url in a popupmenu.
35
* User-defined actions include:
36
* - builtin services like mount/unmount for old-style device desktop files
37
* - user-defined actions for a .desktop file, defined in the file itself (see the desktop entry standard)
38
* - servicemenus actions, defined in .desktop files and selected based on the mimetype of the url
40
* In addition it can also add "open with" actions.
42
class LIBKONQ_EXPORT KonqMenuActions
46
* Creates a KonqMenuActions instance.
47
* Note that this instance must stay alive for at least as long as the popupmenu;
48
* it has the slots for the actions created by addActionsTo.
58
* Sets all the data for the next instance of the popupmenu.
59
* @see KonqPopupMenuInformation
60
* @deprecated use setItemList+setParentWidget
62
KDE_DEPRECATED void setPopupMenuInfo(const KonqPopupMenuInformation& info);
65
* Sets all the data for the next instance of the popupmenu.
66
* @see KFileItemListProperties
69
void setItemListProperties(const KFileItemListProperties& itemList);
72
* Set the parent widget for any dialogs being shown.
74
* This should normally be your mainwindow, not a popup menu,
75
* so that it still exists even after the popup is closed
76
* (e.g. error message from KRun) and so that QAction::setStatusTip
77
* can find a statusbar, too.
80
void setParentWidget(QWidget* widget);
83
* Generate the user-defined actions and submenus, and adds them to the @p menu.
84
* User-defined actions include:
85
* - builtin services like mount/unmount for old-style device desktop files
86
* - user-defined actions for a .desktop file, defined in the file itself (see the desktop entry standard)
87
* - servicemenus actions, defined in .desktop files and selected based on the mimetype of the url
89
* When KFileItemListProperties::supportsWriting() is false, actions that modify the files are not shown.
90
* This is controlled by Require=Write in the servicemenu desktop files.
92
* All actions are created as children of the menu.
93
* @return the number of actions added
95
int addActionsTo(QMenu* menu); // NOTE: renamed to addServiceActionsTo() in KFileItemActions
98
* Generate the "Open With <Application>" actions, and adds them to the @p menu.
99
* All actions are created as children of the menu.
100
* @param menu the QMenu where to add actions
101
* @param traderConstraint this constraint allows to exclude the current application
102
* from the "open with" list. Example: "DesktopEntryName != 'kfmclient'".
104
void addOpenWithActionsTo(QMenu* menu, const QString& traderConstraint);
107
* Returns an action for the preferred app only.
108
* @param traderConstraint this constraint allows to exclude the current application
109
* from the "open with" list. Example: "DesktopEntryName != 'kfmclient'".
110
* @return the action - or 0 if no application was found.
111
* @since 4.3 -- TODO REMOVE AND PORT FOLDERVIEW
113
KAction* preferredOpenWithAction(const QString& traderConstraint);
116
KFileItemActions* const d;
119
#endif /* KONQ_MENUACTIONS_H */