00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _KACCEL_H
00021 #define _KACCEL_H
00022
00023 #include <qaccel.h>
00024 #include <kshortcut.h>
00025 #include <kstdaccel.h>
00026 #include "kdelibs_export.h"
00027
00028 class QPopupMenu;
00029 class QWidget;
00030 class KAccelAction;
00031 class KAccelActions;
00032 class KConfigBase;
00033
00034 class KAccelPrivate;
00093 class KDECORE_EXPORT KAccel : public QAccel
00094 {
00095 Q_OBJECT
00096 public:
00104 KAccel( QWidget* pParent, const char* psName = 0 );
00105
00113 KAccel( QWidget* watch, QObject* parent, const char* psName = 0 );
00114 virtual ~KAccel();
00115
00121 KAccelActions& actions();
00122
00128 const KAccelActions& actions() const;
00129
00134 bool isEnabled();
00135
00140 void setEnabled( bool bEnabled );
00141
00152 bool setAutoUpdate( bool bAuto );
00153
00175 KAccelAction* insert( const QString& sAction, const QString& sLabel, const QString& sWhatsThis,
00176 const KShortcut& cutDef,
00177 const QObject* pObjSlot, const char* psMethodSlot,
00178 bool bConfigurable = true, bool bEnabled = true );
00183 KAccelAction* insert( const QString& sAction, const QString& sLabel, const QString& sWhatsThis,
00184 const KShortcut& cutDef3, const KShortcut& cutDef4,
00185 const QObject* pObjSlot, const char* psMethodSlot,
00186 bool bConfigurable = true, bool bEnabled = true );
00204 KAccelAction* insert( const char* psAction, const KShortcut& cutDef,
00205 const QObject* pObjSlot, const char* psMethodSlot,
00206 bool bConfigurable = true, bool bEnabled = true );
00213 KAccelAction* insert( KStdAccel::StdAccel id,
00214 const QObject* pObjSlot, const char* psMethodSlot,
00215 bool bConfigurable = true, bool bEnabled = true );
00216
00223 bool remove( const QString& sAction );
00224
00233 bool updateConnections();
00234
00240 const KShortcut& shortcut( const QString& sAction ) const;
00241
00248 bool setShortcut( const QString& sAction, const KShortcut &shortcut );
00249
00258 bool setSlot( const QString& sAction, const QObject* pObjSlot, const char* psMethodSlot );
00265 bool setEnabled( const QString& sAction, bool bEnabled );
00266
00272 const QString& configGroup() const;
00273
00279 void setConfigGroup( const QString &name );
00280
00292 bool readSettings( KConfigBase* pConfig = 0 );
00301 bool writeSettings( KConfigBase* pConfig = 0 ) const;
00302
00306 void emitKeycodeChanged();
00307
00308 signals:
00312 void keycodeChanged();
00313
00314 #ifndef KDE_NO_COMPAT
00315 public:
00316
00320 bool insertItem( const QString& sLabel, const QString& sAction,
00321 const char* psKey,
00322 int nIDMenu = 0, QPopupMenu* pMenu = 0, bool bConfigurable = true ) KDE_DEPRECATED;
00326 bool insertItem( const QString& sLabel, const QString& sAction,
00327 int key,
00328 int nIDMenu = 0, QPopupMenu* pMenu = 0, bool bConfigurable = true ) KDE_DEPRECATED;
00332 bool insertStdItem( KStdAccel::StdAccel id, const QString& descr = QString::null ) KDE_DEPRECATED;
00336 bool connectItem( const QString& sAction, const QObject* pObjSlot, const char* psMethodSlot, bool bActivate = true ) KDE_DEPRECATED;
00341 KDE_DEPRECATED bool connectItem( KStdAccel::StdAccel accel, const QObject* pObjSlot, const char* psMethodSlot )
00342 { return insert( accel, pObjSlot, psMethodSlot ); }
00346 bool removeItem( const QString& sAction ) KDE_DEPRECATED;
00350 bool setItemEnabled( const QString& sAction, bool bEnable ) KDE_DEPRECATED;
00354 void changeMenuAccel( QPopupMenu *menu, int id, const QString& action ) KDE_DEPRECATED;
00358 void changeMenuAccel( QPopupMenu *menu, int id, KStdAccel::StdAccel accel ) KDE_DEPRECATED;
00362 static int stringToKey( const QString& ) KDE_DEPRECATED;
00363
00371 int currentKey( const QString& action ) const KDE_DEPRECATED;
00372
00379 QString findKey( int key ) const KDE_DEPRECATED;
00380 #endif // !KDE_NO_COMPAT
00381
00382 protected:
00384 virtual void virtual_hook( int id, void* data );
00385 private:
00386 class KAccelPrivate* d;
00387 friend class KAccelPrivate;
00388 };
00389
00390 #endif // _KACCEL_H