KVIrc
4.9.2
DeveloperAPIs
|
Defines an action inside KVIrc. More...
#include <KviAction.h>
Public Types | |
enum | Flags { NeedsContext = 1, NeedsConnection = 2, WindowConsole = 4, WindowChannel = 8, WindowQuery = 16, WindowDccChat = 32, InternalWindowMask = WindowConsole | WindowChannel | WindowQuery | WindowDccChat, EnableAtLogin = 64, WindowOnlyIfUsersSelected = 128 } |
Holds the flags of an action. More... | |
enum | InternalFlags { Enabled = 1, SetupDone = 2 } |
Holds the internal flags of an action. More... | |
Public Slots | |
virtual void | activate () |
Activates the action. More... | |
Signals | |
void | activated () |
Emitted when the action is being activated. More... | |
Public Member Functions | |
virtual QAction * | addToCustomToolBar (KviCustomToolBar *pParentToolBar) |
Adds the action to the given toolbar. More... | |
virtual bool | addToPopupMenu (QMenu *pMenu) |
Adds the action to the given popup. More... | |
QPixmap * | bigIcon () |
Returns the big icon associated to the action. More... | |
const QString & | bigIconId () const |
Returns the id of the big icon associated to the action. More... | |
KviActionCategory * | category () const |
Returns the category of the action. More... | |
virtual const QString & | description () |
Returns the description of the action. More... | |
unsigned int | flags () |
Returns the flag associated to the action. More... | |
bool | isEnabled () const |
Returns true if the action is enabled. More... | |
virtual bool | isKviUserActionNeverOverrideThis () |
Returns true if the action is user-defined. More... | |
const QString & | keySequence () const |
Returns the shortcut of the action. More... | |
KviAction (QObject *pParent, const QString &szName, const QString &szVisibleName, const QString &szDescription, KviActionCategory *pCategory=NULL, const QString &szBigIconId=QString(), const QString &szSmallIconId=QString(), unsigned int uFlags=0, const QString &szKeySequence=QString()) | |
Constructs the action object. More... | |
KviAction (QObject *pParent, const QString &szName, const QString &szVisibleName, const QString &szDescription, KviActionCategory *pCategory=NULL, const QString &szBigIconId=QString(), KviIconManager::SmallIcon eSmallIcon=KviIconManager::None, unsigned int uFlags=0, const QString &szKeySequence=QString()) | |
Constructs the action object. More... | |
const QString & | name () const |
Returns the name of the action. More... | |
virtual void | setEnabled (bool bEnabled) |
Enables the action. More... | |
QPixmap * | smallIcon () |
Returns the small icon associated to the action. More... | |
const QString & | smallIconId () const |
Returns the id of the small icon associated to the action. More... | |
void | suicide () |
Destroys itself. Maybe the best function in the whole APIs :) More... | |
virtual const QString & | visibleName () |
Returns the visible name of the action. More... | |
virtual | ~KviAction () |
Destroys the action object. More... | |
Static Public Member Functions | |
static int | validateFlags (int iFlagsToValidate) |
Validates the flags of the action. More... | |
Protected Slots | |
virtual void | actionDestroyed () |
Removes the action from the list. More... | |
virtual void | activeContextChanged () |
Enables or disables the action upon checking the active context. More... | |
virtual void | activeContextStateChanged () |
Enables or disables the action upon checking the active context. More... | |
virtual void | activeWindowChanged () |
Enables or disables the action upon checking the active window. More... | |
virtual void | activeWindowSelectionStateChanged (bool bSelectedNow) |
Enables or disables the action upon checking the active window. More... | |
virtual void | reloadImages () |
Reloads the images. More... | |
Protected Member Functions | |
KviPointerList< QAction > * | actionList () |
Returns the list of actions associated to the action. More... | |
void | registerAccelerator () |
Registers the action shortcut in the application. More... | |
void | registerAction (QAction *pAction) |
Adds the action to the list. More... | |
virtual void | setup () |
Enables or disables the action upon starting KVIrc. More... | |
bool | setupDone () const |
Returns true if the setup is finished. More... | |
void | unregisterAccelerator () |
Removes the action shortcut from the application. More... | |
Protected Attributes | |
KviIconManager::SmallIcon | m_eSmallIcon |
QPointer< QShortcut > | m_pAccel |
KviPointerList< QAction > * | m_pActionList |
KviActionCategory * | m_pCategory |
QString | m_szBigIconId |
QString | m_szDescription |
QString | m_szKeySequence |
QString | m_szName |
QString | m_szSmallIconId |
QString | m_szVisibleName |
unsigned int | m_uFlags |
unsigned short int | m_uInternalFlags |
Friends | |
class | KviActionManager |
Defines an action inside KVIrc.
enum KviAction::Flags |
Holds the flags of an action.
KviAction::KviAction | ( | QObject * | pParent, |
const QString & | szName, | ||
const QString & | szVisibleName, | ||
const QString & | szDescription, | ||
KviActionCategory * | pCategory = NULL , |
||
const QString & | szBigIconId = QString() , |
||
const QString & | szSmallIconId = QString() , |
||
unsigned int | uFlags = 0 , |
||
const QString & | szKeySequence = QString() |
||
) |
Constructs the action object.
pParent | The parent object |
It can be 0, but using a QObject will help in deleting this action :)
szName | Internal name of this action, in form [module.]name |
szVisibleName | Permanent visible name, visible at least in the action drawer |
szDescription | What this action does |
pCategory | One of KviActionManager::category*() or 0 (default category), not owned! |
szBigIconId | The big icon associated to the action (32x32) |
szSmallIconId | The small icon associated to the action (16x16) |
uFlags | The flags of the action, like needs and configuration |
szKeySequence | The shortcut to activate the action |
KviAction::KviAction | ( | QObject * | pParent, |
const QString & | szName, | ||
const QString & | szVisibleName, | ||
const QString & | szDescription, | ||
KviActionCategory * | pCategory = NULL , |
||
const QString & | szBigIconId = QString() , |
||
KviIconManager::SmallIcon | eSmallIcon = KviIconManager::None , |
||
unsigned int | uFlags = 0 , |
||
const QString & | szKeySequence = QString() |
||
) |
Constructs the action object.
pParent | The parent object |
It can be 0, but using a QObject will help in deleting this action :)
szName | Internal name of this action, in form [module.]name |
szVisibleName | Permanent visible name, visible at least in the action drawer |
szDescription | What this action does |
pCategory | One of KviActionManager::category*() or 0 (default category), not owned! |
szBigIconId | The big icon associated to the action (32x32) |
eIcon | The small icon associated to the action (16x16) |
uFlags | The flags of the action, like needs and configuration |
szKeySequence | The shortcut to activate the action |
|
virtual |
Destroys the action object.
References actionDestroyed(), KviPointerList< T >::first(), m_pAccel, m_pActionList, KviPointerList< T >::next(), KviPointerList< T >::setAutoDelete(), and unregisterAccelerator().
|
protectedvirtualslot |
Removes the action from the list.
Called when the action is being destroyed
References m_pActionList, and KviPointerList< T >::removeRef().
Referenced by registerAction(), and ~KviAction().
|
inlineprotected |
Returns the list of actions associated to the action.
Referenced by KviConnectAction::activeContextStateChanged(), and KviGoAwayAction::activeContextStateChanged().
|
virtualslot |
Activates the action.
It's called when the user activates the action clicking on the toolbar, the menu or by hitting its shortcut.
Reimplemented in KviKvsAction, and KviConnectAction.
References activated(), and isEnabled().
Referenced by action_kvs_cmd_trigger(), addToCustomToolBar(), addToPopupMenu(), and registerAccelerator().
|
signal |
Emitted when the action is being activated.
Referenced by activate(), and registerAccelerator().
|
protectedvirtualslot |
Enables or disables the action upon checking the active context.
If the context doesn't exist, the action is disabled
Called when the frame changes the active context.
Reimplemented in KviGoAwayAction, KviIrcContextDisplayAction, and KviConnectAction.
References KviMainWindow::activeContext(), activeContextStateChanged(), g_pMainWindow, isEnabled(), m_uFlags, NeedsConnection, and setEnabled().
Referenced by setup().
|
protectedvirtualslot |
Enables or disables the action upon checking the active context.
Called when the frame changes the state of the context
Reimplemented in KviGoAwayAction, KviIrcContextDisplayAction, and KviConnectAction.
References KviMainWindow::activeContext(), KviIrcContext::Connected, KviIrcContext::Connecting, EnableAtLogin, g_pMainWindow, KviIrcContext::Idle, isEnabled(), KviIrcContext::LoggingIn, m_uFlags, setEnabled(), and KviIrcContext::state().
Referenced by activeContextChanged(), and setup().
|
protectedvirtualslot |
Enables or disables the action upon checking the active window.
Called when the frame changes the active window.
References KviMainWindow::activeContext(), KviWindow::Channel, KviIrcContext::Connected, KviWindow::Console, KviWindow::DccChat, EnableAtLogin, g_pActiveWindow, g_pMainWindow, InternalWindowMask, isEnabled(), KviIrcContext::LoggingIn, m_uFlags, NeedsConnection, NeedsContext, KviWindow::Query, setEnabled(), KviIrcContext::state(), KviWindow::type(), WindowChannel, WindowConsole, WindowDccChat, WindowOnlyIfUsersSelected, and WindowQuery.
Referenced by setup().
|
protectedvirtualslot |
Enables or disables the action upon checking the active window.
Called when the frame changes the active window.
References KviWindow::Channel, KviWindow::Console, KviWindow::DccChat, g_pActiveWindow, isEnabled(), m_uFlags, KviWindow::Query, setEnabled(), KviWindow::type(), WindowChannel, WindowConsole, WindowDccChat, and WindowQuery.
Referenced by setup().
|
virtual |
Adds the action to the given toolbar.
pParentToolBar | The toolbar where to add the action |
Reimplemented in KviGoAwayAction, KviIrcContextDisplayAction, KviSubmenuAction, KviSeparatorAction, and KviConnectAction.
References activate(), bigIcon(), connect(), isEnabled(), m_szName, registerAction(), setup(), setupDone(), and visibleName().
Referenced by KviCustomToolBarDescriptor::addAction(), KviCustomToolBar::dragEnterEvent(), and KviCustomToolBarDescriptor::fillToolBar().
|
virtual |
Adds the action to the given popup.
pMenu | The menu where to add the action |
Reimplemented in KviGoAwayAction, KviIrcContextDisplayAction, KviSubmenuAction, KviSeparatorAction, and KviConnectAction.
References activate(), isEnabled(), m_szKeySequence, registerAction(), setup(), setupDone(), smallIcon(), and visibleName().
Referenced by KviIrcToolsAction::popupAboutToShow(), and KviIrcOperationsAction::popupAboutToShow().
QPixmap * KviAction::bigIcon | ( | ) |
Returns the big icon associated to the action.
References g_pIconManager, KviIconManager::getImage(), and m_szBigIconId.
Referenced by KviSubmenuAction::addToCustomToolBar(), addToCustomToolBar(), KviCustomToolBar::eventFilter(), KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem(), KviActionDrawerPageListWidget::mousePressEvent(), and reloadImages().
|
inline |
Returns the id of the big icon associated to the action.
|
inline |
Returns the category of the action.
|
virtual |
Returns the description of the action.
Reimplemented in KviKvsUserAction.
References m_szDescription.
Referenced by KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem().
|
inline |
Returns the flag associated to the action.
|
inline |
Returns true if the action is enabled.
References Enabled.
Referenced by action_kvs_cmd_disable(), action_kvs_cmd_enable(), action_kvs_cmd_trigger(), action_kvs_fnc_isEnabled(), KviKvsAction::activate(), activate(), activeContextChanged(), activeContextStateChanged(), activeWindowChanged(), activeWindowSelectionStateChanged(), KviSubmenuAction::addToCustomToolBar(), addToCustomToolBar(), KviSubmenuAction::addToPopupMenu(), and addToPopupMenu().
|
virtual |
Returns true if the action is user-defined.
Reimplemented in KviKvsUserAction.
Referenced by action_kvs_cmd_create(), action_kvs_cmd_destroy(), KviActionManager::coreActionExists(), CustomizeToolBarsDialog::exportToolBar(), and KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem().
|
inline |
Returns the shortcut of the action.
|
inline |
Returns the name of the action.
Referenced by KviActionManager::actionDestroyed(), KviSubmenuAction::addToCustomToolBar(), KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem(), and KviActionManager::registerAction().
|
protected |
Registers the action shortcut in the application.
References activate(), activated(), connect(), KviMainWindow::freeAccelleratorKeySequence(), g_pMainWindow, m_pAccel, and m_szKeySequence.
Referenced by KviActionManager::registerAction().
|
protected |
Adds the action to the list.
pAction | The action to add |
References actionDestroyed(), KviPointerList< T >::append(), connect(), m_pActionList, and KviPointerList< T >::setAutoDelete().
Referenced by KviConnectAction::addToCustomToolBar(), KviSeparatorAction::addToCustomToolBar(), KviSubmenuAction::addToCustomToolBar(), KviIrcContextDisplayAction::addToCustomToolBar(), KviGoAwayAction::addToCustomToolBar(), addToCustomToolBar(), and addToPopupMenu().
|
protectedvirtualslot |
Reloads the images.
Called when the application wants to refresh the images in the toolbar
Reimplemented in KviGoAwayAction, and KviConnectAction.
References bigIcon(), KviPointerList< T >::first(), KVI_OPTION_BOOL, KviOption_boolShowIconsInPopupMenus, m_pActionList, KviPointerList< T >::next(), and smallIcon().
Referenced by setup().
|
virtual |
Enables the action.
bEnabled | Whether to enable the action |
Reimplemented in KviIrcContextDisplayAction.
References Enabled, KviPointerList< T >::first(), m_pActionList, m_uInternalFlags, and KviPointerList< T >::next().
Referenced by action_kvs_cmd_disable(), action_kvs_cmd_enable(), activeContextChanged(), KviGoAwayAction::activeContextStateChanged(), activeContextStateChanged(), activeWindowChanged(), activeWindowSelectionStateChanged(), and setup().
|
protectedvirtual |
Enables or disables the action upon starting KVIrc.
Reimplemented in KviGoAwayAction, KviIrcContextDisplayAction, KviSubmenuAction, and KviConnectAction.
References KviMainWindow::activeContext(), activeContextChanged(), activeContextStateChanged(), activeWindowChanged(), activeWindowSelectionStateChanged(), connect(), KviIrcContext::Connected, EnableAtLogin, g_pApp, g_pMainWindow, InternalWindowMask, KviIrcContext::LoggingIn, m_uFlags, m_uInternalFlags, NeedsConnection, NeedsContext, reloadImages(), setEnabled(), SetupDone, KviIrcContext::state(), WindowChannel, WindowConsole, WindowOnlyIfUsersSelected, and WindowQuery.
Referenced by KviSeparatorAction::addToCustomToolBar(), addToCustomToolBar(), KviSeparatorAction::addToPopupMenu(), addToPopupMenu(), KviConnectAction::setup(), KviSubmenuAction::setup(), KviIrcContextDisplayAction::setup(), and KviGoAwayAction::setup().
|
inlineprotected |
Returns true if the setup is finished.
References SetupDone.
Referenced by KviConnectAction::addToCustomToolBar(), KviSeparatorAction::addToCustomToolBar(), KviSubmenuAction::addToCustomToolBar(), KviIrcContextDisplayAction::addToCustomToolBar(), KviGoAwayAction::addToCustomToolBar(), addToCustomToolBar(), KviConnectAction::addToPopupMenu(), KviSeparatorAction::addToPopupMenu(), KviSubmenuAction::addToPopupMenu(), KviGoAwayAction::addToPopupMenu(), and addToPopupMenu().
QPixmap * KviAction::smallIcon | ( | ) |
Returns the small icon associated to the action.
References g_pIconManager, KviIconManager::getImage(), KviIconManager::getSmallIcon(), m_eSmallIcon, m_szSmallIconId, and KviIconManager::None.
Referenced by KviSubmenuAction::addToPopupMenu(), addToPopupMenu(), and reloadImages().
|
inline |
Returns the id of the small icon associated to the action.
|
inline |
Destroys itself. Maybe the best function in the whole APIs :)
Referenced by action_kvs_cmd_create(), and action_kvs_cmd_destroy().
|
protected |
Removes the action shortcut from the application.
References m_pAccel.
Referenced by KviActionManager::unregisterAction(), and ~KviAction().
|
static |
Validates the flags of the action.
iFlagsToValidate | The flags to validate |
References EnableAtLogin, InternalWindowMask, NeedsConnection, NeedsContext, and WindowOnlyIfUsersSelected.
Referenced by action_kvs_cmd_create(), SingleActionEditor::commit(), and SingleActionEditor::setActionData().
|
virtual |
Returns the visible name of the action.
Reimplemented in KviKvsUserAction.
References m_szVisibleName.
Referenced by KviSubmenuAction::addToCustomToolBar(), addToCustomToolBar(), KviSubmenuAction::addToPopupMenu(), addToPopupMenu(), and KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem().
|
friend |
|
protected |
Referenced by smallIcon().
|
protected |
Referenced by registerAccelerator(), unregisterAccelerator(), and ~KviAction().
|
protected |
|
protected |
Referenced by KviKvsUserAction::KviKvsUserAction(), and KviKvsUserAction::load().
|
protected |
Referenced by bigIcon(), KviKvsUserAction::exportToKvs(), KviKvsUserAction::load(), and KviKvsUserAction::save().
|
protected |
|
protected |
|
protected |
Referenced by addToCustomToolBar(), KviKvsUserAction::exportToKvs(), KviKvsUserAction::load(), and KviKvsUserAction::save().
|
protected |
Referenced by KviKvsUserAction::exportToKvs(), KviKvsUserAction::load(), KviKvsUserAction::save(), and smallIcon().
|
protected |
|
protected |
|
protected |
Referenced by KviGoAwayAction::activeContextStateChanged(), setEnabled(), and setup().