KDECore
kshortcutlist.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KSHORTCUTLIST_H
00021 #define __KSHORTCUTLIST_H
00022
00023 #include <qglobal.h>
00024 #include <qstring.h>
00025 #include "kdelibs_export.h"
00026
00027 class QVariant;
00028 class KConfigBase;
00029 class KInstance;
00030 class KKeySequence;
00031 class KShortcut;
00032
00033
00034
00035
00036
00037
00048 class KDECORE_EXPORT KShortcutList
00049 {
00050 public:
00054 KShortcutList();
00055 virtual ~KShortcutList();
00056
00061 virtual uint count() const = 0;
00062
00068 virtual QString name( uint index ) const = 0;
00069
00075 virtual QString label( uint index ) const = 0;
00076
00082 virtual QString whatsThis( uint index ) const = 0;
00083
00084
00085
00086
00093 virtual const KShortcut& shortcut( uint index ) const = 0;
00094
00101 virtual const KShortcut& shortcutDefault( uint index ) const = 0;
00102
00108 virtual bool isConfigurable( uint index ) const = 0;
00109
00115 virtual bool setShortcut( uint index, const KShortcut &shortcut ) = 0;
00116
00123 virtual bool isGlobal( uint index ) const;
00124
00130 virtual int index( const QString& sName ) const;
00131
00137 virtual int index( const KKeySequence& keySeq ) const;
00138
00143 virtual const KInstance* instance() const;
00144
00145
00146 enum Other { };
00148 virtual QVariant getOther( Other, uint index ) const = 0;
00150 virtual bool setOther( Other, uint index, QVariant ) = 0;
00151
00156 virtual bool save() const = 0;
00157
00165 virtual bool readSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
00166
00176 virtual bool writeSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0,
00177 bool bWriteAll = false, bool bGlobal = false ) const;
00178
00179 protected:
00181 virtual void virtual_hook( int id, void* data );
00182 private:
00183 class KShortcutListPrivate* d;
00184 };
00185
00186
00187
00188
00189
00190 class KAccel;
00191 class KAccelActions;
00192 class KGlobalAccel;
00193
00198 class KDECORE_EXPORT KAccelShortcutList : public KShortcutList
00199 {
00200 public:
00205 KAccelShortcutList( KAccel* accel );
00206
00212 KAccelShortcutList( KGlobalAccel* accel );
00213
00222 KAccelShortcutList( KAccelActions &actions, bool bGlobal );
00223 virtual ~KAccelShortcutList();
00224
00225 virtual uint count() const;
00226 virtual QString name( uint index ) const;
00227 virtual QString label( uint index ) const;
00228 virtual QString whatsThis( uint index ) const;
00229 virtual const KShortcut& shortcut( uint index ) const;
00230 virtual const KShortcut& shortcutDefault( uint index ) const;
00231 virtual bool isConfigurable( uint index ) const;
00232 virtual bool setShortcut( uint index , const KShortcut& shortcut );
00233 virtual bool isGlobal( uint index ) const;
00234
00236 virtual QVariant getOther( Other, uint index ) const;
00238 virtual bool setOther( Other, uint index, QVariant );
00239
00240 virtual bool save() const;
00241
00242 protected:
00244 KAccelActions& m_actions;
00246 bool m_bGlobal;
00247
00248 protected:
00249 virtual void virtual_hook( int id, void* data );
00250 private:
00251 class KAccelShortcutListPrivate* d;
00252 };
00253
00254 namespace KStdAccel {
00255
00256
00257
00258
00263 class KDECORE_EXPORT ShortcutList : public KShortcutList
00264 {
00265 public:
00269 ShortcutList();
00270 virtual ~ShortcutList();
00271
00272 virtual uint count() const;
00273 virtual QString name( uint index ) const;
00274 virtual QString label( uint index ) const;
00275 virtual QString whatsThis( uint index ) const;
00276 virtual const KShortcut& shortcut( uint index ) const;
00277 virtual const KShortcut& shortcutDefault( uint index ) const;
00278 virtual bool isConfigurable( uint index ) const;
00279 virtual bool setShortcut( uint index , const KShortcut& shortcut );
00280
00282 virtual QVariant getOther( Other, uint index ) const;
00284 virtual bool setOther( Other, uint index, QVariant );
00285
00286 virtual bool save() const;
00287
00288 protected:
00289 virtual void virtual_hook( int id, void* data );
00290 private:
00291 class ShortcutListPrivate* d;
00292 };
00293 }
00294
00295 #endif // __KSHORTCUTLIST_H