|
|
The KGlobalAccel class handles global keyboard accelerators, allowing a user to configure key bindings through application configuration files or through the KKeyChooser GUI.
A KGlobalAccel contains a list of accelerator items. Each accelerator item consists of an action name and a keyboard code combined with modifiers (SHIFT, CTRL and ALT.)
For example, "CTRL+SHIFT+M" could be a shortcut for popping-up a menu of monitor setting choices anywhere on the desktop. The key codes are listed in ckey.h. "Monitor settings" could be the action name for this accelerator. The action name indentifies the key binding in configuration files and the KKeyChooser GUI.
When pressed,an accelerator key calls the slot to which it has been connected. Accelerator items can be connected so that a key will activate two different slots.
Key binding configuration during run time can be prevented by specifying that an accelerator item is not configurable when it is inserted.
It is possible for a user to choose to have no key associated with an action.
The translated first argument for insertItem is only used in the configuration dialog.
...
ga = new KGlobalAccel(); ga->insertItem( i18n("Monitor settings"), "Monitor settings", "CTRL+SHIFT+M" ); ga->connectItem( "Monitor settings", myObject, SLOT( popupMenu() ) );
ga->readSettings();
|
Creates a KGlobalAccel object.
|
Creates a KGlobalAccel object with a parent and a name. The parent has the only effect that the KGlobalAccel object will be automatically destroyed in the parent's destructor, thus releaseing the keys.
~ |
Destroys the accelerator object.and ungrabs any allocated key bindings.
void |
Removes all accelerator items.
void |
Connect an accelerator item to a slot/signal in another object.
Arguments:
Parameters:
action | is the accelerator item action name. |
receiver | is the object to receive a signal |
member | is a slot or signal in the receiver |
activate | indicates whether the accelrator item should be enabled immediately |
uint |
[const]
Returns the number of accelerator items.
int |
[const]
Returns the key code of the accelerator item with the action name action, or zero if either the action name cannot be found or the current key is set to no key.
int |
[const]
Returns the default key code of the accelerator item with the action name action, or zero if the action name cannot be found.
void |
Disconnects an accelerator item from a function in another object.
QString |
[const]
Returns that identifier of the accelerator item with the keycode key, or zero if the item cannot be found.
bool |
Attempts to make a passive X server grab of the key specified by key symbol keysym and modifier mod. Returns false if unsuccessful.
Modifications with num lock and caps lock are also grabbed.
bool |
Inserts an accelerator item and returns false if the key code defaultKeyCode is not valid.
Arguments:
If an action already exists the old association and connections will be removed..
Parameters:
action | is the accelerator item action name. |
defaultKeyCode | is a key code to be used as the default for the action. |
configurable | indicates whether a user can configure the key binding using the KKeyChooser GUI and whether the key will be written back to configuration files on calling writeSettings. |
bool |
Inserts an accelerator item and returns false if the key code defaultKeyCode is not valid.
Arguments:
If an action already exists the old association and connections will be removed..
Parameters:
action | is the accelerator item action name. |
defaultKeyCode | is a key plus a combination of SHIFT, CTRL and ALT to be used as the default for the action. |
configurable | indicates whether a user can configure the key binding using the KKeyChooser GUI and whether the key will be written back to configuration files on calling writeSettings. |
bool |
[const]
bool |
[const]
KKeyEntryMap |
[const]
Returns the dictionary of accelerator action names and KKeyEntry objects. Note that only a shallow copy is returned so that items will be lost when the KKeyEntry objects are deleted.
void |
Reads all key associations from the application's configuration files.
void |
Removes the accelerator item with the action name action.
void |
QString |
[const]
void |
Enables the accelerator if activate is true, or disables it if activate is false...
Individual keys can also be enabled or disabled.
void |
Enables or disables an accelerator item.
Arguments:
Parameters:
action | is the accelerator item action name. |
activate | specifies whether the item should be enabled or disabled. |
bool |
Sets the dictionary of accelerator action names and KKeyEntry objects to nKeyMap. Note that only a shallow copy is made so that items will be lost when the KKeyEntry objects are deleted.
bool |
Ungrabs the key specified by key symbol keysym and modifier mod. Returns false if unsuccessful.
Modifications with num lock and caps lock are also ungrabbed.
void |
[const]
Writes the current configurable associations to the application's configuration files
bool |
Filters X11 events ev for key bindings in the accelerator dictionary. If a match is found the activated activated is emitted and the function returns true. Return false if the event is not processed.
This is public for compatibility only. You do not need to call it.
void |
[signal]
int |
[protected]
KKeyEntryMap |
[protected]
bool |
[protected]
QString |
[protected]
bool |
[protected]
KGlobalAccelPrivate* |
[protected]
Generated by: prospector@porky.devel.redhat.com on Thu Aug 24 05:35:47 2000, using kdoc 2.0a36. |