-rw-r--r-- | core/launcher/serverapp.h | 73 |
1 files changed, 61 insertions, 12 deletions
diff --git a/core/launcher/serverapp.h b/core/launcher/serverapp.h index 60d9c41..0a3259a 100644 --- a/core/launcher/serverapp.h +++ b/core/launcher/serverapp.h | |||
@@ -31,16 +31,38 @@ | |||
31 | #include "shutdownimpl.h" | 31 | #include "shutdownimpl.h" |
32 | 32 | ||
33 | class PowerStatus; | 33 | class PowerStatus; |
34 | class DesktopPowerAlerter; | 34 | class DesktopPowerAlerter; |
35 | class DeviceButton; | ||
36 | 35 | ||
37 | class KeyFilter : public QObject, public QWSServer::KeyboardFilter { | 36 | class OpieScreenSaver; |
37 | namespace Opie { | ||
38 | class ODeviceButton; | ||
39 | } | ||
40 | |||
41 | struct QCopKeyRegister { | ||
42 | QCopKeyRegister(); | ||
43 | QCopKeyRegister( int k, const QCString&, const QCString& ); | ||
44 | int keyCode()const; | ||
45 | QCString channel()const; | ||
46 | QCString message()const; | ||
47 | inline bool send(); | ||
48 | |||
49 | private: | ||
50 | int m_keyCode; | ||
51 | QCString m_channel, m_message; | ||
52 | }; | ||
53 | |||
54 | typedef QMap<int, QCopKeyRegister> KeyRegisterList; | ||
55 | |||
56 | class KeyFilter : public QObject { | ||
38 | Q_OBJECT | 57 | Q_OBJECT |
39 | public: | 58 | public: |
40 | KeyFilter(QObject* parent); | 59 | KeyFilter(QObject* parent); |
41 | bool filter(int unicode, int keycode, int modifiers, bool press, | 60 | void registerKey( const QCopKeyRegister& ); |
42 | bool autoRepeat); | 61 | void unregisterKey( const QCopKeyRegister& ); |
62 | bool checkButtonAction( bool, int, int, int ); | ||
63 | |||
64 | |||
43 | 65 | ||
44 | protected: | 66 | protected: |
45 | void timerEvent(QTimerEvent*); | 67 | void timerEvent(QTimerEvent*); |
46 | 68 | ||
@@ -50,13 +72,16 @@ signals: | |||
50 | void backlight(); | 72 | void backlight(); |
51 | void symbol(); | 73 | void symbol(); |
52 | void numLockStateToggle(); | 74 | void numLockStateToggle(); |
53 | void capsLockStateToggle(); | 75 | void capsLockStateToggle(); |
54 | void activate(const DeviceButton*,bool); | 76 | void activate(const Opie::ODeviceButton*,bool); |
77 | |||
55 | 78 | ||
56 | private: | 79 | private: |
80 | inline bool keyRegistered( int key ); | ||
57 | int held_tid; | 81 | int held_tid; |
58 | const DeviceButton* heldButton; | 82 | const Opie::ODeviceButton* heldButton; |
83 | KeyRegisterList m_keys; | ||
59 | }; | 84 | }; |
60 | 85 | ||
61 | class ServerApplication : public QPEApplication | 86 | class ServerApplication : public QPEApplication |
62 | { | 87 | { |
@@ -69,22 +94,32 @@ public: | |||
69 | static bool allowRestart; | 94 | static bool allowRestart; |
70 | static bool screenLocked(); | 95 | static bool screenLocked(); |
71 | static void login(bool at_poweron); | 96 | static void login(bool at_poweron); |
72 | 97 | ||
98 | static void switchLCD ( bool on ); // only for togglePower in Desktop | ||
99 | static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar | ||
100 | |||
73 | void restart(); | 101 | void restart(); |
74 | 102 | ||
75 | signals: | 103 | signals: |
104 | void menu(); | ||
76 | void home(); | 105 | void home(); |
77 | void launch(); | 106 | void launch(); |
78 | void power(); | 107 | void power(); |
79 | void backlight(); | 108 | void backlight(); |
80 | void symbol(); | 109 | void symbol(); |
81 | void numLockStateToggle(); | 110 | void numLockStateToggle(); |
82 | void capsLockStateToggle(); | 111 | void capsLockStateToggle(); |
83 | void prepareForRestart(); | 112 | void prepareForRestart(); |
84 | void activate(const DeviceButton*,bool); | 113 | void activate(const Opie::ODeviceButton*,bool); |
114 | |||
115 | public slots: | ||
116 | virtual void systemMessage( const QCString& msg, const QByteArray& ); | ||
117 | virtual void launcherMessage( const QCString& msg, const QByteArray& ); | ||
118 | void rereadVolumes(); | ||
85 | 119 | ||
86 | protected: | 120 | protected: |
121 | bool eventFilter( QObject*, QEvent* ); | ||
87 | #ifdef Q_WS_QWS | 122 | #ifdef Q_WS_QWS |
88 | bool qwsEventFilter( QWSEvent * ); | 123 | bool qwsEventFilter( QWSEvent * ); |
89 | #endif | 124 | #endif |
90 | void shutdown(); | 125 | void shutdown(); |
@@ -94,20 +129,34 @@ protected: | |||
94 | void screenClick(bool press); | 129 | void screenClick(bool press); |
95 | 130 | ||
96 | protected slots: | 131 | protected slots: |
97 | void shutdown(ShutdownImpl::Type); | 132 | void shutdown(ShutdownImpl::Type); |
98 | void psTimeout(); | 133 | void apmTimeout(); |
99 | void showSafeMode(); | 134 | void showSafeMode(); |
100 | void clearSafeMode(); | 135 | void clearSafeMode(); |
101 | void togglePower(); | 136 | void togglePower(); |
102 | void toggleLight(); | 137 | void toggleLight(); |
103 | void rereadVolumes(); | 138 | |
139 | private: | ||
140 | static ServerApplication *me (); | ||
141 | void reloadPowerWarnSettings(); | ||
142 | KeyFilter *kf; | ||
143 | |||
104 | 144 | ||
105 | private: | 145 | private: |
106 | DesktopPowerAlerter *pa; | 146 | DesktopPowerAlerter *pa; |
107 | PowerStatus *ps; | 147 | PowerStatus *m_ps, *m_ps_last; |
108 | bool keyclick; | 148 | OpieScreenSaver *m_screensaver; |
109 | bool touchclick; | 149 | QTimer *m_apm_timer; |
150 | QDateTime m_suspendTime; | ||
151 | int m_powerVeryLow; | ||
152 | int m_powerCritical; | ||
153 | int m_currentPowerLevel; | ||
154 | |||
155 | bool m_keyclick_sound : 1; | ||
156 | bool m_screentap_sound : 1; | ||
157 | bool m_alarm_sound : 1; | ||
158 | |||
110 | 159 | ||
111 | friend class KeyFilter; | 160 | friend class KeyFilter; |
112 | }; | 161 | }; |
113 | 162 | ||