• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kdeui

kkeydialog.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1997 Nicolas Hadacek <hadacek@kde.org>
00003     Copyright (C) 2001,2001 Ellis Whitehead <ellis@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
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 KDEUI_EXPORT 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 );
00080     KKeyChooser( KActionCollection* coll, QWidget* parent, bool bAllowLetterShortcuts = true );
00081 
00082     KKeyChooser( KAccel* actions, QWidget* parent, bool bAllowLetterShortcuts = true );
00083     KKeyChooser( KGlobalAccel* actions, QWidget* parent );
00084     KKeyChooser( KShortcutList*, QWidget* parent, ActionType type = Application, bool bAllowLetterShortcuts = true );
00085 
00086     virtual ~KKeyChooser();
00087 
00092     bool insert( KActionCollection* ); // #### KDE4 : remove me
00099     bool insert( KActionCollection *, const QString &title);
00100 
00101     void syncToConfig( const QString& sConfigGroup, KConfigBase* pConfig, bool bClearUnset );
00102 
00107     void commitChanges();
00108 
00115     void save();
00116 
00130         static bool checkGlobalShortcutsConflict( const KShortcut& cut, bool warnUser, QWidget* parent );
00131 
00145         static bool checkStandardShortcutsConflict( const KShortcut& cut, bool warnUser, QWidget* parent );
00146 
00147  signals:
00151     void keyChange();
00152 
00153  public slots:
00157     void allDefault();
00158 
00164     void setPreferFourModifierKeys( bool preferFourModifierKeys );
00165 
00166  // KDE4 a lot of stuff in this class should be probably private:
00167  protected:
00168     enum { NoKey = 1, DefaultKey, CustomKey };
00169 
00170     void initGUI( ActionType type, bool bAllowLetterShortcuts );
00171     bool insert( KAccel* );
00172     bool insert( KGlobalAccel* );
00173     bool insert( KShortcutList* );
00175     void buildListView( uint iList, const QString &title = QString::null );
00176 
00177     void readGlobalKeys();
00178 
00179     void updateButtons();
00180     void fontChange( const QFont& _font );
00181     void setShortcut( const KShortcut& cut );
00182     bool isKeyPresent( const KShortcut& cut, bool warnuser = true );
00183         bool isKeyPresentLocally( const KShortcut& cut, KKeyChooserItem* ignoreItem, const QString& warnText );
00184     void _warning( const KKeySequence& seq, QString sAction, QString sTitle );
00185 
00186  protected slots:
00187     void slotNoKey();
00188     void slotDefaultKey();
00189     void slotCustomKey();
00190     void slotListItemSelected( QListViewItem *item );
00191     void capturedShortcut( const KShortcut& cut );
00192         void slotSettingsChanged( int );
00193         void slotListItemDoubleClicked ( QListViewItem * ipoQListViewItem, const QPoint & ipoQPoint, int c );
00194 
00195  protected:
00196     ActionType m_type;
00197     bool m_bAllowLetterShortcuts;
00198     bool m_bAllowWinKey; // unused KDE4 remove
00199     // When set, pressing the 'Default' button will select the aDefaultKeycode4,
00200     //  otherwise aDefaultKeycode.
00201     bool m_bPreferFourModifierKeys;
00202 
00203     QRadioButton* m_prbNone;
00204     QRadioButton* m_prbDef;
00205     QRadioButton* m_prbCustom;
00206 
00207  private:
00208         bool isKeyPresentLocally( const KShortcut& cut, KKeyChooserItem* ignoreItem, bool bWarnUser );
00209         static bool promptForReassign( const KKeySequence& cut, const QString& sAction, ActionType action, QWidget* parent );
00210         // Remove the key sequences contained in cut from the standard shortcut @p name
00211         // which currently has @p origCut as shortcut.
00212         static void removeStandardShortcut( const QString& name, KKeyChooser* chooser, const KShortcut &origCut, const KShortcut &cut );
00213         // Remove the key sequences contained in cut from the global shortcut @p name
00214         // which currently has @p origCut as shortcut.
00215         static void removeGlobalShortcut( const QString& name, KKeyChooser* chooser, const KShortcut &origCut, const KShortcut &cut );
00216         static void readGlobalKeys( QMap< QString, KShortcut >& map );
00217         static bool checkGlobalShortcutsConflict( const KShortcut& cut, bool bWarnUser, QWidget* parent,
00218             const QMap< QString, KShortcut >& map, const QString& ignoreAction );
00219         // Remove the key sequences contained in cut from this item
00220         bool removeShortcut( const QString& name, const KShortcut &cut );
00221 
00222 private slots:
00223         void captureCurrentItem();
00224 
00225 #ifndef KDE_NO_COMPAT
00226  public:
00230     KKeyChooser( KAccel* actions, QWidget* parent,
00231             bool bCheckAgainstStdKeys,
00232             bool bAllowLetterShortcuts,
00233             bool bAllowWinKey = false );
00237     KKeyChooser( KGlobalAccel* actions, QWidget* parent,
00238             bool bCheckAgainstStdKeys,
00239             bool bAllowLetterShortcuts,
00240             bool bAllowWinKey = false );
00241 
00242  public slots:
00247     void listSync();
00248 
00249 #endif
00250  protected:
00251     virtual void virtual_hook( int id, void* data );
00252  private:
00253     class KKeyChooserPrivate *d;
00254     friend class KKeyDialog;
00255 };
00256 typedef KKeyChooser KKeyChooser;
00257 
00274 class KDEUI_EXPORT KKeyDialog : public KDialogBase
00275 {
00276     Q_OBJECT
00277 
00278 public:
00284     KKeyDialog( bool bAllowLetterShortcuts = true, QWidget* parent = 0, const char* name = 0 );
00285 
00289     virtual ~KKeyDialog();
00290 
00299     bool insert( KActionCollection* ); // #### KDE4: remove me
00300 
00313         bool insert(KActionCollection *, const QString &title);
00314 
00319     bool configure( bool bSaveSettings = true );
00320 
00326     void commitChanges();
00327 
00335     static int configure( KActionCollection* coll, QWidget* parent = 0, bool bSaveSettings = true );
00336 
00342     static int configure( KAccel* keys, QWidget* parent = 0, bool bSaveSettings = true );
00343 
00348     static int configure( KGlobalAccel* keys, QWidget* parent = 0, bool bSaveSettings = true );
00349 
00350 
00362     static int configure( KActionCollection* coll, bool bAllowLetterShortcuts, QWidget* parent = 0, bool bSaveSettings = true ); // BCI: merge with bAllowLetterShortcuts = true
00363 
00368     static int configure( KAccel* keys, bool bAllowLetterShortcuts, QWidget* parent = 0, bool bSaveSettings = true ); // BCI: merge with bAllowLetterShortcuts = true
00369 
00374     static int configure( KGlobalAccel* keys, bool bAllowLetterShortcuts, QWidget* parent = 0, bool bSaveSettings = true ); // BCI: merge with bAllowLetterShortcuts = true
00375 
00380     static KDE_DEPRECATED int configureKeys( KAccel* keys, bool save_settings = true, QWidget* parent = 0 )
00381         { return configure( keys, parent, save_settings ); }
00386     static KDE_DEPRECATED int configureKeys( KGlobalAccel* keys, bool save_settings = true, QWidget* parent = 0 )
00387         { return configure( keys, parent, save_settings ); }
00392     static KDE_DEPRECATED int configureKeys( KActionCollection* coll, const QString& /*xmlfile*/,
00393         bool save_settings = true, QWidget* parent = 0 )
00394         { return configure( coll, parent, save_settings ); }
00395 
00396 private:
00397     KKeyDialog( KKeyChooser::ActionType, bool bAllowLetterShortcuts = true, QWidget* parent = 0, const char* name = 0 );
00398 
00399  protected:
00400     virtual void virtual_hook( int id, void* data );
00401 
00402  private:
00403     class KKeyDialogPrivate* d;
00404     KKeyChooser* m_pKeyChooser;
00405 };
00406 
00407 #endif // __KKEYDIALOG_H__

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal