• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
TDEAccel Class Reference

#include <tdeaccel.h>

Inherits TQAccel.

Signals

void keycodeChanged ()
 

Public Member Functions

 TDEAccel (TQWidget *pParent, const char *psName=0)
 
 TDEAccel (TQWidget *watch, TQObject *parent, const char *psName=0)
 
TDEAccelActions & actions ()
 
const TDEAccelActions & actions () const
 
bool isEnabled ()
 
void setEnabled (bool bEnabled)
 
bool setAutoUpdate (bool bAuto)
 
TDEAccelAction * insert (const TQString &sAction, const TQString &sLabel, const TQString &sWhatsThis, const TDEShortcut &cutDef, const TQObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)
 
TDEAccelAction * insert (const TQString &sAction, const TQString &sLabel, const TQString &sWhatsThis, const TDEShortcut &cutDef3, const TDEShortcut &cutDef4, const TQObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)
 
TDEAccelAction * insert (const char *psAction, const TDEShortcut &cutDef, const TQObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)
 
TDEAccelAction * insert (TDEStdAccel::StdAccel id, const TQObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)
 
bool remove (const TQString &sAction)
 
bool updateConnections ()
 
const TDEShortcut & shortcut (const TQString &sAction) const
 
bool setShortcut (const TQString &sAction, const TDEShortcut &shortcut)
 
bool setSlot (const TQString &sAction, const TQObject *pObjSlot, const char *psMethodSlot)
 
bool setEnabled (const TQString &sAction, bool bEnabled)
 
const TQString & configGroup () const
 
void setConfigGroup (const TQString &name)
 
bool readSettings (TDEConfigBase *pConfig=0)
 
bool writeSettings (TDEConfigBase *pConfig=0) const
 
void emitKeycodeChanged ()
 
bool insertItem (const TQString &sLabel, const TQString &sAction, const char *psKey, int nIDMenu=0, TQPopupMenu *pMenu=0, bool bConfigurable=true) TDE_DEPRECATED
 
bool insertItem (const TQString &sLabel, const TQString &sAction, int key, int nIDMenu=0, TQPopupMenu *pMenu=0, bool bConfigurable=true) TDE_DEPRECATED
 
bool insertStdItem (TDEStdAccel::StdAccel id, const TQString &descr=TQString::null) TDE_DEPRECATED
 
bool connectItem (const TQString &sAction, const TQObject *pObjSlot, const char *psMethodSlot, bool bActivate=true) TDE_DEPRECATED
 
TDE_DEPRECATED bool connectItem (TDEStdAccel::StdAccel accel, const TQObject *pObjSlot, const char *psMethodSlot)
 
bool removeItem (const TQString &sAction) TDE_DEPRECATED
 
bool setItemEnabled (const TQString &sAction, bool bEnable) TDE_DEPRECATED
 
void changeMenuAccel (TQPopupMenu *menu, int id, const TQString &action) TDE_DEPRECATED
 
void changeMenuAccel (TQPopupMenu *menu, int id, TDEStdAccel::StdAccel accel) TDE_DEPRECATED
 
int currentKey (const TQString &action) const TDE_DEPRECATED
 
TQString findKey (int key) const TDE_DEPRECATED
 

Static Public Member Functions

static int stringToKey (const TQString &) TDE_DEPRECATED
 

Protected Member Functions

virtual void virtual_hook (int id, void *data)
 

Friends

class TDEAccelPrivate
 

Detailed Description

Handle shortcuts.

Allow a user to configure shortcuts through application configuration files or through the KKeyChooser GUI.

A TDEAccel contains a list of accelerator actions.

For example, CTRL+Key_P could be a shortcut for printing a document. The key codes are listed in tqnamespace.h. "Print" could be the action name for printing. The action name identifies the shortcut in configuration files and the KKeyChooser GUI.

A TDEAccel object handles key events sent to its parent widget and to all children of this parent widget. The most recently created TDEAccel object has precedence over any TDEAccel objects created before it. When a shortcut pressed, TDEAccel 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 TDEGlobalAccel.

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.

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.

It is possible for a user to choose to have no key associated with an action.

The translated first argument for insertItem() is used only in the configuration dialog.

TDEAccel* pAccel = new TDEAccel( 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."),
TQt::Key_Up, this, TQ_SLOT(slotScrollUp()) );
// Insert an standard acclerator action.
pAccel->insert( TDEStdAccel::Print, this, TQ_SLOT(slotPrint()) );
// Update the shortcuts by read any user-defined settings from the
// application's config file.
pAccel->readSettings();
TDEAccel
Handle shortcuts.
Definition: tdeaccel.h:94
TDEAccel::readSettings
bool readSettings(TDEConfigBase *pConfig=0)
Read all shortcuts from pConfig, or (if pConfig is zero) from the application's configuration file TD...
Definition: tdeaccel.cpp:530
TDEAccel::TDEAccel
TDEAccel(TQWidget *pParent, const char *psName=0)
Creates a new TDEAccel that watches pParent, which is also the TQObject's parent.
Definition: tdeaccel.cpp:417
TDEAccel::insert
TDEAccelAction * insert(const TQString &sAction, const TQString &sLabel, const TQString &sWhatsThis, const TDEShortcut &cutDef, const TQObject *pObjSlot, const char *psMethodSlot, bool bConfigurable=true, bool bEnabled=true)
Create an accelerator action.
Definition: tdeaccel.cpp:445

Configurable shortcut support for widgets.

See also
TDEGlobalAccel
TDEAccelShortcutList
KKeyChooser
KKeyDialog

Definition at line 93 of file tdeaccel.h.

Constructor & Destructor Documentation

◆ TDEAccel() [1/2]

TDEAccel::TDEAccel ( TQWidget *  pParent,
const char *  psName = 0 
)

Creates a new TDEAccel that watches pParent, which is also the TQObject's parent.

Parameters
pParentthe parent and widget to watch for key strokes
psNamethe name of the TQObject

Definition at line 417 of file tdeaccel.cpp.

◆ TDEAccel() [2/2]

TDEAccel::TDEAccel ( TQWidget *  watch,
TQObject *  parent,
const char *  psName = 0 
)

Creates a new TDEAccel that watches watch.

Parameters
watchthe widget to watch for key strokes
parentthe parent of the TQObject
psNamethe name of the TQObject

Definition at line 424 of file tdeaccel.cpp.

◆ ~TDEAccel()

TDEAccel::~TDEAccel ( )
virtual

Definition at line 433 of file tdeaccel.cpp.

Member Function Documentation

◆ actions() [1/2]

TDEAccelActions & TDEAccel::actions ( )

Definition at line 439 of file tdeaccel.cpp.

◆ actions() [2/2]

const TDEAccelActions & TDEAccel::actions ( ) const

Definition at line 440 of file tdeaccel.cpp.

◆ changeMenuAccel() [1/2]

void TDEAccel::changeMenuAccel ( TQPopupMenu *  menu,
int  id,
const TQString &  action 
)
Deprecated:
see KDE3PORTING.html

Definition at line 604 of file tdeaccel.cpp.

◆ changeMenuAccel() [2/2]

void TDEAccel::changeMenuAccel ( TQPopupMenu *  menu,
int  id,
TDEStdAccel::StdAccel  accel 
)
Deprecated:
see KDE3PORTING.html

Definition at line 631 of file tdeaccel.cpp.

◆ configGroup()

const TQString & TDEAccel::configGroup ( ) const

Returns the configuration group of the settings.

Returns
the configuration group
See also
TDEConfig

Definition at line 524 of file tdeaccel.cpp.

◆ connectItem() [1/2]

bool TDEAccel::connectItem ( const TQString &  sAction,
const TQObject *  pObjSlot,
const char *  psMethodSlot,
bool  bActivate = true 
)
Deprecated:
use insert

Definition at line 587 of file tdeaccel.cpp.

◆ connectItem() [2/2]

TDE_DEPRECATED bool TDEAccel::connectItem ( TDEStdAccel::StdAccel  accel,
const TQObject *  pObjSlot,
const char *  psMethodSlot 
)
inline
Deprecated:
use insert( accel, pObjSlot, psMethodSlot );

Definition at line 341 of file tdeaccel.h.

◆ currentKey()

int TDEAccel::currentKey ( const TQString &  action) const
Deprecated:
Use shortcut().

Retrieve 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.

Definition at line 641 of file tdeaccel.cpp.

◆ emitKeycodeChanged()

void TDEAccel::emitKeycodeChanged ( )

Emits the keycodeChanged() signal.

Definition at line 539 of file tdeaccel.cpp.

◆ findKey()

TQString TDEAccel::findKey ( int  key) const
Deprecated:
Use actions().actionPtr().

Return the name of the accelerator item with the keycode key, or TQString::null if the item cannot be found.

Definition at line 649 of file tdeaccel.cpp.

◆ insert() [1/4]

TDEAccelAction * TDEAccel::insert ( const char *  psAction,
const TDEShortcut &  cutDef,
const TQObject *  pObjSlot,
const char *  psMethodSlot,
bool  bConfigurable = true,
bool  bEnabled = true 
)

This is an overloaded function provided for convenience.

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.

Usage:

insert( i18n("Do Something"), ALT+Key_D, this, TQ_SLOT(slotDoSomething()) );
Parameters
psActionThe name AND label of the action.
cutDefThe default shortcut for this action.
pObjSlotPointer to the slot object.
psMethodSlotPointer to the slot method.
bConfigurableAllow the user to change this shortcut if set to 'true'.
bEnabledThe action will be activated by the shortcut if set to 'true'.

Definition at line 467 of file tdeaccel.cpp.

◆ insert() [2/4]

TDEAccelAction * TDEAccel::insert ( const TQString &  sAction,
const TQString &  sLabel,
const TQString &  sWhatsThis,
const TDEShortcut &  cutDef,
const TQObject *  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+Key_D, this, TQ_SLOT(slotDoSomething()) );
Parameters
sActionThe internal name of the action.
sLabelAn i18n'ized short description of the action displayed when using KKeyChooser to reconfigure the shortcuts.
sWhatsThisAn extended description of the action.
cutDefThe default shortcut.
pObjSlotPointer to the slot object.
psMethodSlotPointer to the slot method.
bConfigurableAllow the user to change this shortcut if set to 'true'.
bEnabledThe action will be activated by the shortcut if set to 'true'.

Definition at line 445 of file tdeaccel.cpp.

◆ insert() [3/4]

TDEAccelAction * TDEAccel::insert ( const TQString &  sAction,
const TQString &  sLabel,
const TQString &  sWhatsThis,
const TDEShortcut &  cutDef3,
const TDEShortcut &  cutDef4,
const TQObject *  pObjSlot,
const char *  psMethodSlot,
bool  bConfigurable = true,
bool  bEnabled = true 
)

Same as first insert(), but with separate shortcuts defined for 3- and 4- modifier defaults.

Definition at line 456 of file tdeaccel.cpp.

◆ insert() [4/4]

TDEAccelAction * TDEAccel::insert ( TDEStdAccel::StdAccel  id,
const TQObject *  pObjSlot,
const char *  psMethodSlot,
bool  bConfigurable = true,
bool  bEnabled = true 
)

Similar to the first insert() method, but with the action name, short description, help text, and default shortcuts all set according to one of the standard accelerators.

See also
TDEStdAccel.

Definition at line 477 of file tdeaccel.cpp.

◆ insertItem() [1/2]

bool TDEAccel::insertItem ( const TQString &  sLabel,
const TQString &  sAction,
const char *  psKey,
int  nIDMenu = 0,
TQPopupMenu *  pMenu = 0,
bool  bConfigurable = true 
)
Deprecated:
use insert

Definition at line 550 of file tdeaccel.cpp.

◆ insertItem() [2/2]

bool TDEAccel::insertItem ( const TQString &  sLabel,
const TQString &  sAction,
int  key,
int  nIDMenu = 0,
TQPopupMenu *  pMenu = 0,
bool  bConfigurable = true 
)
Deprecated:
use insert

Definition at line 562 of file tdeaccel.cpp.

◆ insertStdItem()

bool TDEAccel::insertStdItem ( TDEStdAccel::StdAccel  id,
const TQString &  descr = TQString::null 
)
Deprecated:
use insert

Definition at line 576 of file tdeaccel.cpp.

◆ isEnabled()

bool TDEAccel::isEnabled ( )

Checks whether the TDEAccel is active.

Returns
true if the TQAccel is enabled

Definition at line 441 of file tdeaccel.cpp.

◆ keycodeChanged

void TDEAccel::keycodeChanged ( )
signal

Emitted when one of the key codes has changed.

◆ readSettings()

bool TDEAccel::readSettings ( TDEConfigBase *  pConfig = 0)

Read all shortcuts from pConfig, or (if pConfig is zero) from the application's configuration file TDEGlobal::config().

The group in which the configuration is stored can be set with setConfigGroup().

Parameters
pConfigthe configuration file, or 0 for the application configuration file
Returns
true if successful, false otherwise

Definition at line 530 of file tdeaccel.cpp.

◆ remove()

bool TDEAccel::remove ( const TQString &  sAction)
Removes the accelerator action identified by the name.
Remember to also call updateConnections().
Parameters
sActionthe name of the action to remove
Returns
true if successful, false otherwise

Definition at line 495 of file tdeaccel.cpp.

◆ removeItem()

bool TDEAccel::removeItem ( const TQString &  sAction)
Deprecated:
use remove

Definition at line 598 of file tdeaccel.cpp.

◆ setAutoUpdate()

bool TDEAccel::setAutoUpdate ( bool  bAuto)

Enable auto-update of connections.

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 updateConnections() after changing actions.

Parameters
bAutotrue to enable, false to disable
Returns
the value of the flag before this call

Definition at line 443 of file tdeaccel.cpp.

◆ setConfigGroup()

void TDEAccel::setConfigGroup ( const TQString &  name)

Returns the configuration group of the settings.

Parameters
namethe new configuration group
See also
TDEConfig

Definition at line 527 of file tdeaccel.cpp.

◆ setEnabled() [1/2]

void TDEAccel::setEnabled ( bool  bEnabled)

Enables or disables the TDEAccel.

Parameters
bEnabledtrue to enable, false to disable

Definition at line 442 of file tdeaccel.cpp.

◆ setEnabled() [2/2]

bool TDEAccel::setEnabled ( const TQString &  sAction,
bool  bEnabled 
)

Enable or disable the action named by sAction.

Parameters
sActionthe action to en-/disable
bEnabledtrue to enable, false to disable
Returns
true if successful, false otherwise

Definition at line 509 of file tdeaccel.cpp.

◆ setItemEnabled()

bool TDEAccel::setItemEnabled ( const TQString &  sAction,
bool  bEnable 
)
Deprecated:

Definition at line 601 of file tdeaccel.cpp.

◆ setShortcut()

bool TDEAccel::setShortcut ( const TQString &  sAction,
const TDEShortcut &  shortcut 
)

Set the shortcut to be associated with the action named by sAction.

Parameters
sActionthe name of the action
shortcutthe shortcut to set
Returns
true if successful, false otherwise

Definition at line 512 of file tdeaccel.cpp.

◆ setSlot()

bool TDEAccel::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
sActionthe name of the action
pObjSlotthe owner of the slot
psMethodSlotthe name of the slot
Returns
true if successful, false otherwise

Definition at line 506 of file tdeaccel.cpp.

◆ shortcut()

const TDEShortcut & TDEAccel::shortcut ( const TQString &  sAction) const

Return the shortcut associated with the action named by sAction.

Parameters
sActionthe name of the action
Returns
the action's shortcut, or a null shortcut if not found

Definition at line 500 of file tdeaccel.cpp.

◆ stringToKey()

int TDEAccel::stringToKey ( const TQString &  sKey)
static
Deprecated:

Definition at line 636 of file tdeaccel.cpp.

◆ updateConnections()

bool TDEAccel::updateConnections ( )

Updates the connections of the accelerations after changing them.

This is only necessary if you have disabled auto updates which are on by default.

Returns
true if successful, false otherwise
See also
setAutoUpdate()
getAutoUpdate()

Definition at line 497 of file tdeaccel.cpp.

◆ virtual_hook()

void TDEAccel::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 659 of file tdeaccel.cpp.

◆ writeSettings()

bool TDEAccel::writeSettings ( TDEConfigBase *  pConfig = 0) const

Write the current shortcuts to pConfig, or (if pConfig is zero) to the application's configuration file.

Parameters
pConfigthe configuration file, or 0 for the application configuration file
Returns
true if successful, false otherwise

Definition at line 536 of file tdeaccel.cpp.

Friends And Related Function Documentation

◆ TDEAccelPrivate

friend class TDEAccelPrivate
friend

Definition at line 387 of file tdeaccel.h.


The documentation for this class was generated from the following files:
  • tdeaccel.h
  • tdeaccel.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.