00001 #ifndef _KEY_ACTION_H_
00002 #define _KEY_ACTION_H_
00003
00004 #include <qobject.h>
00005 #include <qwindowsystem_qws.h>
00006 #include <qtimer.h>
00007 #include <qpe/power.h>
00008 #include "KeyMappings.h"
00009 #include "KeyModifiers.h"
00010 #include "KeyExtensions.h"
00011 #include "KeyRepeater.h"
00012 #include "ConfigEx.h"
00013
00014 class KeyAction : public QObject
00015 {
00016 Q_OBJECT
00017 public:
00018 KeyAction();
00019 virtual ~KeyAction();
00020
00021 void setKeyMappings(KeyMappings* map)
00022 {
00023 m_pMappings = map;
00024 }
00025 void setKeyModifiers(KeyModifiers* mod)
00026 {
00027 m_pModifiers = mod;
00028 }
00029 void setKeyExtensions(KeyExtensions* ext)
00030 {
00031 m_pExtensions = ext;
00032 }
00033 void setKeyRepeater(KeyRepeater* rep)
00034 {
00035 m_pRepeater = rep;
00036 connect(m_pRepeater, SIGNAL(keyEvent(int,int,int,bool,bool)),
00037 this, SLOT(sendKeyEvent(int,int,int,bool,bool)));
00038 }
00039 void setAction(int unicode, int keycode, int modifiers,
00040 bool isPress, bool autoRepeat);
00041 bool doAction();
00042
00043 void enable(){
00044 init();
00045 m_enable = true;
00046 };
00047 void disable(){
00048 m_enable = false;
00049 };
00050 void setCapture(bool enable){
00051 m_capture = enable;
00052 }
00053
00054 void setHook(const QCString& s){
00055 m_hookChannel = s;
00056 }
00057 private:
00058 int m_unicode;
00059 int m_keycode;
00060 int m_modifiers;
00061 bool m_isPress;
00062 bool m_autoRepeat;
00063
00064 bool m_capture;
00065 bool m_enable;
00066 int m_presscnt;
00067
00068 int m_keep_toggle_code;
00069 bool m_keepToggle;
00070 bool m_check;
00071 QValueList<int> m_excludeKeys;
00072
00073 QCString m_hookChannel;
00074
00075 KeyMappings* m_pMappings;
00076 KeyModifiers* m_pModifiers;
00077 KeyExtensions* m_pExtensions;
00078 KeyRepeater* m_pRepeater;
00079
00080 void init();
00081 bool checkState();
00082 private slots:
00083 void sendKeyEvent(int unicode, int keycode, int modifiers,
00084 bool isPress, bool autoRepeat);
00085 };
00086
00087 #endif