#include <kglobalaccel.h>
Inherits TQObject.
Public Member Functions | |
KGlobalAccel (TQObject *pParent, const char *psName=0) | |
bool | isEnabled () |
void | setEnabled (bool bEnabled) |
KAccelAction * | insert (const TQString &sAction, const TQString &sLabel, const TQString &sWhatsThis, const KShortcut &cutDef3, const KShortcut &cutDef4, const TQObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true) |
bool | remove (const TQString &sAction) |
KAccelAction * | insert (const TQString &sName, const TQString &sLabel) |
bool | updateConnections () |
const KShortcut & | shortcut (const TQString &sAction) const |
bool | setShortcut (const TQString &sAction, const KShortcut &shortcut) |
bool | setSlot (const TQString &sAction, const TQObject *pObjSlot, const char *psMethodSlot) |
bool | setActionEnabled (const TQString &sAction, bool bEnable) |
TQString | label (const TQString &sAction) const |
const TQString & | configGroup () const |
void | setConfigGroup (const TQString &cg) |
bool | readSettings (KConfigBase *pConfig=0) |
bool | writeSettings (KConfigBase *pConfig=0) const |
bool | writeSettings (KConfigBase *pConfig, bool bGlobal) const |
void | disableBlocking (bool disable) |
void | suspend (bool s) |
Static Public Member Functions | |
static bool | useFourModifierKeys () |
static void | blockShortcuts (bool block) |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Friends | |
class | KGlobalAccelPrivate |
class | KAccelShortcutList |
Detailed Description
KGlobalAccel allows you to have global accelerators that are independent of the focused window.
Unlike KAccel it does not matter which window is currently active.
Configurable global shortcut support
Definition at line 45 of file kglobalaccel.h.
Constructor & Destructor Documentation
◆ KGlobalAccel()
KGlobalAccel::KGlobalAccel | ( | TQObject * | pParent, |
const char * | psName = 0 |
||
) |
Creates a new KGlobalAccel object with the given pParent and psName.
- Parameters
-
pParent the parent of the QObject psName the name of the QObject
Definition at line 39 of file kglobalaccel.cpp.
Member Function Documentation
◆ configGroup()
const TQString & KGlobalAccel::configGroup | ( | ) | const |
Returns the configuration group that is used to save the accelerators.
- Returns
- the configuration group
- See also
- KConfig
Definition at line 116 of file kglobalaccel.cpp.
◆ insert() [1/2]
KAccelAction * KGlobalAccel::insert | ( | const TQString & | sAction, |
const TQString & | sLabel, | ||
const TQString & | sWhatsThis, | ||
const KShortcut & | cutDef3, | ||
const KShortcut & | cutDef4, | ||
const TQObject * | pObjSlot, | ||
const char * | psMethodSlot, | ||
bool | bConfigurable = true , |
||
bool | bEnabled = true |
||
) |
Create an accelerator action.
Usage:
- Parameters
-
sAction The internal name of the action. sLabel An i18n'ized short description of the action displayed when using KKeyChooser to reconfigure the shortcuts. sWhatsThis An extended description of the action. cutDef3 The default 3 modifier scheme shortcut. cutDef4 The default 4 modifier scheme shortcut. pObjSlot Pointer to the slot object. psMethodSlot Pointer to the slot method. bConfigurable Allow the user to change this shortcut if set to 'true'. bEnabled The action will be activated by the shortcut if set to 'true'.
Definition at line 77 of file kglobalaccel.cpp.
◆ insert() [2/2]
KAccelAction * KGlobalAccel::insert | ( | const TQString & | sName, |
const TQString & | sLabel | ||
) |
Use this to insert a label into the action list.
This will be displayed when the user configures shortcuts.
- Parameters
-
sName of the of the action to insert sLabel a user-readable (i18n!) name for the action
- Returns
- the KAccelAction of the action
Definition at line 88 of file kglobalaccel.cpp.
◆ isEnabled()
bool KGlobalAccel::isEnabled | ( | ) |
Checks whether the accelerators are enabled.
- Returns
- true if the KGlobalAccel is enabled
Definition at line 62 of file kglobalaccel.cpp.
◆ label()
TQString KGlobalAccel::label | ( | const TQString & | sAction | ) | const |
Return the label (i18n'ized short description) associated with the action named by sAction
.
- Parameters
-
sAction the name of the action
- Returns
- the label
- Since
- 3.3
Definition at line 106 of file kglobalaccel.cpp.
◆ readSettings()
bool KGlobalAccel::readSettings | ( | KConfigBase * | pConfig = 0 | ) |
Read all shortcuts from pConfig
, or (if pConfig
is zero) from the application's configuration file KGlobal::config().
- Parameters
-
pConfig the configuration file to read from, or 0 for the application configuration file
- Returns
- true if successful, false otherwise
Definition at line 122 of file kglobalaccel.cpp.
◆ remove()
bool KGlobalAccel::remove | ( | const TQString & | sAction | ) |
Removes the accelerator action identified by the name.
Remember to also call updateConnections().
- Parameters
-
sAction the name of the action to remove
- Since
- 3.1
Definition at line 93 of file kglobalaccel.cpp.
◆ setActionEnabled()
bool KGlobalAccel::setActionEnabled | ( | const TQString & | sAction, |
bool | bEnable | ||
) |
◆ setConfigGroup()
void KGlobalAccel::setConfigGroup | ( | const TQString & | cg | ) |
Sets the configuration group that is used to save the accelerators.
- Parameters
-
cg the configuration group
- See also
- KConfig
Definition at line 119 of file kglobalaccel.cpp.
◆ setEnabled()
void KGlobalAccel::setEnabled | ( | bool | bEnabled | ) |
Enables or disables the KGlobalAccel.
- Parameters
-
bEnabled true if the KGlobalAccel should be enabled, false if it should be disabled.
Definition at line 65 of file kglobalaccel.cpp.
◆ setShortcut()
bool KGlobalAccel::setShortcut | ( | const TQString & | sAction, |
const KShortcut & | shortcut | ||
) |
Set the shortcut to be associated with the action named by sAction
.
- Parameters
-
sAction the name of the action shortcut the shortcut for the action
- Returns
- true if successful, false otherwise
Definition at line 102 of file kglobalaccel.cpp.
◆ setSlot()
bool KGlobalAccel::setSlot | ( | const TQString & | sAction, |
const TQObject * | pObjSlot, | ||
const char * | psMethodSlot | ||
) |
Set the slot to be called when the shortcut of the action named by sAction
is pressed.
- Parameters
-
sAction the name of the action pObjSlot the receiver of the signal psMethodSlot the slot to receive the signal
- Returns
- true if successful, false otherwise
Definition at line 104 of file kglobalaccel.cpp.
◆ shortcut()
const KShortcut & KGlobalAccel::shortcut | ( | const TQString & | sAction | ) | const |
Return the shortcut associated with the action named by sAction
.
- Parameters
-
sAction the name of the action
- Returns
- the shortcut. If the action does not exist a null shortcut will be returned.
Definition at line 96 of file kglobalaccel.cpp.
◆ updateConnections()
bool KGlobalAccel::updateConnections | ( | ) |
Updates the connections of the accelerations after changing them.
- Returns
- true if successful, false otherwise
Definition at line 90 of file kglobalaccel.cpp.
◆ writeSettings() [1/2]
bool KGlobalAccel::writeSettings | ( | KConfigBase * | pConfig, |
bool | bGlobal | ||
) | const |
Write the current shortcuts to pConfig
, or (if pConfig
is zero) to the application's configuration file.
Alternatively, if bGlobal is true, then write to kdeglobals.
- Parameters
-
pConfig the configuration file to read from, or 0 for the application configuration file bGlobal if true write the configuration to the kde global settings
- Returns
- true if successful, false otherwise
Definition at line 126 of file kglobalaccel.cpp.
◆ writeSettings() [2/2]
bool KGlobalAccel::writeSettings | ( | KConfigBase * | pConfig = 0 | ) | const |
Write the current shortcuts to pConfig
, or (if pConfig
is zero) to the application's configuration file.
- Parameters
-
pConfig the configuration file to read from, or 0 for the application configuration file
- Returns
- true if successful, false otherwise
- Since
- 3.1
Definition at line 124 of file kglobalaccel.cpp.
The documentation for this class was generated from the following files: