# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KShortcutList Class Reference

KShortcutList is an abstract base class for KAccelShortcutList and KStdAccel::ShortcutList. Base class for accessing accelerator lists. More...

`#include <kshortcutlist.h>`

Inheritance diagram for KShortcutList:

[legend]
List of all members.

## Public Types

enum | Other

## Public Member Functions

| KShortcutList ()
| Default constructor.
virtual unsigned int | count () const =0
| Returns the number of entries.
virtual QString | name (unsigned int index) const =0
| Returns the name of the shortcut with the given `index`.
virtual QString | label (unsigned int index) const =0
| Returns the (i18n'd) label of the shortcut with the given `index`.
virtual QString | whatsThis (unsigned int index) const =0
| Returns the (i18n'd) What's This text of the shortcut with the given `index`.
virtual const KShortcut & | shortcut (unsigned int index) const =0
| Returns the shortcut with the given `index`.
virtual const KShortcut & | shortcutDefault (unsigned int index) const =0
| Returns default shortcut with the given `index`.
virtual bool | isConfigurable (unsigned int index) const =0
| Checks whether the shortcut with the given `index` is configurable.
virtual bool | setShortcut (unsigned int index, const KShortcut &shortcut)=0
| Sets the shortcut of the given entry.
virtual bool | isGlobal (unsigned int index) const
| Checks whether the shortcut with the given `index` is saved in the global configuration.
virtual int | index (const QString &sName) const
| Returns the index of the shortcut with he given name.
virtual int | index (const KKeySequence &keySeq) const
| Returns the index of the shortcut with he given key sequence.
virtual const KInstance * | instance () const
| The KInstance.
virtual QVariant | getOther (Other, unsigned int index) const =0
virtual bool | setOther (Other, unsigned int index, QVariant)=0
virtual bool | save () const =0
| Save the shortcut list.
virtual bool | readSettings (const QString &sConfigGroup=QString::null, KConfigBase *pConfig=0)
| Loads the shortcuts from the given configuration file.
virtual bool | writeSettings (const QString &sConfigGroup=QString::null, KConfigBase *pConfig=0, bool bWriteAll=false, bool bGlobal=false) const
| Writes the shortcuts to the given configuration file.

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)
| used to extend the interface with virtuals without breaking binary compatibility

## Detailed Description

KShortcutList is an abstract base class for KAccelShortcutList and KStdAccel::ShortcutList. Base class for accessing accelerator lists.

It gives you an unified interface for accessing the accelerator lists of KAccel (using ), KGlobalAccel (using ), and KStdAccel (using KStdAccel::ShortcutList).

Definition at line 45 of file kshortcutlist.h.

## Constructor & Destructor Documentation

KShortcutList::KShortcutList | ( |  | ) |

| Default constructor. Definition at line 18 of file kshortcutlist.cpp.

## Member Function Documentation

virtual unsigned int KShortcutList::count | ( |  | ) | const`[pure virtual]`

Returns the number of entries.

Returns:
  the number of entries

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

Referenced by index(), readSettings(), and writeSettings().

virtual QString KShortcutList::name | ( | unsigned int | index | ) | const`[pure virtual]`

Returns the name of the shortcut with the given `index`.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  the name of the shortcut

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

Referenced by readSettings(), and writeSettings().

virtual QString KShortcutList::label | ( | unsigned int | index | ) | const`[pure virtual]`

Returns the (i18n'd) label of the shortcut with the given `index`.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  the label (i18n'd) of the shortcut

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

virtual QString KShortcutList::whatsThis | ( | unsigned int | index | ) | const`[pure virtual]`

Returns the (i18n'd) What's This text of the shortcut with the given `index`.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  the What's This text (i18n'd) of the shortcut

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

virtual const KShortcut& KShortcutList::shortcut | ( | unsigned int | index | ) | const`[pure virtual]`

Returns the shortcut with the given `index`.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  the shortcut

See also:
  shortcutDefault()

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

Referenced by index(), and writeSettings().

virtual const KShortcut& KShortcutList::shortcutDefault | ( | unsigned int | index | ) | const`[pure virtual]`

Returns default shortcut with the given `index`.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  the default shortcut

See also:
  shortcut()

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

Referenced by readSettings(), and writeSettings().

virtual bool KShortcutList::isConfigurable | ( | unsigned int | index | ) | const`[pure virtual]`

Checks whether the shortcut with the given `index` is configurable.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  true if configurable, false otherwise

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

Referenced by readSettings(), and writeSettings().

virtual bool KShortcutList::setShortcut | ( | unsigned int | index,
|  | const KShortcut & | shortcut
| ) | `[pure virtual]`

Sets the shortcut of the given entry.

Parameters:

  index | the index of the shortcut (must be < count())
  shortcut | the shortcut

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

Referenced by readSettings().

virtual bool KShortcutList::isGlobal | ( | unsigned int | index | ) | const`[virtual]`

Checks whether the shortcut with the given `index` is saved in the global configuration.

Parameters:

  index | the index of the shortcut (must be < count())

Returns:
  true if global, false otherwise

Reimplemented in KAccelShortcutList.

int KShortcutList::index | ( | const QString & | sName | ) | const`[virtual]`

Returns the index of the shortcut with he given name.

Parameters:

  sName | the name of the shortcut to search

Returns:
  the index of the shortcut, of -1 if not found

Definition at line 32 of file kshortcutlist.cpp.

int KShortcutList::index | ( | const KKeySequence & | keySeq | ) | const`[virtual]`

Returns the index of the shortcut with he given key sequence.

Parameters:

  keySeq | the key sequence to search for

Returns:
  the index of the shortcut, of -1 if not found

Definition at line 37 of file kshortcutlist.cpp.

References count(), KKeySequence::isNull(), and shortcut().

const KInstance * KShortcutList::instance | ( |  | ) | const`[virtual]`

The KInstance.

Returns:
  the KInstance of the list, can be 0 if not available

Definition at line 51 of file kshortcutlist.cpp.

virtual bool KShortcutList::save | ( |  | ) | const`[pure virtual]`

Save the shortcut list.

Returns:
  true if successful, false otherwise

Implemented in KAccelShortcutList, and KStdAccel::ShortcutList.

bool KShortcutList::readSettings | ( | const QString & | sConfigGroup = QString::null,
|  | KConfigBase * | pConfig = 0
| ) | `[virtual]`

Loads the shortcuts 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 66 of file kshortcutlist.cpp.

References KGlobal::config(), count(), KConfigBase::hasGroup(), isConfigurable(), QString::isEmpty(), name(), KConfigBase::readEntry(), setShortcut(), and shortcutDefault().

bool KShortcutList::writeSettings | ( | const QString & | sConfigGroup = QString::null,
|  | KConfigBase * | pConfig = 0,
|  | bool | bWriteAll = false,
|  | bool | bGlobal = false
| ) | const`[virtual]`

Writes the shortcuts 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 104 of file kshortcutlist.cpp.

References KGlobal::config(), count(), KConfigBase::deleteEntry(), KConfigBase::deleteGroup(), KConfigBase::hasGroup(), isConfigurable(), QString::isEmpty(), name(), KConfigBase::readEntry(), shortcut(), shortcutDefault(), KConfigBase::sync(), and KConfigBase::writeEntry().

Referenced by KStdAccel::ShortcutList::save(), and KAccelShortcutList::save().

void KShortcutList::virtual_hook | ( | int | id,
|  | void * | data
| ) | `[protected, virtual]`

| used to extend the interface with virtuals without breaking binary compatibility Reimplemented in KAccelShortcutList, and KStdAccel::ShortcutList. Definition at line 196 of file kshortcutlist.cpp. Referenced by KStdAccel::ShortcutList::virtual_hook(), and KAccelShortcutList::virtual_hook().

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

- kshortcutlist.h
- kshortcutlist.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:51:22 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001