kdecore Library API Documentation

KAccelActions Class Reference

Collaboration diagram for KAccelActions:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KAccelActions ()
 KAccelActions (const KAccelActions &)
virtual ~KAccelActions ()
void clear ()
bool init (const KAccelActions &actions)
bool init (KConfigBase &config, const QString &sGroup)
void updateShortcuts (KAccelActions &shortcuts)
int actionIndex (const QString &sAction) const
KAccelAction * actionPtr (uint index)
const KAccelAction * actionPtr (uint index) const
KAccelAction * actionPtr (const QString &sAction)
const KAccelAction * actionPtr (const QString &sAction) const
KAccelAction * actionPtr (KKeySequence cut)
KAccelAction & operator[] (uint index)
const KAccelAction & operator[] (uint index) const
KAccelAction * insert (const QString &sAction, const QString &sLabel, const QString &sWhatsThis, const KShortcut &rgCutDefaults3, const KShortcut &rgCutDefaults4, const QObject *pObjSlot=0, const char *psMethodSlot=0, bool bConfigurable=true, bool bEnabled=true)
KAccelAction * insert (const QString &sName, const QString &sLabel)
bool remove (const QString &sAction)
bool readActions (const QString &sConfigGroup="Shortcuts", KConfigBase *pConfig=0)
bool writeActions (const QString &sConfigGroup="Shortcuts", KConfigBase *pConfig=0, bool bWriteAll=false, bool bGlobal=false) const
void emitKeycodeChanged ()
uint count () const

Protected Member Functions

void resize (uint)
void insertPtr (KAccelAction *)

Protected Attributes

KAccelBase * m_pKAccelBase
KAccelAction ** m_prgActions
uint m_nSizeAllocated
uint m_nSize

Friends

class KAccelBase

Detailed Description

Definition at line 366 of file kaccelaction.h.


Constructor & Destructor Documentation

KAccelActions::KAccelActions (   ) 
 

Creates a new, empty KAccelActions object.

Definition at line 237 of file kaccelaction.cpp.

References endl(), and kdDebug().

KAccelActions::KAccelActions (  const KAccelActions &   ) 
 

Copy constructor (deep copy).

Definition at line 243 of file kaccelaction.cpp.

References endl(), init(), and kdDebug().


Member Function Documentation

void KAccelActions::clear (   ) 
 

Removes all items from this collection.

Definition at line 271 of file kaccelaction.cpp.

References endl(), kdDebug(), m_nSize, m_nSizeAllocated, and m_prgActions.

Referenced by KStdAccel::createAccelActions(), init(), and ~KAccelActions().

bool KAccelActions::init (  const KAccelActions &  actions  ) 
 

Initializes this object with the given actions.

It will make a deep copy of all actions.

Parameters:
actions the actions to copy
Returns:
true if successful, false otherwise

Definition at line 282 of file kaccelaction.cpp.

References clear(), count(), m_nSize, m_prgActions, and resize().

Referenced by KAccelActions().

bool KAccelActions::init (  KConfigBase &  config,
const QString &  sGroup
) 
 

Loads the actions from the given configuration file.

Parameters:
config the configuration file to load from
sGroup the group in the configuration file
Returns:
true if successful, false otherwise

Definition at line 297 of file kaccelaction.cpp.

References QMap::begin(), QMap::count(), QMap::end(), endl(), KConfigBase::entryMap(), KShortcut::init(), QString::isEmpty(), kdDebug(), m_prgActions, and resize().

void KAccelActions::updateShortcuts (  KAccelActions &  shortcuts  ) 
 

Updates the shortcuts of all actions in this object with the shortcuts from the given object.

Parameters:
shortcuts the collection that contains the new shortcuts

Definition at line 349 of file kaccelaction.cpp.

References actionPtr(), emitKeycodeChanged(), endl(), kdDebug(), KAccelAction::m_bConfigurable, KAccelAction::m_cut, m_nSize, m_prgActions, KAccelAction::m_sName, and KShortcut::toStringInternal().

int KAccelActions::actionIndex (  const QString &  sAction  )  const
 

Retrieves the index of the action with the given name.

Parameters:
sAction the action to search
Returns:
the index of the action, or -1 if not found

Definition at line 374 of file kaccelaction.cpp.

References endl(), kdWarning(), m_nSize, m_prgActions, and KAccelAction::m_sName.

Referenced by actionPtr(), and remove().

KAccelAction * KAccelActions::actionPtr (  uint  index  ) 
 

Returns the action with the given index.

Parameters:
index the index of an action. You must not use an index that is too high.
Returns:
the KAccelAction with the given index
See also:
count()

Definition at line 385 of file kaccelaction.cpp.

References m_prgActions.

Referenced by KAccelBase::actionPtr(), KAccel::changeMenuAccel(), KAccelBase::createKeyList(), KAccelBase::createPopupMenu(), insert(), KShortcutMenu::insertAction(), KAccelShortcutList::isConfigurable(), KAccelShortcutList::label(), KGlobalAccel::label(), KAccelShortcutList::name(), operator[](), KAccelPrivate::removeAction(), KAccelBase::setActionSlot(), KAccelShortcutList::setShortcut(), KAccel::setShortcut(), KAccelShortcutList::shortcut(), KGlobalAccel::shortcut(), KAccel::shortcut(), KAccelShortcutList::shortcutDefault(), KGlobalAccelPrivate::slotActivated(), KAccelBase::updateConnections(), KShortcutMenu::updateShortcuts(), updateShortcuts(), and KAccelShortcutList::whatsThis().

const KAccelAction * KAccelActions::actionPtr (  uint  index  )  const
 

Returns the action with the given index.

Parameters:
index the index of an action. You must not use an index that is too high.
Returns:
the KAccelAction with the given index
See also:
count()

Definition at line 390 of file kaccelaction.cpp.

References m_prgActions.

KAccelAction * KAccelActions::actionPtr (  const QString &  sAction  ) 
 

Returns the action with the given name.

Parameters:
aAction the name of the action to search
Returns:
the KAccelAction with the given name, or 0 if not found

Definition at line 395 of file kaccelaction.cpp.

References actionIndex(), and m_prgActions.

const KAccelAction * KAccelActions::actionPtr (  const QString &  sAction  )  const
 

Returns the action with the given name.

Parameters:
aAction the name of the action to search
Returns:
the KAccelAction with the given name, or 0 if not found

Definition at line 401 of file kaccelaction.cpp.

References actionIndex(), and m_prgActions.

KAccelAction * KAccelActions::actionPtr (  KKeySequence  cut  ) 
 

Returns the action with the given key sequence.

Parameters:
cut the sequence to search for
Returns:
the KAccelAction with the given sequence, or 0 if not found

Definition at line 407 of file kaccelaction.cpp.

References KAccelAction::contains(), endl(), kdWarning(), m_nSize, m_prgActions, and KKeySequence::toStringInternal().

KAccelAction & KAccelActions::operator[] (  uint  index  ) 
 

Returns the action with the given index.

Parameters:
index the index of an action. You must not use an index that is too high.
Returns:
the KAccelAction with the given index
See also:
actionPtr()

count()

Definition at line 418 of file kaccelaction.cpp.

References actionPtr().

const KAccelAction & KAccelActions::operator[] (  uint  index  )  const
 

Returns the action with the given index.

Parameters:
index the index of an action. You must not use an index that is too high.
Returns:
the KAccelAction with the given index
See also:
actionPtr()

count()

Definition at line 423 of file kaccelaction.cpp.

References actionPtr().

KAccelAction * KAccelActions::insert (  const QString &  sAction,
const QString &  sLabel,
const QString &  sWhatsThis,
const KShortcut &  rgCutDefaults3,
const KShortcut &  rgCutDefaults4,
const QObject *  pObjSlot = 0,
const char *  psMethodSlot = 0,
bool  bConfigurable = true,
bool  bEnabled = true
) 
 

Inserts an action into the collection.

Parameters:
sName the name of the accelerator
sLabel the label of the accelerator (i18n!)
sWhatsThis the What's This text (18n!)
cutDef3 the default shortcut for 3 modifier systems
cutDef4 the default shortcut for 4 modifier systems
pObjSlot the receiver of a signal when the key has been pressed
psMethodSlot the slot to connect for key presses. Receives an int, as set by setID(), as only argument
bConfigurable if true the user can configure the shortcut
bEnabled true if the accelerator should be enabled
Returns:
the new action

Definition at line 445 of file kaccelaction.cpp.

References actionPtr(), endl(), insertPtr(), and kdWarning().

Referenced by KStdAccel::createAccelActions(), and KAccelBase::insert().

KAccelAction * KAccelActions::insert (  const QString &  sName,
const QString &  sLabel
) 
 

Inserts an action into the collection.

Parameters:
sName the name of the accelerator
sLabel the label of the accelerator (i18n!)
Returns:
the new action

Definition at line 428 of file kaccelaction.cpp.

References actionPtr(), endl(), insertPtr(), kdWarning(), KAccelAction::m_bConfigurable, KAccelAction::m_bEnabled, KAccelAction::m_sLabel, and KAccelAction::m_sName.

bool KAccelActions::remove (  const QString &  sAction  ) 
 

Removes the given action.

Parameters:
sAction the name of the action.
Returns:
true if successful, false otherwise

Definition at line 467 of file kaccelaction.cpp.

References actionIndex(), endl(), kdDebug(), m_nSize, m_pKAccelBase, m_prgActions, and KAccelBase::slotRemoveAction().

Referenced by KAccelBase::remove().

bool KAccelActions::readActions (  const QString &  sConfigGroup = "Shortcuts",
KConfigBase *  pConfig = 0
) 
 

Loads the actions from the given configuration file.

Parameters:
sConfigGroup the group in the configuration file
pConfig the configuration file to load from
Returns:
true if successful, false otherwise

Definition at line 486 of file kaccelaction.cpp.

References KShortcutList::readSettings().

Referenced by KAccelBase::readSettings().

bool KAccelActions::writeActions (  const QString &  sConfigGroup = "Shortcuts",
KConfigBase *  pConfig = 0,
bool  bWriteAll = false,
bool  bGlobal = false
)  const
 

Writes the actions to the given configuration file.

Parameters:
sConfigGroup the group in the configuration file
pConfig the configuration file to save to
bWriteAll true to write all actions
bGlobal true to write to the global configuration file
Returns:
true if successful, false otherwise

Definition at line 505 of file kaccelaction.cpp.

References KGlobal::config(), KConfigBase::deleteEntry(), endl(), QString::isEmpty(), kdDebug(), kdWarning(), KAccelAction::m_bConfigurable, KAccelAction::m_cut, m_nSize, m_prgActions, KAccelAction::m_sName, KConfigBase::readEntry(), KAccelAction::shortcutDefault(), KConfigBase::sync(), KAccelAction::toStringInternal(), and KConfigBase::writeEntry().

Referenced by KAccelBase::writeSettings().

void KAccelActions::emitKeycodeChanged (   ) 
 

Emit a keycodeChanged signal.

Definition at line 558 of file kaccelaction.cpp.

References KAccelBase::emitSignal(), and m_pKAccelBase.

Referenced by updateShortcuts().

uint KAccelActions::count (   )  const
 

Returns the number of actions in the collection.

Returns:
the number of actions

Definition at line 564 of file kaccelaction.cpp.

References m_nSize.

Referenced by KAccelBase::actionCount(), KAccelShortcutList::count(), KAccelBase::createKeyList(), and init().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Dec 1 02:56:06 2005 by doxygen 1.4.3 written by Dimitri van Heesch, © 1997-2003