PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/quassel-0.7.3/src/uisupport/contextmenuactionprovider.h

#
C Header | 77 lines | 34 code | 12 blank | 31 comment | 0 complexity | 6c2e7aca2040ba8637bc87647c2a76d9 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. /***************************************************************************
  2. * Copyright (C) 2005-09 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. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef CONTEXTMENUACTIONPROVIDER_H
  21. #define CONTEXTMENUACTIONPROVIDER_H
  22. #include "networkmodelcontroller.h"
  23. class ContextMenuActionProvider : public NetworkModelController {
  24. Q_OBJECT
  25. public:
  26. ContextMenuActionProvider(QObject *parent = 0);
  27. virtual ~ContextMenuActionProvider();
  28. //! Provide a list of actions applying to the given item
  29. /**
  30. * Note that this list ist not persistent, hence it should only be used immediately after
  31. * calling this function (e.g. in a context menu). Optionally one can provide a QObject and a slot
  32. * (that should take a QAction * as parameter) that is invoked for actions that require external
  33. * handling.
  34. * @param index The item index in the NetworkModel
  35. * @param receiver The optional object that is notified for actions that need to be handled externally.
  36. * The action type will be stored in the QAction's data().
  37. * @param slot The receiving slot name; should be "mySlot" rather than SLOT(mySlot(QAction *))
  38. * @return A list of actions applying to the given item
  39. */
  40. void addActions(QMenu *, const QModelIndex &index, QObject *receiver = 0, const char *slot = 0, bool allowBufferHide = false);
  41. void addActions(QMenu *, const QList<QModelIndex> &indexList, QObject *receiver = 0, const char *slot = 0, bool allowBufferHide = false);
  42. void addActions(QMenu *, BufferId id, QObject *receiver = 0, const char *slot = 0);
  43. void addActions(QMenu *, MessageFilter *filter, BufferId msgBuffer, QObject *receiver = 0, const char *slot = 0);
  44. void addActions(QMenu *, MessageFilter *filter, BufferId msgBuffer, const QString &chanOrNick, QObject *receiver = 0, const char *slot = 0);
  45. private:
  46. void addActions(QMenu *, const QList<QModelIndex> &indexList, MessageFilter *filter, const QString &chanOrNick,
  47. QObject *receiver, const char *slot, bool allowBufferHide);
  48. Action * addAction(ActionType, QMenu *, bool condition = true);
  49. Action * addAction(Action * , QMenu *, bool condition = true);
  50. Action * addAction(ActionType, QMenu *, const QModelIndex &index, ItemActiveStates requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState));
  51. Action * addAction(Action * , QMenu *, const QModelIndex &index, ItemActiveStates requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState));
  52. void addHideEventsMenu(QMenu *, BufferId bufferId);
  53. void addHideEventsMenu(QMenu *, MessageFilter *msgFilter);
  54. void addHideEventsMenu(QMenu *, int filter = -1);
  55. void addIgnoreMenu(QMenu *menu, const QString &hostmask, const QMap<QString, bool> &ignoreMap);
  56. void addNetworkItemActions(QMenu *, const QModelIndex &);
  57. void addBufferItemActions(QMenu *, const QModelIndex &, bool isCustomBufferView = false);
  58. void addIrcUserActions(QMenu *, const QModelIndex &);
  59. Action *_hideEventsMenuAction;
  60. Action *_nickCtcpMenuAction;
  61. Action *_nickModeMenuAction;
  62. Action *_nickIgnoreMenuAction;
  63. QList<QAction *> _ignoreDescriptions;
  64. };
  65. #endif