~ubuntu-branches/ubuntu/raring/kdebase/raring

« back to all changes in this revision

Viewing changes to apps/lib/konq/konq_menuactions.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac, Jonathan Riddell, Felix Geyer
  • Date: 2011-03-03 16:25:47 UTC
  • mfrom: (1.1.58 upstream)
  • Revision ID: james.westby@ubuntu.com-20110303162547-2zf9j33cu6j5gj0a
Tags: 4:4.6.1a-0ubuntu1
[ Jonathan Riddell ]
* New upstream release
* Update kde-sc-dev-latest version

[ Felix Geyer ]
* Reduce the x-www-browser priority for konqueror to 30 as rekonq is the
  default Kubuntu browser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 1998-2009 David Faure <faure@kde.org>
3
 
 
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.
9
 
 
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.
14
 
 
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.
19
 
*/
20
 
 
21
 
#ifndef KONQ_MENUACTIONS_H
22
 
#define KONQ_MENUACTIONS_H
23
 
 
24
 
#include <kfileitem.h>
25
 
#include <libkonq_export.h>
26
 
 
27
 
class KFileItemActions;
28
 
class KFileItemListProperties;
29
 
class KAction;
30
 
class KonqPopupMenuInformation;
31
 
class QMenu;
32
 
 
33
 
/**
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
39
 
 *
40
 
 * In addition it can also add "open with" actions.
41
 
 */
42
 
class LIBKONQ_EXPORT KonqMenuActions
43
 
{
44
 
public:
45
 
    /**
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.
49
 
     */
50
 
    KonqMenuActions();
51
 
 
52
 
    /**
53
 
     * Destructor
54
 
     */
55
 
    ~KonqMenuActions();
56
 
 
57
 
    /**
58
 
     * Sets all the data for the next instance of the popupmenu.
59
 
     * @see KonqPopupMenuInformation
60
 
     * @deprecated use setItemList+setParentWidget
61
 
     */
62
 
    KDE_DEPRECATED void setPopupMenuInfo(const KonqPopupMenuInformation& info);
63
 
 
64
 
    /**
65
 
     * Sets all the data for the next instance of the popupmenu.
66
 
     * @see KFileItemListProperties
67
 
     * @since 4.3
68
 
     */
69
 
    void setItemListProperties(const KFileItemListProperties& itemList);
70
 
 
71
 
    /**
72
 
     * Set the parent widget for any dialogs being shown.
73
 
     *
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.
78
 
     * @since 4.3
79
 
     */
80
 
    void setParentWidget(QWidget* widget);
81
 
 
82
 
    /**
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
88
 
     *
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.
91
 
     *
92
 
     * All actions are created as children of the menu.
93
 
     * @return the number of actions added
94
 
     */
95
 
    int addActionsTo(QMenu* menu); // NOTE: renamed to addServiceActionsTo() in KFileItemActions
96
 
 
97
 
    /**
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'".
103
 
     */
104
 
    void addOpenWithActionsTo(QMenu* menu, const QString& traderConstraint);
105
 
 
106
 
    /**
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
112
 
     */
113
 
    KAction* preferredOpenWithAction(const QString& traderConstraint);
114
 
 
115
 
private:
116
 
    KFileItemActions* const d;
117
 
};
118
 
 
119
 
#endif /* KONQ_MENUACTIONS_H */