1 /* This file is part of the KDE project
2 Copyright (C) 1998-2007 David Faure <faure@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef KONQ_MENUACTIONS_H
21 #define KONQ_MENUACTIONS_H
23 #include <kfileitem.h>
24 #include <libkonq_export.h>
26 class KonqPopupMenuInformation
;
28 class KonqMenuActionsPrivate
;
31 * This class handles the user-defined actions for a url in a popupmenu.
32 * User-defined actions include:
33 * - builtin services like mount/unmount for old-style device desktop files
34 * - user-defined actions for a .desktop file, defined in the file itself (see the desktop entry standard)
35 * - servicemenus actions, defined in .desktop files and selected based on the mimetype of the url
37 * In addition it can also add "open with" actions.
39 class LIBKONQ_EXPORT KonqMenuActions
43 * Creates a KonqMenuActions instance.
44 * Note that this instance must stay alive for at least as long as the popupmenu;
45 * it has the slots for the actions created by addActionsTo.
55 * Sets all the data for the next instance of the popupmenu.
56 * @see KonqPopupMenuInformation
58 void setPopupMenuInfo(const KonqPopupMenuInformation
& info
);
61 * Generate the user-defined actions and submenus, and adds them to the @p menu.
62 * User-defined actions include:
63 * - builtin services like mount/unmount for old-style device desktop files
64 * - user-defined actions for a .desktop file, defined in the file itself (see the desktop entry standard)
65 * - servicemenus actions, defined in .desktop files and selected based on the mimetype of the url
67 * When KonqPopupMenuInformation::readOnly() is true, actions that modify the files are not shown.
68 * This is controlled by Require=Write in the servicemenu desktop files.
70 * All actions are created as children of the menu.
71 * @return the number of actions added
73 int addActionsTo(QMenu
* menu
); // TODO rename to addUserDefinedActionsTo ?
76 * Generate the "Open With <Application>" actions, and adds them to the @p menu.
77 * All actions are created as children of the menu.
78 * @param menu the QMenu where to add actions
79 * @param traderConstraint this constraint allows to exclude the current application
80 * from the "open with" list. Example: "DesktopEntryName != 'kfmclient'".
82 void addOpenWithActionsTo(QMenu
* menu
, const QString
& traderConstraint
);
85 KonqMenuActionsPrivate
* const d
;
88 #endif /* KONQ_MENUACTIONS_H */