kkeydialog.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef __KKEYDIALOG_H__
00022
#define __KKEYDIALOG_H__
00023
00024
#include <qdict.h>
00025
#include <kdialogbase.h>
00026
#include <klistview.h>
00027
00028
class QButtonGroup;
00029
class QCheckBox;
00030
class QGroupBox;
00031
class QLabel;
00032
class QLineEdit;
00033
class QRadioButton;
00034
class KAccel;
00035
class KAccelActions;
00036
class KActionCollection;
00037
class KConfigBase;
00038
class KGlobalAccel;
00039
class KKeySequence;
00040
class KShortcut;
00041
class KShortcutList;
00042
class KKeyChooserItem;
00043
00058 class KKeyChooser :
public QWidget
00059 {
00060 Q_OBJECT
00061
public:
00062
enum ActionType { Application, ApplicationGlobal, Standard, Global };
00063
00072
KKeyChooser(
QWidget* parent, ActionType type = Application,
bool bAllowLetterShortcuts =
true );
00078
KKeyChooser(
KActionCollection* coll,
QWidget* parent,
bool bAllowLetterShortcuts =
true );
00079
KKeyChooser(
KAccel* actions,
QWidget* parent,
bool bAllowLetterShortcuts =
true );
00080
KKeyChooser(
KGlobalAccel* actions,
QWidget* parent );
00081
KKeyChooser(
KShortcutList*,
QWidget* parent, ActionType type = Application,
bool bAllowLetterShortcuts =
true );
00082
00083
virtual ~
KKeyChooser();
00084
00089
bool insert(
KActionCollection* );
00096
bool insert(
KActionCollection *,
const QString &title);
00097
00098
void syncToConfig(
const QString& sConfigGroup,
KConfigBase* pConfig,
bool bClearUnset );
00099
00104
void commitChanges();
00105
00112
void save();
00113
00127
static bool checkGlobalShortcutsConflict(
const KShortcut& cut,
bool warnUser,
QWidget* parent );
00128
00142
static bool checkStandardShortcutsConflict(
const KShortcut& cut,
bool warnUser,
QWidget* parent );
00143
00144 signals:
00148
void keyChange();
00149
00150
public slots:
00154
void allDefault();
00155
00161
void setPreferFourModifierKeys(
bool preferFourModifierKeys );
00162
00163
00164
protected:
00165
enum { NoKey = 1, DefaultKey, CustomKey };
00166
00167
void initGUI( ActionType type,
bool bAllowLetterShortcuts );
00168
bool insert(
KAccel* );
00169
bool insert(
KGlobalAccel* );
00170
bool insert(
KShortcutList* );
00172
void buildListView( uint iList,
const QString &title = QString::null );
00173
00174
void readGlobalKeys();
00175
00176
void updateButtons();
00177
void fontChange(
const QFont& _font );
00178
void setShortcut(
const KShortcut& cut );
00179
bool isKeyPresent(
const KShortcut& cut,
bool warnuser =
true );
00180
bool isKeyPresentLocally(
const KShortcut& cut, KKeyChooserItem* ignoreItem,
const QString& warnText );
00181
void _warning(
const KKeySequence& seq,
QString sAction,
QString sTitle );
00182
00183
protected slots:
00184
void slotNoKey();
00185
void slotDefaultKey();
00186
void slotCustomKey();
00187
void slotListItemSelected(
QListViewItem *item );
00188
void capturedShortcut(
const KShortcut& cut );
00189
void slotSettingsChanged(
int );
00190
void slotListItemDoubleClicked (
QListViewItem * ipoQListViewItem,
const QPoint & ipoQPoint,
int c );
00191
00192
protected:
00193 ActionType m_type;
00194
bool m_bAllowLetterShortcuts;
00195
bool m_bAllowWinKey;
00196
00197
00198
bool m_bPreferFourModifierKeys;
00199
00200
QRadioButton* m_prbNone;
00201
QRadioButton* m_prbDef;
00202
QRadioButton* m_prbCustom;
00203
00204
private:
00205
bool isKeyPresentLocally(
const KShortcut& cut, KKeyChooserItem* ignoreItem,
bool bWarnUser );
00206
static bool promptForReassign(
const KKeySequence& cut,
const QString& sAction, ActionType action,
QWidget* parent );
00207
00208
00209
static void removeStandardShortcut(
const QString& name,
KKeyChooser* chooser,
const KShortcut &origCut,
const KShortcut &cut );
00210
00211
00212
static void removeGlobalShortcut(
const QString& name,
KKeyChooser* chooser,
const KShortcut &origCut,
const KShortcut &cut );
00213
static void readGlobalKeys(
QMap< QString, KShortcut >& map );
00214
static bool checkGlobalShortcutsConflict(
const KShortcut& cut,
bool bWarnUser,
QWidget* parent,
00215
const QMap< QString, KShortcut >& map,
const QString& ignoreAction );
00216
00217
bool removeShortcut(
const QString& name,
const KShortcut &cut );
00218
00219
private slots:
00220
void captureCurrentItem();
00221
00222
#ifndef KDE_NO_COMPAT
00223
public:
00227
KKeyChooser(
KAccel* actions,
QWidget* parent,
00228
bool bCheckAgainstStdKeys,
00229
bool bAllowLetterShortcuts,
00230
bool bAllowWinKey =
false );
00234
KKeyChooser(
KGlobalAccel* actions,
QWidget* parent,
00235
bool bCheckAgainstStdKeys,
00236
bool bAllowLetterShortcuts,
00237
bool bAllowWinKey =
false );
00238
00239
public slots:
00244
void listSync();
00245
00246
#endif
00247
protected:
00248
virtual void virtual_hook(
int id,
void* data );
00249
private:
00250
class KKeyChooserPrivate *d;
00251
friend class KKeyDialog;
00252 };
00253
typedef KKeyChooser KKeyChooser;
00254
00271 class KKeyDialog :
public KDialogBase
00272 {
00273 Q_OBJECT
00274
00275
public:
00281
KKeyDialog(
bool bAllowLetterShortcuts =
true,
QWidget* parent = 0,
const char* name = 0 );
00282
00286
virtual ~KKeyDialog();
00287
00296
bool insert(
KActionCollection* );
00297
00310
bool insert(
KActionCollection *,
const QString &title);
00311
00312
bool configure(
bool bSaveSettings =
true );
00313
00319
void commitChanges();
00320
00328
static int configure(
KActionCollection* coll,
QWidget* parent = 0,
bool bSaveSettings =
true );
00329
00335
static int configure(
KAccel* keys,
QWidget* parent = 0,
bool bSaveSettings =
true );
00336
00341
static int configure(
KGlobalAccel* keys,
QWidget* parent = 0,
bool bSaveSettings =
true );
00342
00343
00355
static int configure(
KActionCollection* coll,
bool bAllowLetterShortcuts,
QWidget* parent = 0,
bool bSaveSettings =
true );
00356
00361
static int configure(
KAccel* keys,
bool bAllowLetterShortcuts,
QWidget* parent = 0,
bool bSaveSettings =
true );
00362
00367
static int configure(
KGlobalAccel* keys,
bool bAllowLetterShortcuts,
QWidget* parent = 0,
bool bSaveSettings =
true );
00368
00373 static KDE_DEPRECATED
int configureKeys(
KAccel* keys,
bool save_settings =
true,
QWidget* parent = 0 )
00374 {
return configure( keys, parent, save_settings ); }
00379 static KDE_DEPRECATED
int configureKeys(
KGlobalAccel* keys,
bool save_settings =
true,
QWidget* parent = 0 )
00380 {
return configure( keys, parent, save_settings ); }
00385 static KDE_DEPRECATED
int configureKeys(
KActionCollection* coll,
const QString& ,
00386
bool save_settings =
true,
QWidget* parent = 0 )
00387 {
return configure( coll, parent, save_settings ); }
00388
00389
private:
00390
KKeyDialog( KKeyChooser::ActionType,
bool bAllowLetterShortcuts =
true,
QWidget* parent = 0,
const char* name = 0 );
00391
00392
protected:
00393
virtual void virtual_hook(
int id,
void* data );
00394
00395
private:
00396
class KKeyDialogPrivate* d;
00397 KKeyChooser* m_pKeyChooser;
00398 };
00399
00400
#endif // __KKEYDIALOG_H__
This file is part of the documentation for kdeui Library Version 3.3.0.