kkeydialog.h
/* This file is part of the KDE libraries
Copyright (C) 1997 Nicolas Hadacek <hadacek@kde.org>
Copyright (C) 2001,2001 Ellis Whitehead <ellis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __KKEYDIALOG_H__
#define __KKEYDIALOG_H__
#include <qdict.h>
#include <kdialogbase.h>
#include <klistview.h>
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QRadioButton;
class KAccel;
class KAccelActions;
class KActionCollection;
class KConfigBase;
class KGlobalAccel;
class KKeySequence;
class KShortcut;
class KShortcutList;
class KKeyChooserItem;
class KDEUI_EXPORT KKeyChooser : public QWidget
{
Q_OBJECT
public:
enum ActionType { Application, ApplicationGlobal, Standard, Global };
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* ); // #### KDE4 : remove me
bool insert( KActionCollection *, const QString &title);
void syncToConfig( const QString& sConfigGroup, KConfigBase* pConfig, bool bClearUnset );
void commitChanges();
void save();
static bool checkGlobalShortcutsConflict( const KShortcut& cut, bool warnUser, QWidget* parent );
static bool checkStandardShortcutsConflict( const KShortcut& cut, bool warnUser, QWidget* parent );
signals:
void keyChange();
public slots:
void allDefault();
void setPreferFourModifierKeys( bool preferFourModifierKeys );
// KDE4 a lot of stuff in this class should be probably private:
protected:
enum { NoKey = 1, DefaultKey, CustomKey };
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 );
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:
ActionType m_type;
bool m_bAllowLetterShortcuts;
bool m_bAllowWinKey; // unused KDE4 remove
// When set, pressing the 'Default' button will select the aDefaultKeycode4,
// otherwise aDefaultKeycode.
bool m_bPreferFourModifierKeys;
QRadioButton* m_prbNone;
QRadioButton* m_prbDef;
QRadioButton* m_prbCustom;
private:
bool isKeyPresentLocally( const KShortcut& cut, KKeyChooserItem* ignoreItem, bool bWarnUser );
static bool promptForReassign( const KKeySequence& cut, const QString& sAction, ActionType action, QWidget* parent );
// Remove the key sequences contained in cut from the standard shortcut @p name
// which currently has @p origCut as shortcut.
static void removeStandardShortcut( const QString& name, KKeyChooser* chooser, const KShortcut &origCut, const KShortcut &cut );
// Remove the key sequences contained in cut from the global shortcut @p name
// which currently has @p origCut as shortcut.
static void removeGlobalShortcut( const QString& name, KKeyChooser* chooser, const KShortcut &origCut, const KShortcut &cut );
static void readGlobalKeys( QMap< QString, KShortcut >& map );
static bool checkGlobalShortcutsConflict( const KShortcut& cut, bool bWarnUser, QWidget* parent,
const QMap< QString, KShortcut >& map, const QString& ignoreAction );
// Remove the key sequences contained in cut from this item
bool removeShortcut( const QString& name, const KShortcut &cut );
private slots:
void captureCurrentItem();
#ifndef KDE_NO_COMPAT
public:
KKeyChooser( KAccel* actions, QWidget* parent,
bool bCheckAgainstStdKeys,
bool bAllowLetterShortcuts,
bool bAllowWinKey = false );
KKeyChooser( KGlobalAccel* actions, QWidget* parent,
bool bCheckAgainstStdKeys,
bool bAllowLetterShortcuts,
bool bAllowWinKey = false );
public slots:
void listSync();
#endif
protected:
virtual void virtual_hook( int id, void* data );
private:
class KKeyChooserPrivate *d;
friend class KKeyDialog;
};
typedef KKeyChooser KKeyChooser;
class KDEUI_EXPORT KKeyDialog : public KDialogBase
{
Q_OBJECT
public:
KKeyDialog( bool bAllowLetterShortcuts = true, QWidget* parent = 0, const char* name = 0 );
virtual ~KKeyDialog();
bool insert( KActionCollection* ); // #### KDE4: remove me
bool insert(KActionCollection *, const QString &title);
bool configure( bool bSaveSettings = true );
void commitChanges();
static int configure( KActionCollection* coll, QWidget* parent = 0, bool bSaveSettings = true );
static int configure( KAccel* keys, QWidget* parent = 0, bool bSaveSettings = true );
static int configure( KGlobalAccel* keys, QWidget* parent = 0, bool bSaveSettings = true );
static int configure( KActionCollection* coll, bool bAllowLetterShortcuts, QWidget* parent = 0, bool bSaveSettings = true ); // BCI: merge with bAllowLetterShortcuts = true
static int configure( KAccel* keys, bool bAllowLetterShortcuts, QWidget* parent = 0, bool bSaveSettings = true ); // BCI: merge with bAllowLetterShortcuts = true
static int configure( KGlobalAccel* keys, bool bAllowLetterShortcuts, QWidget* parent = 0, bool bSaveSettings = true ); // BCI: merge with bAllowLetterShortcuts = true
static KDE_DEPRECATED int configureKeys( KAccel* keys, bool save_settings = true, QWidget* parent = 0 )
{ return configure( keys, parent, save_settings ); }
static KDE_DEPRECATED int configureKeys( KGlobalAccel* keys, bool save_settings = true, QWidget* parent = 0 )
{ return configure( keys, parent, save_settings ); }
static KDE_DEPRECATED int configureKeys( KActionCollection* coll, const QString& /*xmlfile*/,
bool save_settings = true, QWidget* parent = 0 )
{ return configure( coll, parent, save_settings ); }
private:
KKeyDialog( KKeyChooser::ActionType, bool bAllowLetterShortcuts = true, QWidget* parent = 0, const char* name = 0 );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KKeyDialogPrivate* d;
KKeyChooser* m_pKeyChooser;
};
#endif // __KKEYDIALOG_H__
KActionCollection
A managed set of KAction objects.
Definition: kactioncollection.h:78
KAccel
KKeyDialog::configureKeys
static KDE_DEPRECATED int configureKeys(KActionCollection *coll, const QString &, bool save_settings=true, QWidget *parent=0)
Definition: kkeydialog.h:392
KKeyDialog::configureKeys
static KDE_DEPRECATED int configureKeys(KAccel *keys, bool save_settings=true, QWidget *parent=0)
Definition: kkeydialog.h:380
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KKeyDialog::configureKeys
static KDE_DEPRECATED int configureKeys(KGlobalAccel *keys, bool save_settings=true, QWidget *parent=0)
Definition: kkeydialog.h:386
KShortcut
KKeySequence
KShortcutList
KConfigBase
KKeyDialog
Dialog for configuration of KActionCollection, KAccel, and KGlobalAccel.
Definition: kkeydialog.h:274
KKeyChooser
Widget for configuration of KAccel and KGlobalAccel.
Definition: kkeydialog.h:58
KGlobalAccel

KDE Home | KDE Accessibility Home | Description of Access Keys