.TH "KAccel" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KAccel \- Handle shortcuts. Configurable shortcut support for widgets.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kaccel.h>\fP
.PP
Inherits \fBQAccel\fP.
.PP
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBkeycodeChanged\fP ()"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKAccel\fP (\fBQWidget\fP *pParent, const char *psName=0)"
.br
.ti -1c
.RI "\fBKAccel\fP (\fBQWidget\fP *watch, \fBQObject\fP *parent, const char *psName=0)"
.br
.ti -1c
.RI "KAccelActions & \fBactions\fP ()"
.br
.ti -1c
.RI "const KAccelActions & \fBactions\fP () const "
.br
.ti -1c
.RI "bool \fBisEnabled\fP ()"
.br
.ti -1c
.RI "void \fBsetEnabled\fP (bool bEnabled)"
.br
.ti -1c
.RI "bool \fBsetAutoUpdate\fP (bool bAuto)"
.br
.ti -1c
.RI "KAccelAction * \fBinsert\fP (const \fBQString\fP &sAction, const \fBQString\fP &sLabel, const \fBQString\fP &sWhatsThis, const \fBKShortcut\fP &cutDef, const \fBQObject\fP *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)"
.br
.ti -1c
.RI "KAccelAction * \fBinsert\fP (const \fBQString\fP &sAction, const \fBQString\fP &sLabel, const \fBQString\fP &sWhatsThis, const \fBKShortcut\fP &cutDef3, const \fBKShortcut\fP &cutDef4, const \fBQObject\fP *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)"
.br
.ti -1c
.RI "KAccelAction * \fBinsert\fP (const char *psAction, const \fBKShortcut\fP &cutDef, const \fBQObject\fP *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)"
.br
.ti -1c
.RI "KAccelAction * \fBinsert\fP (\fBKStdAccel::StdAccel\fP id, const \fBQObject\fP *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)"
.br
.ti -1c
.RI "bool \fBremove\fP (const \fBQString\fP &sAction)"
.br
.ti -1c
.RI "bool \fBupdateConnections\fP ()"
.br
.ti -1c
.RI "const \fBKShortcut\fP & \fBshortcut\fP (const \fBQString\fP &sAction) const "
.br
.ti -1c
.RI "bool \fBsetShortcut\fP (const \fBQString\fP &sAction, const \fBKShortcut\fP &shortcut)"
.br
.ti -1c
.RI "bool \fBsetSlot\fP (const \fBQString\fP &sAction, const \fBQObject\fP *pObjSlot, const char *psMethodSlot)"
.br
.ti -1c
.RI "bool \fBsetEnabled\fP (const \fBQString\fP &sAction, bool bEnabled)"
.br
.ti -1c
.RI "const \fBQString\fP & \fBconfigGroup\fP () const "
.br
.ti -1c
.RI "void \fBsetConfigGroup\fP (const \fBQString\fP &name)"
.br
.ti -1c
.RI "bool \fBreadSettings\fP (\fBKConfigBase\fP *pConfig=0)"
.br
.ti -1c
.RI "bool \fBwriteSettings\fP (\fBKConfigBase\fP *pConfig=0) const "
.br
.ti -1c
.RI "void \fBemitKeycodeChanged\fP ()"
.br
.ti -1c
.RI "bool \fBinsertItem\fP (const \fBQString\fP &sLabel, const \fBQString\fP &sAction, const char *psKey, int nIDMenu=0, \fBQPopupMenu\fP *pMenu=0, bool bConfigurable=true) KDE_DEPRECATED"
.br
.ti -1c
.RI "bool \fBinsertItem\fP (const \fBQString\fP &sLabel, const \fBQString\fP &sAction, int \fBkey\fP, int nIDMenu=0, \fBQPopupMenu\fP *pMenu=0, bool bConfigurable=true) KDE_DEPRECATED"
.br
.ti -1c
.RI "bool \fBinsertStdItem\fP (\fBKStdAccel::StdAccel\fP id, const \fBQString\fP &descr=QString::null) KDE_DEPRECATED"
.br
.ti -1c
.RI "bool \fBconnectItem\fP (const \fBQString\fP &sAction, const \fBQObject\fP *pObjSlot, const char *psMethodSlot, bool bActivate=true) KDE_DEPRECATED"
.br
.ti -1c
.RI "KDE_DEPRECATED bool \fBconnectItem\fP (\fBKStdAccel::StdAccel\fP accel, const \fBQObject\fP *pObjSlot, const char *psMethodSlot)"
.br
.ti -1c
.RI "bool \fBremoveItem\fP (const \fBQString\fP &sAction) KDE_DEPRECATED"
.br
.ti -1c
.RI "bool \fBsetItemEnabled\fP (const \fBQString\fP &sAction, bool bEnable) KDE_DEPRECATED"
.br
.ti -1c
.RI "void \fBchangeMenuAccel\fP (\fBQPopupMenu\fP *menu, int id, const \fBQString\fP &action) KDE_DEPRECATED"
.br
.ti -1c
.RI "void \fBchangeMenuAccel\fP (\fBQPopupMenu\fP *menu, int id, \fBKStdAccel::StdAccel\fP accel) KDE_DEPRECATED"
.br
.ti -1c
.RI "int \fBcurrentKey\fP (const \fBQString\fP &action) const KDE_DEPRECATED"
.br
.ti -1c
.RI "\fBQString\fP \fBfindKey\fP (int \fBkey\fP) const KDE_DEPRECATED"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static int \fBstringToKey\fP (const \fBQString\fP &) KDE_DEPRECATED"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKAccelPrivate\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
Handle shortcuts. Configurable shortcut support for widgets. 

Allow a user to configure shortcuts through application configuration files or through the \fBKKeyChooser\fP GUI.
.PP
A KAccel contains a list of accelerator actions.
.PP
For example, CTRL+Key_P could be a shortcut for printing a document. The key codes are listed in qnamespace.h. 'Print' could be the action name for printing. The action name identifies the shortcut in configuration files and the \fBKKeyChooser\fP GUI.
.PP
A KAccel object handles key events sent to its parent widget and to all children of this parent widget. The most recently created KAccel object has precedence over any KAccel objects created before it. When a shortcut pressed, KAccel calls the slot to which it has been connected. If you want to set global accelerators, independent of the window which has the focus, use \fBKGlobalAccel\fP.
.PP
Reconfiguration of a given shortcut can be prevented by specifying that an accelerator item is not configurable when it is inserted. A special group of non-configurable key bindings are known as the standard accelerators.
.PP
The standard accelerators appear repeatedly in applications for standard document actions such as printing and saving. A convenience method is available to insert and connect these accelerators which are configurable on a desktop-wide basis.
.PP
It is possible for a user to choose to have no key associated with an action.
.PP
The translated first argument for \fBinsertItem()\fP is used only in the configuration dialog. 
.PP
.nf
 KAccel* pAccel = new KAccel( this );

 // Insert an action 'Scroll Up' which is associated with the 'Up' key:
 pAccel->insert( 'Scroll Up', i18n('Scroll up'),
                       i18n('Scroll up the current document by one line.'),
                       Qt::Key_Up, this, SLOT(slotScrollUp()) );
 // Insert an standard acclerator action.
 pAccel->insert( KStdAccel::Print, this, SLOT(slotPrint()) );

 // Update the shortcuts by read any user-defined settings from the
 //  application's config file.
 pAccel->readSettings();
 *

.fi
.PP
.PP
\fBSee also:\fP
.RS 4
\fBKGlobalAccel\fP 
.PP
\fBKAccelShortcutList\fP 
.PP
\fBKKeyChooser\fP 
.PP
\fBKKeyDialog\fP 
.RE
.PP

.PP
Definition at line 93 of file kaccel.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KAccel::KAccel (\fBQWidget\fP * pParent, const char * psName = \fC0\fP)"
.PP
Creates a new KAccel that watches \fCpParent\fP, which is also the QObject's parent. 
.PP
\fBParameters:\fP
.RS 4
\fIpParent\fP the parent and widget to watch for key strokes 
.br
\fIpsName\fP the name of the \fBQObject\fP
.RE
.PP

.PP
Definition at line 373 of file kaccel.cpp.
.PP
References endl().
.SS "KAccel::KAccel (\fBQWidget\fP * watch, \fBQObject\fP * parent, const char * psName = \fC0\fP)"
.PP
Creates a new KAccel that watches \fCwatch\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIwatch\fP the widget to watch for key strokes 
.br
\fIparent\fP the parent of the \fBQObject\fP 
.br
\fIpsName\fP the name of the \fBQObject\fP
.RE
.PP

.PP
Definition at line 380 of file kaccel.cpp.
.PP
References endl().
.SH "Member Function Documentation"
.PP 
.SS "bool KAccel::isEnabled ()"
.PP
Checks whether the KAccel is active. 
.PP
\fBReturns:\fP
.RS 4
true if the \fBQAccel\fP is enabled
.RE
.PP

.PP
Definition at line 397 of file kaccel.cpp.
.SS "void KAccel::setEnabled (bool bEnabled)"
.PP
Enables or disables the KAccel. 
.PP
\fBParameters:\fP
.RS 4
\fIbEnabled\fP true to enable, false to disable
.RE
.PP

.PP
Reimplemented from \fBQAccel\fP.
.PP
Definition at line 398 of file kaccel.cpp.
.PP
Referenced by setItemEnabled().
.SS "bool KAccel::setAutoUpdate (bool bAuto)"
.PP
Enable auto-update of connections. 
.PP
This means that the signals are automatically disconnected when you disable an action, and re-enabled when you enable it. By default auto update is turned on. If you disable auto-update, you need to call \fBupdateConnections()\fP after changing actions.
.PP
\fBParameters:\fP
.RS 4
\fIbAuto\fP true to enable, false to disable 
.RE
.PP
\fBReturns:\fP
.RS 4
the value of the flag before this call
.RE
.PP

.PP
Definition at line 399 of file kaccel.cpp.
.SS "KAccelAction * KAccel::insert (const \fBQString\fP & sAction, const \fBQString\fP & sLabel, const \fBQString\fP & sWhatsThis, const \fBKShortcut\fP & cutDef, const \fBQObject\fP * pObjSlot, const char * psMethodSlot, bool bConfigurable = \fCtrue\fP, bool bEnabled = \fCtrue\fP)"
.PP
Create an accelerator action. 
.PP
Usage: 
.PP
.nf
 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+Key_D, this, SLOT(slotDoSomething()) );
     *

.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIsAction\fP The internal name of the action. 
.br
\fIsLabel\fP An i18n'ized short description of the action displayed when using \fBKKeyChooser\fP to reconfigure the shortcuts. 
.br
\fIsWhatsThis\fP An extended description of the action. 
.br
\fIcutDef\fP The default shortcut. 
.br
\fIpObjSlot\fP Pointer to the slot object. 
.br
\fIpsMethodSlot\fP Pointer to the slot method. 
.br
\fIbConfigurable\fP Allow the user to change this shortcut if set to 'true'. 
.br
\fIbEnabled\fP The action will be activated by the shortcut if set to 'true'.
.RE
.PP

.PP
Definition at line 401 of file kaccel.cpp.
.SS "KAccelAction * KAccel::insert (const \fBQString\fP & sAction, const \fBQString\fP & sLabel, const \fBQString\fP & sWhatsThis, const \fBKShortcut\fP & cutDef3, const \fBKShortcut\fP & cutDef4, const \fBQObject\fP * pObjSlot, const char * psMethodSlot, bool bConfigurable = \fCtrue\fP, bool bEnabled = \fCtrue\fP)"
.PP
Same as first \fBinsert()\fP, but with separate shortcuts defined for 3- and 4- modifier defaults. 
.PP

.PP
Definition at line 412 of file kaccel.cpp.
.SS "KAccelAction * KAccel::insert (const char * psAction, const \fBKShortcut\fP & cutDef, const \fBQObject\fP * pObjSlot, const char * psMethodSlot, bool bConfigurable = \fCtrue\fP, bool bEnabled = \fCtrue\fP)"
.PP
This is an overloaded function provided for convenience. 
.PP
The advantage of this is when you want to use the same text for the name of the action as for the user-visible label.
.PP
Usage: 
.PP
.nf
 insert( i18n('Do Something'), ALT+Key_D, this, SLOT(slotDoSomething()) );

.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIpsAction\fP The name AND label of the action. 
.br
\fIcutDef\fP The default shortcut for this action. 
.br
\fIpObjSlot\fP Pointer to the slot object. 
.br
\fIpsMethodSlot\fP Pointer to the slot method. 
.br
\fIbConfigurable\fP Allow the user to change this shortcut if set to 'true'. 
.br
\fIbEnabled\fP The action will be activated by the shortcut if set to 'true'.
.RE
.PP

.PP
Definition at line 423 of file kaccel.cpp.
.SS "KAccelAction * KAccel::insert (\fBKStdAccel::StdAccel\fP id, const \fBQObject\fP * pObjSlot, const char * psMethodSlot, bool bConfigurable = \fCtrue\fP, bool bEnabled = \fCtrue\fP)"
.PP
Similar to the first \fBinsert()\fP method, but with the action name, short description, help text, and default shortcuts all set according to one of the standard accelerators. 
.PP
\fBSee also:\fP
.RS 4
\fBKStdAccel\fP.
.RE
.PP

.PP
Definition at line 433 of file kaccel.cpp.
.PP
References QString::insert(), QString::isEmpty(), and KStdAccel::name().
.SS "bool KAccel::remove (const \fBQString\fP & sAction)"
.PP
Removes the accelerator action identified by the name. 
.PP
Remember to also call \fBupdateConnections()\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIsAction\fP the name of the action to remove 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise 
.RE
.PP

.PP
Definition at line 451 of file kaccel.cpp.
.SS "bool KAccel::updateConnections ()"
.PP
Updates the connections of the accelerations after changing them. 
.PP
This is only necessary if you have disabled auto updates which are on by default. 
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsetAutoUpdate()\fP 
.PP
getAutoUpdate()
.RE
.PP

.PP
Definition at line 453 of file kaccel.cpp.
.SS "const \fBKShortcut\fP & KAccel::shortcut (const \fBQString\fP & sAction) const"
.PP
Return the shortcut associated with the action named by \fCsAction\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIsAction\fP the name of the action 
.RE
.PP
\fBReturns:\fP
.RS 4
the action's shortcut, or a null shortcut if not found
.RE
.PP

.PP
Definition at line 456 of file kaccel.cpp.
.PP
References KShortcut::null().
.SS "bool KAccel::setShortcut (const \fBQString\fP & sAction, const \fBKShortcut\fP & shortcut)"
.PP
Set the shortcut to be associated with the action named by \fCsAction\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIsAction\fP the name of the action 
.br
\fIshortcut\fP the shortcut to set 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise
.RE
.PP

.PP
Definition at line 468 of file kaccel.cpp.
.PP
References endl().
.SS "bool KAccel::setSlot (const \fBQString\fP & sAction, const \fBQObject\fP * pObjSlot, const char * psMethodSlot)"
.PP
Set the slot to be called when the shortcut of the action named by \fCsAction\fP is pressed. 
.PP
\fBParameters:\fP
.RS 4
\fIsAction\fP the name of the action 
.br
\fIpObjSlot\fP the owner of the slot 
.br
\fIpsMethodSlot\fP the name of the slot 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise
.RE
.PP

.PP
Definition at line 462 of file kaccel.cpp.
.PP
Referenced by connectItem().
.SS "bool KAccel::setEnabled (const \fBQString\fP & sAction, bool bEnabled)"
.PP
Enable or disable the action named by \fCsAction\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIsAction\fP the action to en-/disable 
.br
\fIbEnabled\fP true to enable, false to disable 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise
.RE
.PP

.PP
Definition at line 465 of file kaccel.cpp.
.SS "const \fBQString\fP & KAccel::configGroup () const"
.PP
Returns the configuration group of the settings. 
.PP
\fBReturns:\fP
.RS 4
the configuration group 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKConfig\fP
.RE
.PP

.PP
Definition at line 480 of file kaccel.cpp.
.SS "void KAccel::setConfigGroup (const \fBQString\fP & name)"
.PP
Returns the configuration group of the settings. 
.PP
\fBParameters:\fP
.RS 4
\fIname\fP the new configuration group 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKConfig\fP
.RE
.PP

.PP
Definition at line 483 of file kaccel.cpp.
.SS "bool KAccel::readSettings (\fBKConfigBase\fP * pConfig = \fC0\fP)"
.PP
Read all shortcuts from \fCpConfig\fP, or (if \fCpConfig\fP is zero) from the application's configuration file \fBKGlobal::config()\fP. 
.PP
The group in which the configuration is stored can be set with \fBsetConfigGroup()\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIpConfig\fP the configuration file, or 0 for the application configuration file 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise
.RE
.PP

.PP
Definition at line 486 of file kaccel.cpp.
.SS "bool KAccel::writeSettings (\fBKConfigBase\fP * pConfig = \fC0\fP) const"
.PP
Write the current shortcuts to \fCpConfig\fP, or (if \fCpConfig\fP is zero) to the application's configuration file. 
.PP
\fBParameters:\fP
.RS 4
\fIpConfig\fP the configuration file, or 0 for the application configuration file 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false otherwise
.RE
.PP

.PP
Definition at line 492 of file kaccel.cpp.
.SS "void KAccel::emitKeycodeChanged ()"
.PP
Emits the \fBkeycodeChanged()\fP signal. 
.PP

.PP
Definition at line 495 of file kaccel.cpp.
.PP
References endl(), and keycodeChanged().
.SS "void KAccel::keycodeChanged ()\fC [signal]\fP"
.PP
Emitted when one of the key codes has changed. 
.PP

.PP
Referenced by emitKeycodeChanged().
.SS "bool KAccel::insertItem (const \fBQString\fP & sLabel, const \fBQString\fP & sAction, const char * psKey, int nIDMenu = \fC0\fP, \fBQPopupMenu\fP * pMenu = \fC0\fP, bool bConfigurable = \fCtrue\fP)"
.PP
\fBDeprecated\fP
.RS 4
use insert 
.RE
.PP

.PP
Definition at line 506 of file kaccel.cpp.
.SS "bool KAccel::insertItem (const \fBQString\fP & sLabel, const \fBQString\fP & sAction, int key, int nIDMenu = \fC0\fP, \fBQPopupMenu\fP * pMenu = \fC0\fP, bool bConfigurable = \fCtrue\fP)"
.PP
\fBDeprecated\fP
.RS 4
use insert 
.RE
.PP

.PP
Definition at line 518 of file kaccel.cpp.
.SS "bool KAccel::insertStdItem (\fBKStdAccel::StdAccel\fP id, const \fBQString\fP & descr = \fCQString::null\fP)"
.PP
\fBDeprecated\fP
.RS 4
use insert 
.RE
.PP

.PP
Definition at line 532 of file kaccel.cpp.
.PP
References KAction::setShortcut().
.SS "bool KAccel::connectItem (const \fBQString\fP & sAction, const \fBQObject\fP * pObjSlot, const char * psMethodSlot, bool bActivate = \fCtrue\fP)"
.PP
\fBDeprecated\fP
.RS 4
use insert 
.RE
.PP

.PP
Definition at line 543 of file kaccel.cpp.
.PP
References endl(), and setSlot().
.SS "KDE_DEPRECATED bool KAccel::connectItem (\fBKStdAccel::StdAccel\fP accel, const \fBQObject\fP * pObjSlot, const char * psMethodSlot)\fC [inline]\fP"
.PP
\fBDeprecated\fP
.RS 4
use insert( accel, pObjSlot, psMethodSlot ); 
.RE
.PP

.PP
Definition at line 341 of file kaccel.h.
.SS "bool KAccel::removeItem (const \fBQString\fP & sAction)"
.PP
\fBDeprecated\fP
.RS 4
use remove 
.RE
.PP

.PP
Definition at line 554 of file kaccel.cpp.
.SS "bool KAccel::setItemEnabled (const \fBQString\fP & sAction, bool bEnable)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 557 of file kaccel.cpp.
.PP
References setEnabled().
.SS "void KAccel::changeMenuAccel (\fBQPopupMenu\fP * menu, int id, const \fBQString\fP & action)"
.PP
\fBDeprecated\fP
.RS 4
see KDE3PORTING.html 
.RE
.PP

.PP
Definition at line 560 of file kaccel.cpp.
.PP
References QString::find(), QString::isEmpty(), QPixmap::isNull(), QString::length(), and QString::replace().
.PP
Referenced by changeMenuAccel().
.SS "void KAccel::changeMenuAccel (\fBQPopupMenu\fP * menu, int id, \fBKStdAccel::StdAccel\fP accel)"
.PP
\fBDeprecated\fP
.RS 4
see KDE3PORTING.html 
.RE
.PP

.PP
Definition at line 587 of file kaccel.cpp.
.PP
References changeMenuAccel().
.SS "int KAccel::stringToKey (const \fBQString\fP &)\fC [static]\fP"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 592 of file kaccel.cpp.
.SS "int KAccel::currentKey (const \fBQString\fP & action) const"
.PP
\fBDeprecated\fP
.RS 4
Use \fBshortcut()\fP. 
.RE
.PP
Retrieve the key code of the accelerator item with the action name \fCaction\fP, or zero if either the action name cannot be found or the current key is set to no key.
.PP
Definition at line 597 of file kaccel.cpp.
.SS "\fBQString\fP KAccel::findKey (int key) const"
.PP
\fBDeprecated\fP
.RS 4
Use actions().actionPtr(). 
.RE
.PP
Return the name of the accelerator item with the keycode \fCkey\fP, or QString::null if the item cannot be found.
.PP
Definition at line 605 of file kaccel.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
