kdeui Library API Documentation

KKeyChooser Class Reference

Widget for configuration of KAccel and KGlobalAccel. More...

#include <kkeydialog.h>

Inheritance diagram for KKeyChooser:

Inheritance graph
[legend]
Collaboration diagram for KKeyChooser:

Collaboration graph
[legend]
List of all members.

Public Types

enum  ActionType { Application, ApplicationGlobal, Standard, Global }

Public Slots

void allDefault ()
void setPreferFourModifierKeys (bool preferFourModifierKeys)
void listSync ()

Signals

void keyChange ()

Public Member Functions

 KKeyChooser (QWidget *parent, ActionType type=Application, bool bAllowLetterShortcuts=true)
 KKeyChooser (KActionCollection *coll, QWidget *parent, bool bAllowLetterShortcuts=true)
 KKeyChooser (KAccel *actions, QWidget *parent, bool bAllowLetterShortcuts=true)
 KKeyChooser (KGlobalAccel *actions, QWidget *parent)
 KKeyChooser (KShortcutList *, QWidget *parent, ActionType type=Application, bool bAllowLetterShortcuts=true)
virtual ~KKeyChooser ()
bool insert (KActionCollection *)
bool insert (KActionCollection *, const QString &title)
void syncToConfig (const QString &sConfigGroup, KConfigBase *pConfig, bool bClearUnset)
void commitChanges ()
void save ()
 KKeyChooser (KAccel *actions, QWidget *parent, bool bCheckAgainstStdKeys, bool bAllowLetterShortcuts, bool bAllowWinKey=false)
 KKeyChooser (KGlobalAccel *actions, QWidget *parent, bool bCheckAgainstStdKeys, bool bAllowLetterShortcuts, bool bAllowWinKey=false)

Static Public Member Functions

static bool checkGlobalShortcutsConflict (const KShortcut &cut, bool warnUser, QWidget *parent)
static bool checkStandardShortcutsConflict (const KShortcut &cut, bool warnUser, QWidget *parent)

Protected Types

enum  { NoKey = 1, DefaultKey, CustomKey }

Protected Slots

void slotNoKey ()
void slotDefaultKey ()
void slotCustomKey ()
void slotListItemSelected (QListViewItem *item)
void capturedShortcut (const KShortcut &cut)
void slotSettingsChanged (int)
void slotListItemDoubleClicked (QListViewItem *ipoQListViewItem, const QPoint &ipoQPoint, int c)

Protected Member Functions

void initGUI (ActionType type, bool bAllowLetterShortcuts)
bool insert (KAccel *)
bool insert (KGlobalAccel *)
bool insert (KShortcutList *)
void buildListView (uint iList, const QString &title=QString::null)
void readGlobalKeys ()
void updateButtons ()
void fontChange (const QFont &_font)
void setShortcut (const KShortcut &cut)
bool isKeyPresent (const KShortcut &cut, bool warnuser=true)
bool isKeyPresentLocally (const KShortcut &cut, KKeyChooserItem *ignoreItem, const QString &warnText)
void _warning (const KKeySequence &seq, QString sAction, QString sTitle)
virtual void virtual_hook (int id, void *data)

Protected Attributes

ActionType m_type
bool m_bAllowLetterShortcuts
bool m_bAllowWinKey
bool m_bPreferFourModifierKeys
QRadioButtonm_prbNone
QRadioButtonm_prbDef
QRadioButtonm_prbCustom

Friends

class KKeyDialog

Detailed Description

Widget for configuration of KAccel and KGlobalAccel.

Configure dictionaries of key/action associations for KAccel and KGlobalAccel.

The class takes care of all aspects of configuration, including handling key conflicts internally. Connect to the allDefault() slot if you want to set all configurable shortcuts to their default values.

See also:
KKeyDialog
Author:
Nicolas Hadacek <hadacek@via.ecp.fr>

Definition at line 58 of file kkeydialog.h.


Constructor & Destructor Documentation

KKeyChooser::KKeyChooser QWidget parent,
ActionType  type = Application,
bool  bAllowLetterShortcuts = true
 

Constructor.

Parameters:
parent the parent widget for this widget
type the ActionType for this KKeyChooser
bAllowLetterShortcuts Set to false if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.

Definition at line 154 of file kkeydialog.cpp.

References initGUI().

KKeyChooser::KKeyChooser KActionCollection coll,
QWidget parent,
bool  bAllowLetterShortcuts = true
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
parent parent widget
coll the KActionCollection to configure
bAllowLetterShortcuts Set to false if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.

Definition at line 160 of file kkeydialog.cpp.

References initGUI(), and insert().

KKeyChooser::KKeyChooser KAccel actions,
QWidget parent,
bool  bCheckAgainstStdKeys,
bool  bAllowLetterShortcuts,
bool  bAllowWinKey = false
 

Deprecated:

Definition at line 188 of file kkeydialog.cpp.

References initGUI(), and insert().

KKeyChooser::KKeyChooser KGlobalAccel actions,
QWidget parent,
bool  bCheckAgainstStdKeys,
bool  bAllowLetterShortcuts,
bool  bAllowWinKey = false
 

Deprecated:

Definition at line 204 of file kkeydialog.cpp.

References initGUI(), and insert().


Member Function Documentation

bool KKeyChooser::insert KActionCollection  ) 
 

Insert an action collection, i.e.

add all its actions to the ones already associated with the KKeyChooser object.

Definition at line 233 of file kkeydialog.cpp.

Referenced by KKeyDialog::configure(), KKeyDialog::insert(), insert(), and KKeyChooser().

bool KKeyChooser::insert KActionCollection ,
const QString title
 

Insert an action collection, i.e.

add all its actions to the ones already associated with the KKeyChooser object.

Parameters:
title subtree title of this collection of shortcut.
Since:
3.1

Definition at line 238 of file kkeydialog.cpp.

References KInstance::aboutData(), buildListView(), KActionCollection::instance(), QString::isEmpty(), and KAboutData::programName().

void KKeyChooser::commitChanges  ) 
 

This function writes any shortcut changes back to the original action set(s).

Definition at line 273 of file kkeydialog.cpp.

References QListViewItemIterator::current(), endl(), and kdDebug().

Referenced by KKeyDialog::commitChanges(), and save().

void KKeyChooser::save  ) 
 

This commits and then saves the actions to disk.

Any KActionCollection objects with the xmlFile() value set will be written to an XML file. All other will be written to the application's rc file.

Definition at line 285 of file kkeydialog.cpp.

References commitChanges().

Referenced by KKeyDialog::configure().

bool KKeyChooser::checkGlobalShortcutsConflict const KShortcut cut,
bool  warnUser,
QWidget parent
[static]
 

Checks whether the given shortcut conflicts with global keyboard shortcuts.

If yes, and the warnUser argument is true, warns the user and gives them a chance to reassign the shortcut from the global shortcut.

Returns:
true if there was conflict (and the user didn't reassign the shortcut)
Parameters:
cut the shortcut that will be checked for conflicts
warnUser if true, the user will be warned about a conflict and given a chance to reassign the shortcut
parent parent widget for the warning dialog
Since:
3.2

Definition at line 850 of file kkeydialog.cpp.

References readGlobalKeys().

Referenced by isKeyPresent().

bool KKeyChooser::checkStandardShortcutsConflict const KShortcut cut,
bool  warnUser,
QWidget parent
[static]
 

Checks whether the given shortcut conflicts with standard keyboard shortcuts.

If yes, and the warnUser argument is true, warns the user and gives them a chance to reassign the shortcut from the standard shortcut.

Returns:
true if there was conflict (and the user didn't reassign the shortcut)
Parameters:
cut the shortcut that will be checked for conflicts
warnUser if true, the user will be warned about a conflict and given a chance to reassign the shortcut
parent parent widget for the warning dialog
Since:
3.2

Definition at line 832 of file kkeydialog.cpp.

References KShortcut::count(), KStdAccel::findStdAccel(), KStdAccel::label(), KShortcut::seq(), and KStdAccel::shortcut().

Referenced by isKeyPresent().

void KKeyChooser::keyChange  )  [signal]
 

Emitted when an action's shortcut has been changed.

Referenced by allDefault(), setShortcut(), and slotNoKey().

void KKeyChooser::allDefault  )  [slot]
 

Set all keys to their default values (bindings).

Definition at line 616 of file kkeydialog.cpp.

References QListViewItemIterator::current(), endl(), kdDebug(), keyChange(), and updateButtons().

void KKeyChooser::setPreferFourModifierKeys bool  preferFourModifierKeys  )  [slot]
 

Specifies whether to use the 3 or 4 modifier key scheme.

This determines which default is used when the 'Default' button is clicked.

Definition at line 648 of file kkeydialog.cpp.

void KKeyChooser::buildListView uint  iList,
const QString title = QString::null
[protected]
 

Since:
3.1

Definition at line 462 of file kkeydialog.cpp.

References KActionShortcutList::action(), KShortcutList::count(), endl(), QListViewItem::firstChild(), KAction::iconSet(), KShortcutList::isConfigurable(), QString::isEmpty(), kdDebug(), KShortcutList::label(), m_type, KShortcutList::name(), QIconSet::pixmap(), QListViewItem::setSelectable(), and QString::startsWith().

Referenced by insert().

void KKeyChooser::listSync  )  [slot]
 

Rebuild list entries based on underlying map.

Use this if you changed the underlying map.

Definition at line 663 of file kkeydialog.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Jul 20 12:33:35 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003