Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ContextMenuActionProvider Class Reference

#include </tmp/quassel/src/uisupport/contextmenuactionprovider.h>

Inheritance diagram for ContextMenuActionProvider:
Collaboration diagram for ContextMenuActionProvider:

Public Types

enum  ActionType {
  NetworkMask = 0x0f, NetworkConnect = 0x01, NetworkDisconnect = 0x02, NetworkConnectAll = 0x03,
  NetworkDisconnectAll = 0x04, BufferMask = 0xf0, BufferJoin = 0x10, BufferPart = 0x20,
  BufferSwitchTo = 0x30, BufferRemove = 0x40, HideMask = 0x0f00, HideJoin = 0x0100,
  HidePart = 0x0200, HideQuit = 0x0300, HideNick = 0x0400, HideMode = 0x0500,
  HideDayChange = 0x0600, HideTopic = 0x0700, HideJoinPartQuit = 0xd00, HideUseDefaults = 0xe00,
  HideApplyToAll = 0xf00, GeneralMask = 0xf000, JoinChannel = 0x1000, ShowChannelList = 0x2000,
  ShowIgnoreList = 0x3000, NickMask = 0xff0000, NickWhois = 0x010000, NickQuery = 0x020000,
  NickSwitchTo = 0x030000, NickCtcpVersion = 0x040000, NickCtcpPing = 0x050000, NickCtcpTime = 0x060000,
  NickCtcpClientinfo = 0x070000, NickOp = 0x080000, NickDeop = 0x090000, NickVoice = 0x0a0000,
  NickDevoice = 0x0b0000, NickHalfop = 0x0c0000, NickDehalfop = 0x0d0000, NickKick = 0x0e0000,
  NickBan = 0x0f0000, NickKickBan = 0x100000, NickIgnoreUser = 0x200000, NickIgnoreHost = 0x300000,
  NickIgnoreDomain = 0x400000, NickIgnoreCustom = 0x500000, NickIgnoreToggleEnabled0 = 0x600000, NickIgnoreToggleEnabled1 = 0x700000,
  NickIgnoreToggleEnabled2 = 0x800000, NickIgnoreToggleEnabled3 = 0x900000, NickIgnoreToggleEnabled4 = 0xa00000, ExternalMask = 0xff000000,
  HideBufferTemporarily = 0x01000000, HideBufferPermanently = 0x02000000
}
enum  ItemActiveState { InactiveState = 0x01, ActiveState = 0x02 }

Signals

void showChannelList (NetworkId)
void showIgnoreList (QString)

Public Member Functions

 ContextMenuActionProvider (QObject *parent=0)
virtual ~ContextMenuActionProvider ()
void addActions (QMenu *, const QModelIndex &index, QObject *receiver=0, const char *slot=0, bool allowBufferHide=false)
 Provide a list of actions applying to the given item.
void addActions (QMenu *, const QList< QModelIndex > &indexList, QObject *receiver=0, const char *slot=0, bool allowBufferHide=false)
void addActions (QMenu *, BufferId id, QObject *receiver=0, const char *slot=0)
void addActions (QMenu *, MessageFilter *filter, BufferId msgBuffer, QObject *receiver=0, const char *slot=0)
void addActions (QMenu *, MessageFilter *filter, BufferId msgBuffer, const QString &chanOrNick, QObject *receiver=0, const char *slot=0)
Actionaction (ActionType type) const
 Q_DECLARE_FLAGS (ItemActiveStates, ItemActiveState) public slots
virtual void disconnectedFromCore ()

Protected Slots

virtual void actionTriggered (QAction *)

Protected Member Functions

ActionCollectionactionCollection () const
QList< QModelIndex > indexList () const
MessageFiltermessageFilter () const
QString contextItem () const
 Channel name or nick to provide context menu for.
QObject * receiver () const
const char * method () const
void setIndexList (const QModelIndex &)
void setIndexList (const QList< QModelIndex > &)
void setMessageFilter (MessageFilter *)
void setContextItem (const QString &)
void setSlot (QObject *receiver, const char *method)
ActionregisterAction (ActionType type, const QString &text, bool checkable=false)
ActionregisterAction (NetworkModelController::ActionType type, const QIcon &icon, const QString &text, bool checkable=false)
bool checkRequirements (const QModelIndex &index, ItemActiveStates requiredActiveState=QFlags< ItemActiveState >(ActiveState|InactiveState))
QString nickName (const QModelIndex &index) const
BufferId findQueryBuffer (const QModelIndex &index, const QString &predefinedNick=QString()) const
BufferId findQueryBuffer (NetworkId, const QString &nickName) const
void removeBuffers (const QModelIndexList &indexList)
virtual void handleNetworkAction (ActionType, QAction *)
virtual void handleBufferAction (ActionType, QAction *)
virtual void handleHideAction (ActionType, QAction *)
virtual void handleNickAction (ActionType, QAction *action)
virtual void handleGeneralAction (ActionType, QAction *)
virtual void handleExternalAction (ActionType, QAction *)

Private Member Functions

void addActions (QMenu *, const QList< QModelIndex > &indexList, MessageFilter *filter, const QString &chanOrNick, QObject *receiver, const char *slot, bool allowBufferHide)
ActionaddAction (ActionType, QMenu *, bool condition=true)
ActionaddAction (Action *, QMenu *, bool condition=true)
ActionaddAction (ActionType, QMenu *, const QModelIndex &index, ItemActiveStates requiredActiveState=QFlags< ItemActiveState >(ActiveState|InactiveState))
ActionaddAction (Action *, QMenu *, const QModelIndex &index, ItemActiveStates requiredActiveState=QFlags< ItemActiveState >(ActiveState|InactiveState))
void addHideEventsMenu (QMenu *, BufferId bufferId)
void addHideEventsMenu (QMenu *, MessageFilter *msgFilter)
void addHideEventsMenu (QMenu *, int filter=-1)
void addIgnoreMenu (QMenu *menu, const QString &hostmask, const QMap< QString, bool > &ignoreMap)
void addNetworkItemActions (QMenu *, const QModelIndex &)
void addBufferItemActions (QMenu *, const QModelIndex &, bool isCustomBufferView=false)
void addIrcUserActions (QMenu *, const QModelIndex &)

Private Attributes

Action_hideEventsMenuAction
Action_nickCtcpMenuAction
Action_nickModeMenuAction
Action_nickIgnoreMenuAction
QList< QAction * > _ignoreDescriptions

Detailed Description

Definition at line 26 of file contextmenuactionprovider.h.

Member Enumeration Documentation

enum ActionType
inherited
Enumerator:
NetworkMask 
NetworkConnect 
NetworkDisconnect 
NetworkConnectAll 
NetworkDisconnectAll 
BufferMask 
BufferJoin 
BufferPart 
BufferSwitchTo 
BufferRemove 
HideMask 
HideJoin 
HidePart 
HideQuit 
HideNick 
HideMode 
HideDayChange 
HideTopic 
HideJoinPartQuit 
HideUseDefaults 
HideApplyToAll 
GeneralMask 
JoinChannel 
ShowChannelList 
ShowIgnoreList 
NickMask 
NickWhois 
NickQuery 
NickSwitchTo 
NickCtcpVersion 
NickCtcpPing 
NickCtcpTime 
NickCtcpClientinfo 
NickOp 
NickDeop 
NickVoice 
NickDevoice 
NickHalfop 
NickDehalfop 
NickKick 
NickBan 
NickKickBan 
NickIgnoreUser 
NickIgnoreHost 
NickIgnoreDomain 
NickIgnoreCustom 
NickIgnoreToggleEnabled0 
NickIgnoreToggleEnabled1 
NickIgnoreToggleEnabled2 
NickIgnoreToggleEnabled3 
NickIgnoreToggleEnabled4 
ExternalMask 
HideBufferTemporarily 
HideBufferPermanently 

Definition at line 43 of file networkmodelcontroller.h.

enum ItemActiveState
inherited
Enumerator:
InactiveState 
ActiveState 

Definition at line 117 of file networkmodelcontroller.h.

Constructor & Destructor Documentation

ContextMenuActionProvider ( QObject *  parent = 0)

Definition at line 37 of file contextmenuactionprovider.cpp.

References _hideEventsMenuAction, _ignoreDescriptions, _nickCtcpMenuAction, _nickIgnoreMenuAction, _nickModeMenuAction, NetworkModelController::action(), NetworkModelController::BufferJoin, NetworkModelController::BufferPart, NetworkModelController::BufferRemove, NetworkModelController::BufferSwitchTo, NetworkModelController::HideApplyToAll, NetworkModelController::HideBufferPermanently, NetworkModelController::HideBufferTemporarily, NetworkModelController::HideDayChange, NetworkModelController::HideJoin, NetworkModelController::HideJoinPartQuit, NetworkModelController::HideMode, NetworkModelController::HideNick, NetworkModelController::HidePart, NetworkModelController::HideQuit, NetworkModelController::HideTopic, NetworkModelController::HideUseDefaults, NetworkModelController::JoinChannel, NetworkModelController::NetworkConnect, NetworkModelController::NetworkDisconnect, NetworkModelController::NickBan, NetworkModelController::NickCtcpClientinfo, NetworkModelController::NickCtcpPing, NetworkModelController::NickCtcpTime, NetworkModelController::NickCtcpVersion, NetworkModelController::NickDehalfop, NetworkModelController::NickDeop, NetworkModelController::NickDevoice, NetworkModelController::NickHalfop, NetworkModelController::NickIgnoreCustom, NetworkModelController::NickIgnoreDomain, NetworkModelController::NickIgnoreHost, NetworkModelController::NickIgnoreToggleEnabled0, NetworkModelController::NickIgnoreToggleEnabled1, NetworkModelController::NickIgnoreToggleEnabled2, NetworkModelController::NickIgnoreToggleEnabled3, NetworkModelController::NickIgnoreToggleEnabled4, NetworkModelController::NickIgnoreUser, NetworkModelController::NickKick, NetworkModelController::NickKickBan, NetworkModelController::NickOp, NetworkModelController::NickQuery, NetworkModelController::NickSwitchTo, NetworkModelController::NickVoice, NetworkModelController::NickWhois, NetworkModelController::registerAction(), NetworkModelController::ShowChannelList, and NetworkModelController::ShowIgnoreList.

Member Function Documentation

void addActions ( QMenu *  menu,
const QModelIndex &  index,
QObject *  receiver = 0,
const char *  slot = 0,
bool  allowBufferHide = false 
)

Provide a list of actions applying to the given item.

Note that this list ist not persistent, hence it should only be used immediately after calling this function (e.g. in a context menu). Optionally one can provide a QObject and a slot (that should take a QAction * as parameter) that is invoked for actions that require external handling.

Parameters
indexThe item index in the NetworkModel
receiverThe optional object that is notified for actions that need to be handled externally. The action type will be stored in the QAction's data().
slotThe receiving slot name; should be "mySlot" rather than SLOT(mySlot(QAction *))
Returns
A list of actions applying to the given item

Definition at line 170 of file contextmenuactionprovider.cpp.

Referenced by addActions(), BufferView::addActionsToMenu(), ChatItem::addActionsToMenu(), ContentsChatItem::addActionsToMenu(), ChatScene::contextMenuEvent(), and NickView::showContextMenu().

void addActions ( QMenu *  menu,
const QList< QModelIndex > &  indexList,
QObject *  receiver = 0,
const char *  slot = 0,
bool  allowBufferHide = false 
)

Definition at line 192 of file contextmenuactionprovider.cpp.

References addActions().

void addActions ( QMenu *  menu,
BufferId  id,
QObject *  receiver = 0,
const char *  slot = 0 
)
void addActions ( QMenu *  menu,
MessageFilter filter,
BufferId  msgBuffer,
QObject *  receiver = 0,
const char *  slot = 0 
)

Definition at line 178 of file contextmenuactionprovider.cpp.

References addActions().

void addActions ( QMenu *  menu,
MessageFilter filter,
BufferId  msgBuffer,
const QString &  chanOrNick,
QObject *  receiver = 0,
const char *  slot = 0 
)

Definition at line 184 of file contextmenuactionprovider.cpp.

References addActions(), and Client::networkModel().

Action * addAction ( ActionType  type,
QMenu *  menu,
bool  condition = true 
)
private
Action * addAction ( Action action,
QMenu *  menu,
bool  condition = true 
)
private

Definition at line 401 of file contextmenuactionprovider.cpp.

References NetworkModelController::action().

Action * addAction ( ActionType  type,
QMenu *  menu,
const QModelIndex &  index,
ItemActiveStates  requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState) 
)
private
Action * addAction ( Action action,
QMenu *  menu,
const QModelIndex &  index,
ItemActiveStates  requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState) 
)
private
void addHideEventsMenu ( QMenu *  menu,
BufferId  bufferId 
)
private
void addHideEventsMenu ( QMenu *  menu,
MessageFilter msgFilter 
)
private
Q_DECLARE_FLAGS ( ItemActiveStates  ,
ItemActiveState   
)
inlineinherited

Definition at line 121 of file networkmodelcontroller.h.

virtual void disconnectedFromCore ( )
inlinevirtualinherited

Definition at line 125 of file networkmodelcontroller.h.

Referenced by GraphicalUi::disconnectedFromCore().

ActionCollection * actionCollection ( ) const
inlineprotectedinherited
MessageFilter * messageFilter ( ) const
inlineprotectedinherited
QString contextItem ( ) const
inlineprotectedinherited

Channel name or nick to provide context menu for.

Definition at line 209 of file networkmodelcontroller.h.

References NetworkModelController::_contextItem.

Referenced by addActions(), addIrcUserActions(), NetworkModelController::handleGeneralAction(), and NetworkModelController::setContextItem().

QObject * receiver ( ) const
inlineprotectedinherited
const char * method ( ) const
inlineprotectedinherited
void setIndexList ( const QList< QModelIndex > &  list)
protectedinherited

Definition at line 87 of file networkmodelcontroller.cpp.

References NetworkModelController::_indexList.

void setMessageFilter ( MessageFilter filter)
protectedinherited
void setContextItem ( const QString &  contextItem)
protectedinherited
void setSlot ( QObject *  receiver,
const char *  method 
)
protectedinherited
Action * registerAction ( ActionType  type,
const QString &  text,
bool  checkable = false 
)
protectedinherited
Action * registerAction ( NetworkModelController::ActionType  type,
const QIcon &  icon,
const QString &  text,
bool  checkable = false 
)
protectedinherited
bool checkRequirements ( const QModelIndex &  index,
ItemActiveStates  requiredActiveState = QFlags<ItemActiveState>(ActiveState | InactiveState) 
)
protectedinherited
BufferId findQueryBuffer ( const QModelIndex &  index,
const QString &  predefinedNick = QString() 
) const
protectedinherited
BufferId findQueryBuffer ( NetworkId  networkId,
const QString &  nickName 
) const
protectedinherited

Definition at line 158 of file networkmodelcontroller.cpp.

References NetworkModel::bufferId(), and Client::networkModel().

void showChannelList ( NetworkId  )
signalinherited
void showIgnoreList ( QString  )
signalinherited
void handleNickAction ( ActionType  type,
QAction *  action 
)
protectedvirtualinherited

Reimplemented in ToolBarActionProvider.

Definition at line 422 of file networkmodelcontroller.cpp.

References NetworkModel::BufferInfoRole, Client::bufferModel(), Client::ignoreListManager(), NetworkModelController::indexList(), NetworkModel::IrcUserRole, SignedId::isValid(), BufferInfo::isValid(), IrcUser::network(), NetworkModel::NetworkIdRole, Network::networkName(), IgnoreListManager::NetworkScope, NetworkModelController::NickBan, NetworkModelController::NickCtcpClientinfo, NetworkModelController::NickCtcpPing, NetworkModelController::NickCtcpTime, NetworkModelController::NickCtcpVersion, NetworkModelController::NickDehalfop, NetworkModelController::NickDeop, NetworkModelController::NickDevoice, NetworkModelController::NickHalfop, NetworkModelController::NickIgnoreCustom, NetworkModelController::NickIgnoreDomain, NetworkModelController::NickIgnoreHost, NetworkModelController::NickIgnoreToggleEnabled0, NetworkModelController::NickIgnoreToggleEnabled1, NetworkModelController::NickIgnoreToggleEnabled2, NetworkModelController::NickIgnoreToggleEnabled3, NetworkModelController::NickIgnoreToggleEnabled4, NetworkModelController::NickIgnoreUser, NetworkModelController::NickKick, NetworkModelController::NickKickBan, NetworkModelController::nickName(), NetworkModelController::NickOp, NetworkModelController::NickQuery, NetworkModelController::NickSwitchTo, NetworkModelController::NickVoice, NetworkModelController::NickWhois, IgnoreListManager::requestAddIgnoreListItem(), IgnoreListManager::requestToggleIgnoreRule(), IgnoreListManager::SenderIgnore, NetworkModelController::showIgnoreList(), IgnoreListManager::SoftStrictness, BufferModel::switchToOrStartQuery(), and Client::userInput().

Referenced by NetworkModelController::actionTriggered().

void handleExternalAction ( ActionType  type,
QAction *  action 
)
protectedvirtualinherited

Member Data Documentation

Action* _hideEventsMenuAction
private
Action* _nickCtcpMenuAction
private
Action* _nickModeMenuAction
private
Action* _nickIgnoreMenuAction
private
QList<QAction *> _ignoreDescriptions
private

The documentation for this class was generated from the following files: