1 | /*************************************************************************** |
2 | * Copyright (C) 2005-2014 by the Quassel Project * |
3 | * devel@quassel-irc.org * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * |
7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) version 3. * |
9 | * * |
10 | * This program 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 * |
13 | * GNU General Public License for more details. * |
14 | * * |
15 | * You should have received a copy of the GNU General Public License * |
16 | * along with this program; if not, write to the * |
17 | * Free Software Foundation, Inc., * |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
19 | ***************************************************************************/ |
20 | |
21 | #ifndef CONTEXTMENUACTIONPROVIDER_H |
22 | #define CONTEXTMENUACTIONPROVIDER_H |
23 | |
24 | #include "networkmodelcontroller.h" |
25 | |
26 | class : public NetworkModelController |
27 | { |
28 | Q_OBJECT |
29 | |
30 | public: |
31 | (QObject *parent = 0); |
32 | virtual (); |
33 | |
34 | //! Provide a list of actions applying to the given item |
35 | /** |
36 | * Note that this list ist not persistent, hence it should only be used immediately after |
37 | * calling this function (e.g. in a context menu). Optionally one can provide a QObject and a slot |
38 | * (that should take a QAction * as parameter) that is invoked for actions that require external |
39 | * handling. |
40 | * @param index The item index in the NetworkModel |
41 | * @param receiver The optional object that is notified for actions that need to be handled externally. |
42 | * The action type will be stored in the QAction's data(). |
43 | * @param slot The receiving slot name; should be "mySlot" rather than SLOT(mySlot(QAction *)) |
44 | * @return A list of actions applying to the given item |
45 | */ |
46 | void (QMenu *, const QModelIndex &index, QObject *receiver = 0, const char *slot = 0, bool allowBufferHide = false); |
47 | void (QMenu *, const QList<QModelIndex> &indexList, QObject *receiver = 0, const char *slot = 0, bool allowBufferHide = false); |
48 | void (QMenu *, BufferId id, QObject *receiver = 0, const char *slot = 0); |
49 | void (QMenu *, MessageFilter *filter, BufferId msgBuffer, QObject *receiver = 0, const char *slot = 0); |
50 | void (QMenu *, MessageFilter *filter, BufferId msgBuffer, const QString &chanOrNick, QObject *receiver = 0, const char *slot = 0); |
51 | |
52 | private: |
53 | |
54 | void (QMenu *, const QList<QModelIndex> &indexList, MessageFilter *filter, const QString &chanOrNick, |
55 | QObject *receiver, const char *slot, bool allowBufferHide); |
56 | |
57 | Action *(ActionType, QMenu *, bool condition = true); |
58 | Action *(Action *, QMenu *, bool condition = true); |
59 | Action *(ActionType, QMenu *, const QModelIndex &index, ItemActiveStates requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState)); |
60 | Action *(Action *, QMenu *, const QModelIndex &index, ItemActiveStates requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState)); |
61 | |
62 | void (QMenu *, BufferId bufferId); |
63 | void (QMenu *, MessageFilter *msgFilter); |
64 | void (QMenu *, int filter = -1); |
65 | void (QMenu *, const QString &hostmask, const QMap<QString, bool> &ignoreMap); |
66 | |
67 | void (QMenu *, const QModelIndex &); |
68 | void (QMenu *, const QModelIndex &, bool isCustomBufferView = false); |
69 | void (QMenu *, const QModelIndex &); |
70 | |
71 | Action *; |
72 | Action *; |
73 | Action *; |
74 | Action *; |
75 | QList<QAction *> ; |
76 | }; |
77 | |
78 | |
79 | #endif |
80 | |