| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KGlobalAccel Class Reference

KGlobalAccel allows you to have global accelerators that are independent of the focused window. Configurable global shortcut support. More...

`#include <kglobalaccel.h>`

Inheritance diagram for KGlobalAccel:

[legend]
Collaboration diagram for KGlobalAccel:

[legend]
List of all members.

## Public Member Functions
| KGlobalAccel (QObject *pParent, const char *psName=0)
| Creates a new KGlobalAccel object with the given pParent and psName.
bool | isEnabled ()
| Checks whether the accelerators are enabled.
void | setEnabled (bool bEnabled)
| Checks whether the accelerators are enabled.
KAccelAction * | insert (const QString &sAction, const QString &sLabel, const QString &sWhatsThis, const KShortcut &cutDef3, const KShortcut &cutDef4, const QObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)
| Create an accelerator action.
bool | remove (const QString &sAction)
| Removes the accelerator action identified by the name.
KAccelAction * | insert (const QString &sName, const QString &sLabel)
| Use this to insert a label into the action list.
bool | updateConnections ()
| Updates the connections of the accelerations after changing them.
const KShortcut & | shortcut (const QString &sAction) const
| Set the shortcut to be associated with the action named by `sAction`.
bool | setShortcut (const QString &sAction, const KShortcut &shortcut)
| Set the shortcut to be associated with the action named by `sAction`.
bool | setSlot (const QString &sAction, const QObject *pObjSlot, const char *psMethodSlot)
| Set the slot to be called when the shortcut of the action named by `sAction` is pressed.
bool | setEnabled (const QString &sAction, bool bEnabled)
| Enable or disable the action named by `sAction`.
const QString & | configGroup () const
| Returns the configuration group that is used to save the accelerators.
void | setConfigGroup (const QString &cg)
| Sets the configuration group that is used to save the accelerators.
bool | readSettings (KConfigBase *pConfig=0)
| Read all shortcuts from `pConfig`, or (if `pConfig` is zero) from the application's configuration file KGlobal::config().
bool | writeSettings (KConfigBase *pConfig=0) const
| Write the current shortcuts to `pConfig`, or (if `pConfig` is zero) to the application's configuration file.
bool | writeSettings (KConfigBase *pConfig, bool bGlobal) const
| Write the current shortcuts to `pConfig`, or (if `pConfig` is zero) to the application's configuration file.
## Static Public Member Functions
bool | useFourModifierKeys ()
## 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. Configurable global shortcut support.

Unlike KAccel it does not matter which window is currently active.

See also:
  KAccel

  KAccelShortcutList

  KKeyChooser

  KKeyDialog

Definition at line 45 of file kglobalaccel.h.

## Constructor & Destructor Documentation

KGlobalAccel::KGlobalAccel | ( | QObject * | 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 16 of file kglobalaccel.cpp.

## Member Function Documentation

bool KGlobalAccel::isEnabled | ( |  | ) |

| Checks whether the accelerators are enabled. Returns: true if the KGlobalAccel is enabled Definition at line 39 of file kglobalaccel.cpp.

void KGlobalAccel::setEnabled | ( | bool | bEnabled | ) |

| Checks whether the accelerators are enabled. Returns: true if the KGlobalAccel is enabled Definition at line 42 of file kglobalaccel.cpp.

KAccelAction * KGlobalAccel::insert | ( | const QString & | sAction,
|  | const QString & | sLabel,
|  | const QString & | sWhatsThis,
|  | const KShortcut & | cutDef3,
|  | const KShortcut & | cutDef4,
|  | const QObject * | pObjSlot,
|  | const char * | psMethodSlot,
|  | bool | bConfigurable = true,
|  | bool | bEnabled = true
| ) |

| Create an accelerator action. Usage:
     insert( "Do Something", i18n("Do Something"),
       i18n("This action allows you to do something really great with this program to "
            "the currently open document."),
       ALT+CTRL+Key_Q, KKey::QtWIN+CTRL+Key_Q, this, SLOT(slotDoSomething()) );
    	 *

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 45 of file kglobalaccel.cpp.

bool KGlobalAccel::remove | ( | const QString & | 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 61 of file kglobalaccel.cpp.

KAccelAction * KGlobalAccel::insert | ( | const QString & | sName,
|  | const QString & | 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 56 of file kglobalaccel.cpp.

bool KGlobalAccel::updateConnections | ( |  | ) |

| Updates the connections of the accelerations after changing them. Returns: true if successful, false otherwise Definition at line 58 of file kglobalaccel.cpp.

const KShortcut & KGlobalAccel::shortcut | ( | const QString & | sAction | ) | const

  | Set the shortcut to be 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 64 of file kglobalaccel.cpp.

bool KGlobalAccel::setShortcut | ( | const QString & | 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 70 of file kglobalaccel.cpp. References KStdAction::cut().

bool KGlobalAccel::setSlot | ( | const QString & | sAction,
|  | const QObject * | 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 72 of file kglobalaccel.cpp.

bool KGlobalAccel::setEnabled | ( | const QString & | sAction,
|  | bool | bEnabled
| ) |

  | Enable or disable the action named by `sAction`. Parameters:
  sAction | the name of the action
  bEnabled | true to enable, false to disable
Returns: true if successful, false otherwise

const QString & KGlobalAccel::configGroup | ( |  | ) | const

| Returns the configuration group that is used to save the accelerators. Returns: the configuration group See also: KConfig Definition at line 75 of file kglobalaccel.cpp.

void KGlobalAccel::setConfigGroup | ( | const QString & | cg | ) |

  | Sets the configuration group that is used to save the accelerators. Parameters:
  cg | the configuration group
See also: KConfig Definition at line 78 of file kglobalaccel.cpp.

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 81 of file kglobalaccel.cpp.

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 83 of file kglobalaccel.cpp.

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 85 of file kglobalaccel.cpp.

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

- kglobalaccel.h
- kglobalaccel.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:49:05 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001