Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / lib / konq / konq_popupmenuplugin.h
blob54cc3b83237e0578371bf45a64addbfb24d7572a
1 /* This file is part of the KDE project
2 Copyright 2008 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_POPUPMENUPLUGIN_H
22 #define KONQ_POPUPMENUPLUGIN_H
24 #include "libkonq_export.h"
25 #include <QtCore/QObject>
27 class QMenu;
28 class KActionCollection;
29 class KonqPopupMenuInformation;
31 /**
32 * Base class for KonqPopupMenu plugins.
34 * Please try to use servicemenus first, if you simply need to add
35 * actions to the popup menu for one or more mimetypes.
37 * However if you need some dynamic logic, like "only show this item if
38 * two files are selected", or "show a submenu with a variable number of actions",
39 * then you have to implement a KonqPopupMenuPlugin subclass.
41 class LIBKONQ_EXPORT KonqPopupMenuPlugin : public QObject
43 Q_OBJECT
44 public:
46 /**
47 * Constructor.
49 KonqPopupMenuPlugin(QObject* parent);
50 virtual ~KonqPopupMenuPlugin();
52 /**
53 * Implement the setup method in the plugin in order to create actions
54 * in the given actionCollection and add it to the menu using menu->addAction().
56 * @param actionCollection the parent for the actions
57 * @param popupMenuInfo all the information about the popupmenu being shown
58 * (which file items, their common mimetype, etc.)
59 * @param menu the menu where the plugin can add its own actions
61 virtual void setup(KActionCollection* actionCollection,
62 const KonqPopupMenuInformation& popupMenuInfo,
63 QMenu *menu) = 0;
66 #endif /* KONQ_POPUPMENUPLUGIN_H */