-rw-r--r-- | core/launcher/desktop.cpp | 37 | ||||
-rw-r--r-- | core/launcher/desktop.h | 23 |
2 files changed, 36 insertions, 24 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 4926b97..33bea36 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -1,1145 +1,1156 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "desktop.h" | 21 | #include "desktop.h" |
22 | #include "info.h" | 22 | #include "info.h" |
23 | #include "launcher.h" | 23 | #include "launcher.h" |
24 | //#include "mrulist.h" | 24 | //#include "mrulist.h" |
25 | #include "qcopbridge.h" | 25 | #include "qcopbridge.h" |
26 | #include "shutdownimpl.h" | 26 | #include "shutdownimpl.h" |
27 | #include "startmenu.h" | 27 | #include "startmenu.h" |
28 | #include "taskbar.h" | 28 | #include "taskbar.h" |
29 | #include "transferserver.h" | 29 | #include "transferserver.h" |
30 | #include "irserver.h" | 30 | #include "irserver.h" |
31 | #include "packageslave.h" | 31 | #include "packageslave.h" |
32 | 32 | ||
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/password.h> | 35 | #include <qpe/password.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/timeconversion.h> | 38 | #include <qpe/timeconversion.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/network.h> | 40 | #include <qpe/network.h> |
41 | #include <qpe/global.h> | 41 | #include <qpe/global.h> |
42 | 42 | ||
43 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) | 43 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) |
44 | #include <qpe/custom.h> | 44 | #include <qpe/custom.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #include <opie/odevice.h> | 47 | #include <opie/odevice.h> |
48 | 48 | ||
49 | #include <qgfx_qws.h> | 49 | #include <qgfx_qws.h> |
50 | #include <qmainwindow.h> | 50 | #include <qmainwindow.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qwindowsystem_qws.h> | 53 | #include <qwindowsystem_qws.h> |
54 | 54 | ||
55 | #include <qvaluelist.h> | 55 | #include <qvaluelist.h> |
56 | 56 | ||
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <fcntl.h> | 59 | #include <fcntl.h> |
60 | 60 | ||
61 | using namespace Opie; | 61 | using namespace Opie; |
62 | 62 | ||
63 | class QCopKeyRegister | 63 | class QCopKeyRegister |
64 | { | 64 | { |
65 | public: | 65 | public: |
66 | QCopKeyRegister() : keyCode( 0 ) | 66 | QCopKeyRegister() : keyCode( 0 ) |
67 | { } | 67 | { } |
68 | QCopKeyRegister( int k, const QString &c, const QString &m ) | 68 | QCopKeyRegister( int k, const QString &c, const QString &m ) |
69 | : keyCode( k ), channel( c ), message( m ) | 69 | : keyCode( k ), channel( c ), message( m ) |
70 | { } | 70 | { } |
71 | 71 | ||
72 | int getKeyCode() const | 72 | int getKeyCode() const |
73 | { | 73 | { |
74 | return keyCode; | 74 | return keyCode; |
75 | } | 75 | } |
76 | QString getChannel() const | 76 | QString getChannel() const |
77 | { | 77 | { |
78 | return channel; | 78 | return channel; |
79 | } | 79 | } |
80 | QString getMessage() const | 80 | QString getMessage() const |
81 | { | 81 | { |
82 | return message; | 82 | return message; |
83 | } | 83 | } |
84 | 84 | ||
85 | private: | 85 | private: |
86 | int keyCode; | 86 | int keyCode; |
87 | QString channel, message; | 87 | QString channel, message; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 90 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
91 | KeyRegisterList keyRegisterList; | 91 | KeyRegisterList keyRegisterList; |
92 | 92 | ||
93 | static Desktop* qpedesktop = 0; | 93 | static Desktop* qpedesktop = 0; |
94 | static int loggedin = 0; | 94 | static int loggedin = 0; |
95 | static void login( bool at_poweron ) | 95 | static void login( bool at_poweron ) |
96 | { | 96 | { |
97 | if ( !loggedin ) { | 97 | if ( !loggedin ) { |
98 | Global::terminateBuiltin( "calibrate" ); | 98 | Global::terminateBuiltin( "calibrate" ); |
99 | Password::authenticate( at_poweron ); | 99 | Password::authenticate( at_poweron ); |
100 | loggedin = 1; | 100 | loggedin = 1; |
101 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 101 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | bool Desktop::screenLocked() | 105 | bool Desktop::screenLocked() |
106 | { | 106 | { |
107 | return loggedin == 0; | 107 | return loggedin == 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | 110 | /* |
111 | Priority is number of alerts that are needed to pop up | 111 | Priority is number of alerts that are needed to pop up |
112 | alert. | 112 | alert. |
113 | */ | 113 | */ |
114 | class DesktopPowerAlerter : public QMessageBox | 114 | class DesktopPowerAlerter : public QMessageBox |
115 | { | 115 | { |
116 | public: | 116 | public: |
117 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 117 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
118 | : QMessageBox( tr( "Battery Status" ), "Low Battery", | 118 | : QMessageBox( tr( "Battery Status" ), "Low Battery", |
119 | QMessageBox::Critical, | 119 | QMessageBox::Critical, |
120 | QMessageBox::Ok | QMessageBox::Default, | 120 | QMessageBox::Ok | QMessageBox::Default, |
121 | QMessageBox::NoButton, QMessageBox::NoButton, | 121 | QMessageBox::NoButton, QMessageBox::NoButton, |
122 | parent, name, FALSE ) | 122 | parent, name, FALSE ) |
123 | { | 123 | { |
124 | currentPriority = INT_MAX; | 124 | currentPriority = INT_MAX; |
125 | alertCount = 0; | 125 | alertCount = 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | void alert( const QString &text, int priority ); | 128 | void alert( const QString &text, int priority ); |
129 | void hideEvent( QHideEvent * ); | 129 | void hideEvent( QHideEvent * ); |
130 | private: | 130 | private: |
131 | int currentPriority; | 131 | int currentPriority; |
132 | int alertCount; | 132 | int alertCount; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 135 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
136 | { | 136 | { |
137 | alertCount++; | 137 | alertCount++; |
138 | if ( alertCount < priority ) | 138 | if ( alertCount < priority ) |
139 | return ; | 139 | return ; |
140 | if ( priority > currentPriority ) | 140 | if ( priority > currentPriority ) |
141 | return ; | 141 | return ; |
142 | currentPriority = priority; | 142 | currentPriority = priority; |
143 | setText( text ); | 143 | setText( text ); |
144 | show(); | 144 | show(); |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 148 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
149 | { | 149 | { |
150 | QMessageBox::hideEvent( e ); | 150 | QMessageBox::hideEvent( e ); |
151 | alertCount = 0; | 151 | alertCount = 0; |
152 | currentPriority = INT_MAX; | 152 | currentPriority = INT_MAX; |
153 | } | 153 | } |
154 | 154 | ||
155 | class QPEScreenSaver : public QWSScreenSaver | 155 | class QPEScreenSaver : public QWSScreenSaver |
156 | { | 156 | { |
157 | private: | 157 | private: |
158 | int LcdOn; | 158 | int LcdOn; |
159 | 159 | ||
160 | public: | 160 | public: |
161 | QPEScreenSaver() | 161 | QPEScreenSaver() |
162 | { | 162 | { |
163 | m_disable_suspend = 100; | 163 | m_disable_suspend = 100; |
164 | m_enable_dim = false; | 164 | m_enable_dim = false; |
165 | m_enable_lightoff = false; | 165 | m_enable_lightoff = false; |
166 | m_enable_onlylcdoff = false; | 166 | m_enable_onlylcdoff = false; |
167 | 167 | ||
168 | m_disable_suspend_ac = 100; | 168 | m_disable_suspend_ac = 100; |
169 | m_enable_dim_ac = false; | 169 | m_enable_dim_ac = false; |
170 | m_enable_lightoff_ac = false; | 170 | m_enable_lightoff_ac = false; |
171 | m_enable_onlylcdoff_ac = false; | 171 | m_enable_onlylcdoff_ac = false; |
172 | 172 | ||
173 | m_lcd_status = true; | 173 | m_lcd_status = true; |
174 | 174 | ||
175 | m_backlight_normal = -1; | 175 | m_backlight_normal = -1; |
176 | m_backlight_current = -1; | 176 | m_backlight_current = -1; |
177 | m_backlight_forcedoff = false; | 177 | m_backlight_forcedoff = false; |
178 | 178 | ||
179 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 179 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
180 | ODevice::inst ( )-> setDisplayStatus ( true ); | 180 | ODevice::inst ( )-> setDisplayStatus ( true ); |
181 | setBacklight ( -1 ); | 181 | setBacklight ( -1 ); |
182 | } | 182 | } |
183 | void restore() | 183 | void restore() |
184 | { | 184 | { |
185 | if ( !m_lcd_status ) { // We must have turned it off | 185 | if ( !m_lcd_status ) { // We must have turned it off |
186 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 186 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
187 | m_lcd_status = true; | 187 | m_lcd_status = true; |
188 | } | 188 | } |
189 | 189 | ||
190 | setBacklightInternal ( -1 ); | 190 | setBacklightInternal ( -1 ); |
191 | } | 191 | } |
192 | bool save( int level ) | 192 | bool save( int level ) |
193 | { | 193 | { |
194 | bool onAC = ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ); | 194 | bool onAC = ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ); |
195 | 195 | ||
196 | switch ( level ) { | 196 | switch ( level ) { |
197 | case 0: | 197 | case 0: |
198 | 198 | ||
199 | if ( m_disable_suspend_ac > 0 && m_enable_dim_ac && onAC ) { | 199 | if ( m_disable_suspend_ac > 0 && m_enable_dim_ac && onAC ) { |
200 | if ( m_backlight_current > 1 ) | 200 | if ( m_backlight_current > 1 ) |
201 | setBacklight( 1 ); // lowest non-off | 201 | setBacklight( 1 ); // lowest non-off |
202 | } else if ( m_disable_suspend > 0 && m_enable_dim ) { | 202 | } else if ( m_disable_suspend > 0 && m_enable_dim ) { |
203 | if ( m_backlight_current > 1 ) | 203 | if ( m_backlight_current > 1 ) |
204 | setBacklightInternal( 1 ); // lowest non-off | 204 | setBacklightInternal( 1 ); // lowest non-off |
205 | } | 205 | } |
206 | return true; | 206 | return true; |
207 | break; | 207 | break; |
208 | case 1: | 208 | case 1: |
209 | 209 | ||
210 | if ( m_disable_suspend_ac > 1 && m_enable_lightoff_ac && onAC ) { | 210 | if ( m_disable_suspend_ac > 1 && m_enable_lightoff_ac && onAC ) { |
211 | setBacklightInternal( 0 ); // off | 211 | setBacklightInternal( 0 ); // off |
212 | } else if ( m_disable_suspend > 1 && m_enable_lightoff ) { | 212 | } else if ( m_disable_suspend > 1 && m_enable_lightoff ) { |
213 | setBacklightInternal( 0 ); // off | 213 | setBacklightInternal( 0 ); // off |
214 | } | 214 | } |
215 | return true; | 215 | return true; |
216 | break; | 216 | break; |
217 | case 2: | 217 | case 2: |
218 | if ( m_enable_onlylcdoff_ac && onAC ) { | 218 | if ( m_enable_onlylcdoff_ac && onAC ) { |
219 | ODevice::inst ( ) -> setDisplayStatus ( false ); | 219 | ODevice::inst ( ) -> setDisplayStatus ( false ); |
220 | m_lcd_status = false; | 220 | m_lcd_status = false; |
221 | return true; | 221 | return true; |
222 | } | 222 | } |
223 | else if ( m_enable_onlylcdoff ) { | 223 | else if ( m_enable_onlylcdoff ) { |
224 | ODevice::inst ( ) -> setDisplayStatus ( false ); | 224 | ODevice::inst ( ) -> setDisplayStatus ( false ); |
225 | m_lcd_status = false; | 225 | m_lcd_status = false; |
226 | return true; | 226 | return true; |
227 | } | 227 | } |
228 | else // We're going to suspend the whole machine | 228 | else // We're going to suspend the whole machine |
229 | { | 229 | { |
230 | if ( ( m_disable_suspend_ac > 2 && onAC ) && ( !Network::networkOnline ( ) ) ) { | 230 | if ( ( m_disable_suspend_ac > 2 && onAC ) && ( !Network::networkOnline ( ) ) ) { |
231 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 231 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
232 | return true; | 232 | return true; |
233 | } | 233 | } |
234 | if ( ( m_disable_suspend > 2 ) && ( !Network::networkOnline ( ) ) ) { | 234 | if ( ( m_disable_suspend > 2 ) && ( !Network::networkOnline ( ) ) ) { |
235 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 235 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
236 | return true; | 236 | return true; |
237 | } | 237 | } |
238 | } | 238 | } |
239 | break; | 239 | break; |
240 | } | 240 | } |
241 | return false; | 241 | return false; |
242 | } | 242 | } |
243 | 243 | ||
244 | private: | 244 | private: |
245 | static int ssi( int interval, Config & config, const QString & enable, const QString & value, int def ) | 245 | static int ssi( int interval, Config & config, const QString & enable, const QString & value, int def ) |
246 | { | 246 | { |
247 | if ( !enable.isEmpty() && config.readNumEntry( enable, 0 ) == 0 ) | 247 | if ( !enable.isEmpty() && config.readNumEntry( enable, 0 ) == 0 ) |
248 | return 0; | 248 | return 0; |
249 | 249 | ||
250 | if ( interval < 0 ) { | 250 | if ( interval < 0 ) { |
251 | // Restore screen blanking and power saving state | 251 | // Restore screen blanking and power saving state |
252 | interval = config.readNumEntry( value, def ); | 252 | interval = config.readNumEntry( value, def ); |
253 | } | 253 | } |
254 | return interval; | 254 | return interval; |
255 | } | 255 | } |
256 | 256 | ||
257 | public: | 257 | public: |
258 | void setIntervals( int i1, int i2, int i3 ) | 258 | void setIntervals( int i1, int i2, int i3 ) |
259 | { | 259 | { |
260 | Config config( "qpe" ); | 260 | Config config( "qpe" ); |
261 | config.setGroup( "Screensaver" ); | 261 | config.setGroup( "Screensaver" ); |
262 | 262 | ||
263 | int v[ 4 ]; | 263 | int v[ 4 ]; |
264 | i1 = ssi( i1, config, "Dim", "Interval_Dim", 30 ); | 264 | i1 = ssi( i1, config, "Dim", "Interval_Dim", 30 ); |
265 | i2 = ssi( i2, config, "LightOff", "Interval_LightOff", 20 ); | 265 | i2 = ssi( i2, config, "LightOff", "Interval_LightOff", 20 ); |
266 | i3 = ssi( i3, config, "", "Interval", 60 ); | 266 | i3 = ssi( i3, config, "", "Interval", 60 ); |
267 | 267 | ||
268 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); | 268 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); |
269 | 269 | ||
270 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 270 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
271 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 271 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
272 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 272 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
273 | v [ 3 ] = 0; | 273 | v [ 3 ] = 0; |
274 | m_enable_dim = ( ( i1 != 0 ) ? config. readNumEntry ( "Dim", 1 ) : false ); | 274 | m_enable_dim = ( ( i1 != 0 ) ? config. readNumEntry ( "Dim", 1 ) : false ); |
275 | m_enable_lightoff = ( ( i2 != 0 ) ? config. readNumEntry ( "LightOff", 1 ) : false ); | 275 | m_enable_lightoff = ( ( i2 != 0 ) ? config. readNumEntry ( "LightOff", 1 ) : false ); |
276 | m_enable_onlylcdoff = config. readNumEntry ( "LcdOffOnly", 0 ); | 276 | m_enable_onlylcdoff = config. readNumEntry ( "LcdOffOnly", 0 ); |
277 | 277 | ||
278 | if ( !i1 && !i2 && !i3 ) | 278 | if ( !i1 && !i2 && !i3 ) |
279 | QWSServer::setScreenSaverInterval( 0 ); | 279 | QWSServer::setScreenSaverInterval( 0 ); |
280 | else | 280 | else |
281 | QWSServer::setScreenSaverIntervals( v ); | 281 | QWSServer::setScreenSaverIntervals( v ); |
282 | } | 282 | } |
283 | 283 | ||
284 | void setIntervalsAC( int i1, int i2, int i3 ) | 284 | void setIntervalsAC( int i1, int i2, int i3 ) |
285 | { | 285 | { |
286 | Config config( "qpe" ); | 286 | Config config( "qpe" ); |
287 | config.setGroup( "Screensaver" ); | 287 | config.setGroup( "Screensaver" ); |
288 | 288 | ||
289 | int v[ 4 ]; | 289 | int v[ 4 ]; |
290 | i1 = ssi( i1, config, "DimAC", "Interval_DimAC", 30 ); | 290 | i1 = ssi( i1, config, "DimAC", "Interval_DimAC", 30 ); |
291 | i2 = ssi( i2, config, "LightOffAC", "Interval_LightOffAC", 20 ); | 291 | i2 = ssi( i2, config, "LightOffAC", "Interval_LightOffAC", 20 ); |
292 | i3 = ssi( i3, config, "", "IntervalAC", 60 ); | 292 | i3 = ssi( i3, config, "", "IntervalAC", 60 ); |
293 | 293 | ||
294 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); | 294 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); |
295 | 295 | ||
296 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 296 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
297 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 297 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
298 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 298 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
299 | v [ 3 ] = 0; | 299 | v [ 3 ] = 0; |
300 | m_enable_dim_ac = ( ( i1 != 0 ) ? config.readNumEntry ( "DimAC", 1 ) : false ); | 300 | m_enable_dim_ac = ( ( i1 != 0 ) ? config.readNumEntry ( "DimAC", 1 ) : false ); |
301 | m_enable_lightoff_ac = ( ( i2 != 0 ) ? config.readNumEntry ( "LightOffAC", 1 ) : false ); | 301 | m_enable_lightoff_ac = ( ( i2 != 0 ) ? config.readNumEntry ( "LightOffAC", 1 ) : false ); |
302 | m_enable_onlylcdoff_ac = config.readNumEntry ( "LcdOffOnlyAC", 0 ); | 302 | m_enable_onlylcdoff_ac = config.readNumEntry ( "LcdOffOnlyAC", 0 ); |
303 | 303 | ||
304 | if ( !i1 && !i2 && !i3 ) | 304 | if ( !i1 && !i2 && !i3 ) |
305 | QWSServer::setScreenSaverInterval( 0 ); | 305 | QWSServer::setScreenSaverInterval( 0 ); |
306 | else | 306 | else |
307 | QWSServer::setScreenSaverIntervals( v ); | 307 | QWSServer::setScreenSaverIntervals( v ); |
308 | } | 308 | } |
309 | 309 | ||
310 | void setInterval ( int interval ) | 310 | void setInterval ( int interval ) |
311 | { | 311 | { |
312 | setIntervals ( -1, -1, interval ); | 312 | setIntervals ( -1, -1, interval ); |
313 | } | 313 | } |
314 | 314 | ||
315 | void setMode ( int mode ) | 315 | void setMode ( int mode ) |
316 | { | 316 | { |
317 | if ( mode > m_disable_suspend ) | 317 | if ( mode > m_disable_suspend ) |
318 | setInterval( -1 ); | 318 | setInterval( -1 ); |
319 | m_disable_suspend = mode; | 319 | m_disable_suspend = mode; |
320 | } | 320 | } |
321 | 321 | ||
322 | void setBacklight ( int bright ) | 322 | void setBacklight ( int bright ) |
323 | { | 323 | { |
324 | // Read from config | 324 | // Read from config |
325 | Config config ( "qpe" ); | 325 | Config config ( "qpe" ); |
326 | config. setGroup ( "Screensaver" ); | 326 | config. setGroup ( "Screensaver" ); |
327 | m_backlight_normal = config. readNumEntry ( "Brightness", 255 ); | 327 | m_backlight_normal = config. readNumEntry ( "Brightness", 255 ); |
328 | 328 | ||
329 | setBacklightInternal ( bright ); | 329 | setBacklightInternal ( bright ); |
330 | } | 330 | } |
331 | 331 | ||
332 | private: | 332 | private: |
333 | void setBacklightInternal ( int bright ) | 333 | void setBacklightInternal ( int bright ) |
334 | { | 334 | { |
335 | if ( bright == -3 ) { | 335 | if ( bright == -3 ) { |
336 | // Forced on | 336 | // Forced on |
337 | m_backlight_forcedoff = false; | 337 | m_backlight_forcedoff = false; |
338 | bright = -1; | 338 | bright = -1; |
339 | } | 339 | } |
340 | if ( m_backlight_forcedoff && bright != -2 ) | 340 | if ( m_backlight_forcedoff && bright != -2 ) |
341 | return ; | 341 | return ; |
342 | if ( bright == -2 ) { | 342 | if ( bright == -2 ) { |
343 | // Toggle between off and on | 343 | // Toggle between off and on |
344 | bright = m_backlight_current ? 0 : -1; | 344 | bright = m_backlight_current ? 0 : -1; |
345 | m_backlight_forcedoff = !bright; | 345 | m_backlight_forcedoff = !bright; |
346 | } | 346 | } |
347 | if ( bright == -1 ) | 347 | if ( bright == -1 ) |
348 | bright = m_backlight_normal; | 348 | bright = m_backlight_normal; |
349 | 349 | ||
350 | if ( bright != m_backlight_current ) { | 350 | if ( bright != m_backlight_current ) { |
351 | ODevice::inst ( )-> setDisplayBrightness ( bright ); | 351 | ODevice::inst ( )-> setDisplayBrightness ( bright ); |
352 | m_backlight_current = bright; | 352 | m_backlight_current = bright; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | public: | 356 | public: |
357 | void setDisplayState ( bool on ) | 357 | void setDisplayState ( bool on ) |
358 | { | 358 | { |
359 | if ( m_lcd_status != on ) { | 359 | if ( m_lcd_status != on ) { |
360 | ODevice::inst ( ) -> setDisplayStatus ( on ); | 360 | ODevice::inst ( ) -> setDisplayStatus ( on ); |
361 | m_lcd_status = on; | 361 | m_lcd_status = on; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | private: | 365 | private: |
366 | int m_disable_suspend; | 366 | int m_disable_suspend; |
367 | bool m_enable_dim; | 367 | bool m_enable_dim; |
368 | bool m_enable_lightoff; | 368 | bool m_enable_lightoff; |
369 | bool m_enable_onlylcdoff; | 369 | bool m_enable_onlylcdoff; |
370 | 370 | ||
371 | int m_disable_suspend_ac; | 371 | int m_disable_suspend_ac; |
372 | bool m_enable_dim_ac; | 372 | bool m_enable_dim_ac; |
373 | bool m_enable_lightoff_ac; | 373 | bool m_enable_lightoff_ac; |
374 | bool m_enable_onlylcdoff_ac; | 374 | bool m_enable_onlylcdoff_ac; |
375 | 375 | ||
376 | bool m_lcd_status; | 376 | bool m_lcd_status; |
377 | 377 | ||
378 | int m_backlight_normal; | 378 | int m_backlight_normal; |
379 | int m_backlight_current; | 379 | int m_backlight_current; |
380 | bool m_backlight_forcedoff; | 380 | bool m_backlight_forcedoff; |
381 | }; | 381 | }; |
382 | 382 | ||
383 | void DesktopApplication::switchLCD ( bool on ) | 383 | void DesktopApplication::switchLCD ( bool on ) |
384 | { | 384 | { |
385 | if ( qApp ) { | 385 | if ( qApp ) { |
386 | DesktopApplication *dapp = (DesktopApplication *) qApp; | 386 | DesktopApplication *dapp = (DesktopApplication *) qApp; |
387 | 387 | ||
388 | if ( dapp-> m_screensaver ) { | 388 | if ( dapp-> m_screensaver ) { |
389 | if ( on ) { | 389 | if ( on ) { |
390 | dapp-> m_screensaver-> setDisplayState ( true ); | 390 | dapp-> m_screensaver-> setDisplayState ( true ); |
391 | dapp-> m_screensaver-> setBacklight ( -3 ); | 391 | dapp-> m_screensaver-> setBacklight ( -3 ); |
392 | } | 392 | } |
393 | else { | 393 | else { |
394 | dapp-> m_screensaver-> setDisplayState ( false ); | 394 | dapp-> m_screensaver-> setDisplayState ( false ); |
395 | } | 395 | } |
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 401 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
402 | : QPEApplication( argc, argv, appType ) | 402 | : QPEApplication( argc, argv, appType ) |
403 | { | 403 | { |
404 | 404 | ||
405 | //FIXME, need also a method for setting different timer ( changed runtime ) | ||
406 | m_timer = new QTimer( this ); | 405 | m_timer = new QTimer( this ); |
407 | connect( m_timer, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); | 406 | connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) ); |
408 | Config cfg( "qpe" ); | 407 | Config cfg( "apm" ); |
409 | cfg.setGroup( "APM" ); | 408 | cfg.setGroup( "Warnings" ); |
410 | m_timer->start( cfg.readNumEntry( "check_interval", 10000 ) ); | 409 | m_timer->start( 5000 ); |
411 | m_powerVeryLow = cfg.readNumEntry( "power_verylow", 10 ); | 410 | //cfg.readNumEntry( "checkinterval", 10000 ) |
412 | m_powerCritical = cfg.readNumEntry( "power_critical", 5 ); | 411 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); |
412 | m_powerCritical = cfg.readNumEntry( "powercritical", 5 ); | ||
413 | ps = new PowerStatus; | 413 | ps = new PowerStatus; |
414 | pa = new DesktopPowerAlerter( 0 ); | 414 | pa = new DesktopPowerAlerter( 0 ); |
415 | 415 | ||
416 | channel = new QCopChannel( "QPE/Desktop", this ); | 416 | channel = new QCopChannel( "QPE/Desktop", this ); |
417 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 417 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
418 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); | 418 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); |
419 | 419 | ||
420 | channel = new QCopChannel( "QPE/System", this ); | 420 | channel = new QCopChannel( "QPE/System", this ); |
421 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 421 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
422 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 422 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); |
423 | 423 | ||
424 | m_screensaver = new QPEScreenSaver; | 424 | m_screensaver = new QPEScreenSaver; |
425 | 425 | ||
426 | m_screensaver-> setInterval ( -1 ); | 426 | m_screensaver-> setInterval ( -1 ); |
427 | QWSServer::setScreenSaver( m_screensaver ); | 427 | QWSServer::setScreenSaver( m_screensaver ); |
428 | } | 428 | } |
429 | 429 | ||
430 | 430 | ||
431 | DesktopApplication::~DesktopApplication() | 431 | DesktopApplication::~DesktopApplication() |
432 | { | 432 | { |
433 | delete ps; | 433 | delete ps; |
434 | delete pa; | 434 | delete pa; |
435 | } | 435 | } |
436 | 436 | ||
437 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) | 437 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) |
438 | { | 438 | { |
439 | QDataStream stream( data, IO_ReadOnly ); | 439 | QDataStream stream( data, IO_ReadOnly ); |
440 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { | 440 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { |
441 | int k; | 441 | int k; |
442 | QString c, m; | 442 | QString c, m; |
443 | stream >> k; | 443 | stream >> k; |
444 | stream >> c; | 444 | stream >> c; |
445 | stream >> m; | 445 | stream >> m; |
446 | 446 | ||
447 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); | 447 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); |
448 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); | 448 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); |
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | 452 | ||
453 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | 453 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) |
454 | { | 454 | { |
455 | QDataStream stream ( data, IO_ReadOnly ); | 455 | QDataStream stream ( data, IO_ReadOnly ); |
456 | 456 | ||
457 | if ( msg == "setScreenSaverInterval(int)" ) { | 457 | if ( msg == "setScreenSaverInterval(int)" ) { |
458 | int time; | 458 | int time; |
459 | stream >> time; | 459 | stream >> time; |
460 | m_screensaver-> setInterval( time ); | 460 | m_screensaver-> setInterval( time ); |
461 | } | 461 | } |
462 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | 462 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { |
463 | int t1, t2, t3; | 463 | int t1, t2, t3; |
464 | stream >> t1 >> t2 >> t3; | 464 | stream >> t1 >> t2 >> t3; |
465 | m_screensaver-> setIntervals( t1, t2, t3 ); | 465 | m_screensaver-> setIntervals( t1, t2, t3 ); |
466 | } | 466 | } |
467 | else if ( msg == "setScreenSaverIntervalsAC(int,int,int)" ) { | 467 | else if ( msg == "setScreenSaverIntervalsAC(int,int,int)" ) { |
468 | int t1, t2, t3; | 468 | int t1, t2, t3; |
469 | stream >> t1 >> t2 >> t3; | 469 | stream >> t1 >> t2 >> t3; |
470 | m_screensaver-> setIntervalsAC( t1, t2, t3 ); | 470 | m_screensaver-> setIntervalsAC( t1, t2, t3 ); |
471 | } | 471 | } |
472 | else if ( msg == "setBacklight(int)" ) { | 472 | else if ( msg == "setBacklight(int)" ) { |
473 | int bright; | 473 | int bright; |
474 | stream >> bright; | 474 | stream >> bright; |
475 | m_screensaver-> setBacklight( bright ); | 475 | m_screensaver-> setBacklight( bright ); |
476 | } | 476 | } |
477 | else if ( msg == "setScreenSaverMode(int)" ) { | 477 | else if ( msg == "setScreenSaverMode(int)" ) { |
478 | int mode; | 478 | int mode; |
479 | stream >> mode; | 479 | stream >> mode; |
480 | m_screensaver-> setMode ( mode ); | 480 | m_screensaver-> setMode ( mode ); |
481 | } | 481 | } |
482 | else if ( msg == "reloadPowerWarnSettings()" ) { | 482 | else if ( msg == "reloadPowerWarnSettings()" ) { |
483 | reloadPowerWarnSettings(); | 483 | reloadPowerWarnSettings(); |
484 | } | 484 | } |
485 | else if ( msg == "setDisplayState(int)" ) { | 485 | else if ( msg == "setDisplayState(int)" ) { |
486 | int state; | 486 | int state; |
487 | stream >> state; | 487 | stream >> state; |
488 | m_screensaver-> setDisplayState ( state != 0 ); | 488 | m_screensaver-> setDisplayState ( state != 0 ); |
489 | } | 489 | } |
490 | else if ( msg == "suspend()" ) { | 490 | else if ( msg == "suspend()" ) { |
491 | emit power(); | 491 | emit power(); |
492 | } | 492 | } |
493 | } | 493 | } |
494 | 494 | ||
495 | void DesktopApplication::reloadPowerWarnSettings() { | 495 | void DesktopApplication::reloadPowerWarnSettings() { |
496 | Config cfg( "apm" ); | 496 | Config cfg( "apm" ); |
497 | cfg.setGroup( "Warnings" ); | 497 | cfg.setGroup( "Warnings" ); |
498 | 498 | ||
499 | m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); | 499 | // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); |
500 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); | 500 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); |
501 | m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); | 501 | m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); |
502 | } | 502 | } |
503 | 503 | ||
504 | 504 | ||
505 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 505 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
506 | 506 | ||
507 | #ifdef Q_WS_QWS | 507 | #ifdef Q_WS_QWS |
508 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 508 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
509 | { | 509 | { |
510 | qpedesktop->checkMemory(); | 510 | qpedesktop->checkMemory(); |
511 | 511 | ||
512 | if ( e->type == QWSEvent::Key ) { | 512 | if ( e->type == QWSEvent::Key ) { |
513 | QWSKeyEvent * ke = ( QWSKeyEvent * ) e; | 513 | QWSKeyEvent * ke = ( QWSKeyEvent * ) e; |
514 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 514 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
515 | return TRUE; | 515 | return TRUE; |
516 | bool press = ke->simpleData.is_press; | 516 | bool press = ke->simpleData.is_press; |
517 | bool autoRepeat = ke->simpleData.is_auto_repeat; | 517 | bool autoRepeat = ke->simpleData.is_auto_repeat; |
518 | 518 | ||
519 | /* | 519 | /* |
520 | app that registers key/message to be sent back to the app, when it doesn't have focus, | 520 | app that registers key/message to be sent back to the app, when it doesn't have focus, |
521 | when user presses key, unless keyboard has been requested from app. | 521 | when user presses key, unless keyboard has been requested from app. |
522 | will not send multiple repeats if user holds key | 522 | will not send multiple repeats if user holds key |
523 | i.e. one shot | 523 | i.e. one shot |
524 | */ | 524 | */ |
525 | if ( !keyRegisterList.isEmpty() && ke->simpleData.keycode !=0 && press) { | 525 | if ( !keyRegisterList.isEmpty() && ke->simpleData.keycode !=0 && press) { |
526 | // qDebug("<<<<<<<<<<<<<keycode %d", ke->simpleData.keycode); | 526 | // qDebug("<<<<<<<<<<<<<keycode %d", ke->simpleData.keycode); |
527 | KeyRegisterList::Iterator it; | 527 | KeyRegisterList::Iterator it; |
528 | for ( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { | 528 | for ( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { |
529 | if ( ( *it ).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() ) { | 529 | if ( ( *it ).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() ) { |
530 | if ( press ) | 530 | if ( press ) |
531 | qDebug( "press" ); | 531 | qDebug( "press" ); |
532 | else | 532 | else |
533 | qDebug( "release" ); | 533 | qDebug( "release" ); |
534 | QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() ); | 534 | QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() ); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | } | 537 | } |
538 | 538 | ||
539 | if ( !keyboardGrabbed() ) { | 539 | if ( !keyboardGrabbed() ) { |
540 | if ( ke->simpleData.keycode == Key_F9 ) { | 540 | if ( ke->simpleData.keycode == Key_F9 ) { |
541 | if ( press ) | 541 | if ( press ) |
542 | emit datebook(); | 542 | emit datebook(); |
543 | return TRUE; | 543 | return TRUE; |
544 | } | 544 | } |
545 | if ( ke->simpleData.keycode == Key_F10 ) { | 545 | if ( ke->simpleData.keycode == Key_F10 ) { |
546 | if ( !press && cardSendTimer ) { | 546 | if ( !press && cardSendTimer ) { |
547 | emit contacts(); | 547 | emit contacts(); |
548 | delete cardSendTimer; | 548 | delete cardSendTimer; |
549 | } | 549 | } |
550 | else if ( press ) { | 550 | else if ( press ) { |
551 | cardSendTimer = new QTimer(); | 551 | cardSendTimer = new QTimer(); |
552 | cardSendTimer->start( 2000, TRUE ); | 552 | cardSendTimer->start( 2000, TRUE ); |
553 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 553 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
554 | } | 554 | } |
555 | return TRUE; | 555 | return TRUE; |
556 | } | 556 | } |
557 | 557 | ||
558 | // if ( ke->simpleData.keycode == Key_F11 ) { | 558 | // if ( ke->simpleData.keycode == Key_F11 ) { |
559 | // if ( press ) emit menu(); | 559 | // if ( press ) emit menu(); |
560 | // return TRUE; | 560 | // return TRUE; |
561 | // } | 561 | // } |
562 | 562 | ||
563 | if ( ke->simpleData.keycode == Key_F12 ) { | 563 | if ( ke->simpleData.keycode == Key_F12 ) { |
564 | while ( activePopupWidget() ) | 564 | while ( activePopupWidget() ) |
565 | activePopupWidget() ->close(); | 565 | activePopupWidget() ->close(); |
566 | if ( press ) | 566 | if ( press ) |
567 | emit launch(); | 567 | emit launch(); |
568 | return TRUE; | 568 | return TRUE; |
569 | } | 569 | } |
570 | if ( ke->simpleData.keycode == Key_F13 ) { | 570 | if ( ke->simpleData.keycode == Key_F13 ) { |
571 | if ( press ) | 571 | if ( press ) |
572 | emit email(); | 572 | emit email(); |
573 | return TRUE; | 573 | return TRUE; |
574 | } | 574 | } |
575 | } | 575 | } |
576 | 576 | ||
577 | if ( ke->simpleData.keycode == Key_F34 ) { | 577 | if ( ke->simpleData.keycode == Key_F34 ) { |
578 | if ( press ) | 578 | if ( press ) |
579 | emit power(); | 579 | emit power(); |
580 | return TRUE; | 580 | return TRUE; |
581 | } | 581 | } |
582 | // This was used for the iPAQ PowerButton | 582 | // This was used for the iPAQ PowerButton |
583 | // See main.cpp for new KeyboardFilter | 583 | // See main.cpp for new KeyboardFilter |
584 | // | 584 | // |
585 | // if ( ke->simpleData.keycode == Key_SysReq ) { | 585 | // if ( ke->simpleData.keycode == Key_SysReq ) { |
586 | // if ( press ) emit power(); | 586 | // if ( press ) emit power(); |
587 | // return TRUE; | 587 | // return TRUE; |
588 | // } | 588 | // } |
589 | if ( ke->simpleData.keycode == Key_F35 ) { | 589 | if ( ke->simpleData.keycode == Key_F35 ) { |
590 | if ( press ) | 590 | if ( press ) |
591 | emit backlight(); | 591 | emit backlight(); |
592 | return TRUE; | 592 | return TRUE; |
593 | } | 593 | } |
594 | if ( ke->simpleData.keycode == Key_F32 ) { | 594 | if ( ke->simpleData.keycode == Key_F32 ) { |
595 | if ( press ) | 595 | if ( press ) |
596 | QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 596 | QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
597 | return TRUE; | 597 | return TRUE; |
598 | } | 598 | } |
599 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | 599 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { |
600 | if ( press ) | 600 | if ( press ) |
601 | emit symbol(); | 601 | emit symbol(); |
602 | return TRUE; | 602 | return TRUE; |
603 | } | 603 | } |
604 | if ( ke->simpleData.keycode == Key_NumLock ) { | 604 | if ( ke->simpleData.keycode == Key_NumLock ) { |
605 | if ( press ) | 605 | if ( press ) |
606 | emit numLockStateToggle(); | 606 | emit numLockStateToggle(); |
607 | } | 607 | } |
608 | if ( ke->simpleData.keycode == Key_CapsLock ) { | 608 | if ( ke->simpleData.keycode == Key_CapsLock ) { |
609 | if ( press ) | 609 | if ( press ) |
610 | emit capsLockStateToggle(); | 610 | emit capsLockStateToggle(); |
611 | } | 611 | } |
612 | if ( ( press && !autoRepeat ) || ( !press && autoRepeat ) ) | 612 | if ( ( press && !autoRepeat ) || ( !press && autoRepeat ) ) |
613 | qpedesktop->keyClick(); | 613 | qpedesktop->keyClick(); |
614 | } | 614 | } |
615 | else { | 615 | else { |
616 | if ( e->type == QWSEvent::Mouse ) { | 616 | if ( e->type == QWSEvent::Mouse ) { |
617 | QWSMouseEvent * me = ( QWSMouseEvent * ) e; | 617 | QWSMouseEvent * me = ( QWSMouseEvent * ) e; |
618 | static bool up = TRUE; | 618 | static bool up = TRUE; |
619 | if ( me->simpleData.state & LeftButton ) { | 619 | if ( me->simpleData.state & LeftButton ) { |
620 | if ( up ) { | 620 | if ( up ) { |
621 | up = FALSE; | 621 | up = FALSE; |
622 | qpedesktop->screenClick(); | 622 | qpedesktop->screenClick(); |
623 | } | 623 | } |
624 | } | 624 | } |
625 | else { | 625 | else { |
626 | up = TRUE; | 626 | up = TRUE; |
627 | } | 627 | } |
628 | } | 628 | } |
629 | } | 629 | } |
630 | 630 | ||
631 | return QPEApplication::qwsEventFilter( e ); | 631 | return QPEApplication::qwsEventFilter( e ); |
632 | } | 632 | } |
633 | #endif | 633 | #endif |
634 | 634 | ||
635 | void DesktopApplication::psTimeout() | 635 | void DesktopApplication::psTimeout( int batRemaining ) |
636 | { | 636 | { |
637 | qpedesktop->checkMemory(); // in case no events are being generated | ||
638 | |||
639 | *ps = PowerStatusManager::readStatus(); | 637 | *ps = PowerStatusManager::readStatus(); |
640 | 638 | ||
639 | // maybe now since its triggered by apm change there might be to few warnings | ||
641 | // if ( ( ps->batteryStatus() == PowerStatus::VeryLow ) ) { | 640 | // if ( ( ps->batteryStatus() == PowerStatus::VeryLow ) ) { |
642 | if ( ( ps->batteryPercentRemaining() == m_powerVeryLow ) ) { | 641 | if ( ( batRemaining == m_powerVeryLow ) ) { |
643 | pa->alert( tr( "Battery is running very low." ), 6 ); | 642 | pa->alert( tr( "Battery is running very low." ), 6 ); |
644 | } | 643 | } |
645 | 644 | ||
646 | // if ( ps->batteryStatus() == PowerStatus::Critical ) { | 645 | // if ( ps->batteryStatus() == PowerStatus::Critical ) { |
647 | if ( ps->batteryPercentRemaining() == m_powerCritical ) { | 646 | if ( batRemaining == m_powerCritical ) { |
648 | pa->alert( tr( "Battery level is critical!\n" | 647 | pa->alert( tr( "Battery level is critical!\n" |
649 | "Keep power off until power restored!" ), 1 ); | 648 | "Keep power off until power restored!" ), 1 ); |
650 | } | 649 | } |
651 | 650 | ||
652 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { | 651 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { |
653 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); | 652 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); |
654 | } | 653 | } |
655 | } | 654 | } |
656 | 655 | ||
656 | void DesktopApplication::apmTimeout() | ||
657 | { | ||
658 | qpedesktop->checkMemory(); // in case no events are being generated | ||
659 | |||
660 | *ps = PowerStatusManager::readStatus(); | ||
661 | |||
662 | if ( m_currentPowerLevel != ps->batteryPercentRemaining() ) { | ||
663 | // not very nice, since psTimeout parses the again | ||
664 | m_currentPowerLevel = ps->batteryPercentRemaining(); | ||
665 | psTimeout( m_currentPowerLevel ); | ||
666 | } | ||
667 | } | ||
657 | 668 | ||
658 | void DesktopApplication::sendCard() | 669 | void DesktopApplication::sendCard() |
659 | { | 670 | { |
660 | delete cardSendTimer; | 671 | delete cardSendTimer; |
661 | cardSendTimer = 0; | 672 | cardSendTimer = 0; |
662 | QString card = getenv( "HOME" ); | 673 | QString card = getenv( "HOME" ); |
663 | card += "/Applications/addressbook/businesscard.vcf"; | 674 | card += "/Applications/addressbook/businesscard.vcf"; |
664 | 675 | ||
665 | if ( QFile::exists( card ) ) { | 676 | if ( QFile::exists( card ) ) { |
666 | QCopEnvelope e( "QPE/Obex", "send(QString,QString,QString)" ); | 677 | QCopEnvelope e( "QPE/Obex", "send(QString,QString,QString)" ); |
667 | QString mimetype = "text/x-vCard"; | 678 | QString mimetype = "text/x-vCard"; |
668 | e << tr( "business card" ) << card << mimetype; | 679 | e << tr( "business card" ) << card << mimetype; |
669 | } | 680 | } |
670 | } | 681 | } |
671 | 682 | ||
672 | #if defined(QPE_HAVE_MEMALERTER) | 683 | #if defined(QPE_HAVE_MEMALERTER) |
673 | QPE_MEMALERTER_IMPL | 684 | QPE_MEMALERTER_IMPL |
674 | #endif | 685 | #endif |
675 | 686 | ||
676 | //=========================================================================== | 687 | //=========================================================================== |
677 | 688 | ||
678 | Desktop::Desktop() : | 689 | Desktop::Desktop() : |
679 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 690 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
680 | qcopBridge( 0 ), | 691 | qcopBridge( 0 ), |
681 | transferServer( 0 ), | 692 | transferServer( 0 ), |
682 | packageSlave( 0 ) | 693 | packageSlave( 0 ) |
683 | { | 694 | { |
684 | qpedesktop = this; | 695 | qpedesktop = this; |
685 | 696 | ||
686 | // bg = new Info( this ); | 697 | // bg = new Info( this ); |
687 | tb = new TaskBar; | 698 | tb = new TaskBar; |
688 | 699 | ||
689 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 700 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
690 | 701 | ||
691 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); | 702 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); |
692 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); | 703 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); |
693 | 704 | ||
694 | int displayw = qApp->desktop() ->width(); | 705 | int displayw = qApp->desktop() ->width(); |
695 | int displayh = qApp->desktop() ->height(); | 706 | int displayh = qApp->desktop() ->height(); |
696 | 707 | ||
697 | 708 | ||
698 | QSize sz = tb->sizeHint(); | 709 | QSize sz = tb->sizeHint(); |
699 | 710 | ||
700 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 711 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
701 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 712 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
702 | 713 | ||
703 | tb->show(); | 714 | tb->show(); |
704 | launcher->showMaximized(); | 715 | launcher->showMaximized(); |
705 | launcher->show(); | 716 | launcher->show(); |
706 | launcher->raise(); | 717 | launcher->raise(); |
707 | #if defined(QPE_HAVE_MEMALERTER) | 718 | #if defined(QPE_HAVE_MEMALERTER) |
708 | 719 | ||
709 | initMemalerter(); | 720 | initMemalerter(); |
710 | #endif | 721 | #endif |
711 | // start services | 722 | // start services |
712 | startTransferServer(); | 723 | startTransferServer(); |
713 | ( void ) new IrServer( this ); | 724 | ( void ) new IrServer( this ); |
714 | rereadVolumes(); | 725 | rereadVolumes(); |
715 | 726 | ||
716 | packageSlave = new PackageSlave( this ); | 727 | packageSlave = new PackageSlave( this ); |
717 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); | 728 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); |
718 | 729 | ||
719 | qApp->installEventFilter( this ); | 730 | qApp->installEventFilter( this ); |
720 | 731 | ||
721 | qApp-> setMainWidget ( launcher ); | 732 | qApp-> setMainWidget ( launcher ); |
722 | } | 733 | } |
723 | 734 | ||
724 | void Desktop::show() | 735 | void Desktop::show() |
725 | { | 736 | { |
726 | login( TRUE ); | 737 | login( TRUE ); |
727 | QWidget::show(); | 738 | QWidget::show(); |
728 | } | 739 | } |
729 | 740 | ||
730 | Desktop::~Desktop() | 741 | Desktop::~Desktop() |
731 | { | 742 | { |
732 | delete launcher; | 743 | delete launcher; |
733 | delete tb; | 744 | delete tb; |
734 | delete qcopBridge; | 745 | delete qcopBridge; |
735 | delete transferServer; | 746 | delete transferServer; |
736 | } | 747 | } |
737 | 748 | ||
738 | bool Desktop::recoverMemory() | 749 | bool Desktop::recoverMemory() |
739 | { | 750 | { |
740 | return tb->recoverMemory(); | 751 | return tb->recoverMemory(); |
741 | } | 752 | } |
742 | 753 | ||
743 | void Desktop::checkMemory() | 754 | void Desktop::checkMemory() |
744 | { | 755 | { |
745 | #if defined(QPE_HAVE_MEMALERTER) | 756 | #if defined(QPE_HAVE_MEMALERTER) |
746 | static bool ignoreNormal = FALSE; | 757 | static bool ignoreNormal = FALSE; |
747 | static bool existingMessage = FALSE; | 758 | static bool existingMessage = FALSE; |
748 | 759 | ||
749 | if ( existingMessage ) | 760 | if ( existingMessage ) |
750 | return ; // don't show a second message while still on first | 761 | return ; // don't show a second message while still on first |
751 | 762 | ||
752 | existingMessage = TRUE; | 763 | existingMessage = TRUE; |
753 | switch ( memstate ) { | 764 | switch ( memstate ) { |
754 | case Unknown: | 765 | case Unknown: |
755 | break; | 766 | break; |
756 | case Low: | 767 | case Low: |
757 | memstate = Unknown; | 768 | memstate = Unknown; |
758 | if ( recoverMemory() ) | 769 | if ( recoverMemory() ) |
759 | ignoreNormal = TRUE; | 770 | ignoreNormal = TRUE; |
760 | else | 771 | else |
761 | QMessageBox::warning( 0 , "Memory Status", | 772 | QMessageBox::warning( 0 , "Memory Status", |
762 | "The memory smacks of shortage. \n" | 773 | "The memory smacks of shortage. \n" |
763 | "Please save data. " ); | 774 | "Please save data. " ); |
764 | break; | 775 | break; |
765 | case Normal: | 776 | case Normal: |
766 | memstate = Unknown; | 777 | memstate = Unknown; |
767 | if ( ignoreNormal ) | 778 | if ( ignoreNormal ) |
768 | ignoreNormal = FALSE; | 779 | ignoreNormal = FALSE; |
769 | // else | 780 | // else |
770 | // QMessageBox::information ( 0 , "Memory Status", | 781 | // QMessageBox::information ( 0 , "Memory Status", |
771 | // "There is enough memory again." ); | 782 | // "There is enough memory again." ); |
772 | break; | 783 | break; |
773 | case VeryLow: | 784 | case VeryLow: |
774 | memstate = Unknown; | 785 | memstate = Unknown; |
775 | QMessageBox::critical( 0 , "Memory Status", | 786 | QMessageBox::critical( 0 , "Memory Status", |
776 | "The memory is very low. \n" | 787 | "The memory is very low. \n" |
777 | "Please end this application \n" | 788 | "Please end this application \n" |
778 | "immediately." ); | 789 | "immediately." ); |
779 | recoverMemory(); | 790 | recoverMemory(); |
780 | } | 791 | } |
781 | existingMessage = FALSE; | 792 | existingMessage = FALSE; |
782 | #endif | 793 | #endif |
783 | } | 794 | } |
784 | 795 | ||
785 | static bool isVisibleWindow( int wid ) | 796 | static bool isVisibleWindow( int wid ) |
786 | { | 797 | { |
787 | #ifdef QWS | 798 | #ifdef QWS |
788 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 799 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
789 | QWSWindow* w; | 800 | QWSWindow* w; |
790 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 801 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
791 | if ( w->winId() == wid ) | 802 | if ( w->winId() == wid ) |
792 | return !w->isFullyObscured(); | 803 | return !w->isFullyObscured(); |
793 | } | 804 | } |
794 | #endif | 805 | #endif |
795 | return FALSE; | 806 | return FALSE; |
796 | } | 807 | } |
797 | 808 | ||
798 | static bool hasVisibleWindow( const QString& clientname ) | 809 | static bool hasVisibleWindow( const QString& clientname ) |
799 | { | 810 | { |
800 | #ifdef QWS | 811 | #ifdef QWS |
801 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 812 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
802 | QWSWindow* w; | 813 | QWSWindow* w; |
803 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 814 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
804 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) | 815 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) |
805 | return TRUE; | 816 | return TRUE; |
806 | } | 817 | } |
807 | #endif | 818 | #endif |
808 | return FALSE; | 819 | return FALSE; |
809 | } | 820 | } |
810 | 821 | ||
811 | void Desktop::raiseLauncher() | 822 | void Desktop::raiseLauncher() |
812 | { | 823 | { |
813 | Config cfg( "qpe" ); //F12 'Home' | 824 | Config cfg( "qpe" ); //F12 'Home' |
814 | cfg.setGroup( "AppsKey" ); | 825 | cfg.setGroup( "AppsKey" ); |
815 | QString tempItem; | 826 | QString tempItem; |
816 | tempItem = cfg.readEntry( "Middle", "Home" ); | 827 | tempItem = cfg.readEntry( "Middle", "Home" ); |
817 | if ( tempItem == "Home" || tempItem.isEmpty() ) { | 828 | if ( tempItem == "Home" || tempItem.isEmpty() ) { |
818 | home ( ); | 829 | home ( ); |
819 | } | 830 | } |
820 | else { | 831 | else { |
821 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 832 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
822 | e << tempItem; | 833 | e << tempItem; |
823 | } | 834 | } |
824 | } | 835 | } |
825 | 836 | ||
826 | void Desktop::home ( ) | 837 | void Desktop::home ( ) |
827 | { | 838 | { |
828 | if ( isVisibleWindow( launcher->winId() ) ) | 839 | if ( isVisibleWindow( launcher->winId() ) ) |
829 | launcher->nextView(); | 840 | launcher->nextView(); |
830 | else | 841 | else |
831 | launcher->raise(); | 842 | launcher->raise(); |
832 | } | 843 | } |
833 | 844 | ||
834 | void Desktop::executeOrModify( const QString& appLnkFile ) | 845 | void Desktop::executeOrModify( const QString& appLnkFile ) |
835 | { | 846 | { |
836 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); | 847 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); |
837 | if ( lnk.isValid() ) { | 848 | if ( lnk.isValid() ) { |
838 | QCString app = lnk.exec().utf8(); | 849 | QCString app = lnk.exec().utf8(); |
839 | Global::terminateBuiltin( "calibrate" ); | 850 | Global::terminateBuiltin( "calibrate" ); |
840 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { | 851 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { |
841 | // MRUList::addTask( &lnk ); | 852 | // MRUList::addTask( &lnk ); |
842 | if ( hasVisibleWindow( app ) ) | 853 | if ( hasVisibleWindow( app ) ) |
843 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); | 854 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); |
844 | else | 855 | else |
845 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); | 856 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); |
846 | } | 857 | } |
847 | else { | 858 | else { |
848 | lnk.execute(); | 859 | lnk.execute(); |
849 | } | 860 | } |
850 | } | 861 | } |
851 | } | 862 | } |
852 | 863 | ||
853 | void Desktop::raiseDatebook() | 864 | void Desktop::raiseDatebook() |
854 | { | 865 | { |
855 | Config cfg( "qpe" ); //F9 'Activity' | 866 | Config cfg( "qpe" ); //F9 'Activity' |
856 | cfg.setGroup( "AppsKey" ); | 867 | cfg.setGroup( "AppsKey" ); |
857 | QString tempItem; | 868 | QString tempItem; |
858 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); | 869 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); |
859 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { | 870 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { |
860 | tempItem = "datebook"; | 871 | tempItem = "datebook"; |
861 | } | 872 | } |
862 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 873 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
863 | e << tempItem; | 874 | e << tempItem; |
864 | } | 875 | } |
865 | 876 | ||
866 | void Desktop::raiseContacts() | 877 | void Desktop::raiseContacts() |
867 | { | 878 | { |
868 | Config cfg( "qpe" ); //F10, 'Contacts' | 879 | Config cfg( "qpe" ); //F10, 'Contacts' |
869 | cfg.setGroup( "AppsKey" ); | 880 | cfg.setGroup( "AppsKey" ); |
870 | QString tempItem; | 881 | QString tempItem; |
871 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); | 882 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); |
872 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { | 883 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { |
873 | tempItem = "addressbook"; | 884 | tempItem = "addressbook"; |
874 | } | 885 | } |
875 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 886 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
876 | e << tempItem; | 887 | e << tempItem; |
877 | } | 888 | } |
878 | 889 | ||
879 | void Desktop::raiseMenu() | 890 | void Desktop::raiseMenu() |
880 | { | 891 | { |
881 | Config cfg( "qpe" ); //F11, 'Menu | 892 | Config cfg( "qpe" ); //F11, 'Menu |
882 | cfg.setGroup( "AppsKey" ); | 893 | cfg.setGroup( "AppsKey" ); |
883 | QString tempItem; | 894 | QString tempItem; |
884 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); | 895 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); |
885 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { | 896 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { |
886 | Global::terminateBuiltin( "calibrate" ); | 897 | Global::terminateBuiltin( "calibrate" ); |
887 | tb->startMenu() ->launch(); | 898 | tb->startMenu() ->launch(); |
888 | } | 899 | } |
889 | else { | 900 | else { |
890 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 901 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
891 | e << tempItem; | 902 | e << tempItem; |
892 | } | 903 | } |
893 | } | 904 | } |
894 | 905 | ||
895 | void Desktop::raiseEmail() | 906 | void Desktop::raiseEmail() |
896 | { | 907 | { |
897 | Config cfg( "qpe" ); //F13, 'Mail' // only in zaurus, on ipaq mail key is F11 | 908 | Config cfg( "qpe" ); //F13, 'Mail' // only in zaurus, on ipaq mail key is F11 |
898 | cfg.setGroup( "AppsKey" ); | 909 | cfg.setGroup( "AppsKey" ); |
899 | QString tempItem; | 910 | QString tempItem; |
900 | tempItem = cfg.readEntry( "RightEnd", "Mail" ); | 911 | tempItem = cfg.readEntry( "RightEnd", "Mail" ); |
901 | if ( tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty() ) { | 912 | if ( tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty() ) { |
902 | tempItem = "mail"; | 913 | tempItem = "mail"; |
903 | } | 914 | } |
904 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 915 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
905 | e << tempItem; | 916 | e << tempItem; |
906 | } | 917 | } |
907 | 918 | ||
908 | // autoStarts apps on resume and start | 919 | // autoStarts apps on resume and start |
909 | void Desktop::execAutoStart() | 920 | void Desktop::execAutoStart() |
910 | { | 921 | { |
911 | QString appName; | 922 | QString appName; |
912 | int delay; | 923 | int delay; |
913 | QDateTime now = QDateTime::currentDateTime(); | 924 | QDateTime now = QDateTime::currentDateTime(); |
914 | Config cfg( "autostart" ); | 925 | Config cfg( "autostart" ); |
915 | cfg.setGroup( "AutoStart" ); | 926 | cfg.setGroup( "AutoStart" ); |
916 | appName = cfg.readEntry( "Apps", "" ); | 927 | appName = cfg.readEntry( "Apps", "" ); |
917 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); | 928 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); |
918 | // If the time between suspend and resume was longer then the | 929 | // If the time between suspend and resume was longer then the |
919 | // value saved as delay, start the app | 930 | // value saved as delay, start the app |
920 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 931 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
921 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 932 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
922 | e << QString( appName ); | 933 | e << QString( appName ); |
923 | } | 934 | } |
924 | } | 935 | } |
925 | 936 | ||
926 | #if defined(QPE_HAVE_TOGGLELIGHT) | 937 | #if defined(QPE_HAVE_TOGGLELIGHT) |
927 | #include <qpe/config.h> | 938 | #include <qpe/config.h> |
928 | 939 | ||
929 | #include <sys/ioctl.h> | 940 | #include <sys/ioctl.h> |
930 | #include <sys/types.h> | 941 | #include <sys/types.h> |
931 | #include <fcntl.h> | 942 | #include <fcntl.h> |
932 | #include <unistd.h> | 943 | #include <unistd.h> |
933 | #include <errno.h> | 944 | #include <errno.h> |
934 | #include <linux/ioctl.h> | 945 | #include <linux/ioctl.h> |
935 | #include <time.h> | 946 | #include <time.h> |
936 | #endif | 947 | #endif |
937 | 948 | ||
938 | 949 | ||
939 | void Desktop::togglePower() | 950 | void Desktop::togglePower() |
940 | { | 951 | { |
941 | static bool excllock = false; | 952 | static bool excllock = false; |
942 | 953 | ||
943 | qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); | 954 | qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); |
944 | 955 | ||
945 | if ( excllock ) | 956 | if ( excllock ) |
946 | return; | 957 | return; |
947 | 958 | ||
948 | excllock = true; | 959 | excllock = true; |
949 | 960 | ||
950 | bool wasloggedin = loggedin; | 961 | bool wasloggedin = loggedin; |
951 | loggedin = 0; | 962 | loggedin = 0; |
952 | suspendTime = QDateTime::currentDateTime(); | 963 | suspendTime = QDateTime::currentDateTime(); |
953 | 964 | ||
954 | #ifdef QWS | 965 | #ifdef QWS |
955 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { | 966 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { |
956 | // Should use a big black window instead. | 967 | // Should use a big black window instead. |
957 | // But this would not show up fast enough | 968 | // But this would not show up fast enough |
958 | QGfx *g = qt_screen-> screenGfx ( ); | 969 | QGfx *g = qt_screen-> screenGfx ( ); |
959 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); | 970 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); |
960 | delete g; | 971 | delete g; |
961 | } | 972 | } |
962 | #endif | 973 | #endif |
963 | 974 | ||
964 | ODevice::inst ( )-> suspend ( ); | 975 | ODevice::inst ( )-> suspend ( ); |
965 | 976 | ||
966 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call | 977 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call |
967 | QWSServer::screenSaverActivate ( false ); | 978 | QWSServer::screenSaverActivate ( false ); |
968 | 979 | ||
969 | { | 980 | { |
970 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep | 981 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep |
971 | } | 982 | } |
972 | 983 | ||
973 | if ( wasloggedin ) | 984 | if ( wasloggedin ) |
974 | login ( true ); | 985 | login ( true ); |
975 | 986 | ||
976 | execAutoStart(); | 987 | execAutoStart(); |
977 | //qcopBridge->closeOpenConnections(); | 988 | //qcopBridge->closeOpenConnections(); |
978 | 989 | ||
979 | excllock = false; | 990 | excllock = false; |
980 | } | 991 | } |
981 | 992 | ||
982 | void Desktop::toggleLight() | 993 | void Desktop::toggleLight() |
983 | { | 994 | { |
984 | QCopEnvelope e( "QPE/System", "setBacklight(int)" ); | 995 | QCopEnvelope e( "QPE/System", "setBacklight(int)" ); |
985 | e << -2; // toggle | 996 | e << -2; // toggle |
986 | } | 997 | } |
987 | 998 | ||
988 | void Desktop::toggleSymbolInput() | 999 | void Desktop::toggleSymbolInput() |
989 | { | 1000 | { |
990 | tb->toggleSymbolInput(); | 1001 | tb->toggleSymbolInput(); |
991 | } | 1002 | } |
992 | 1003 | ||
993 | void Desktop::toggleNumLockState() | 1004 | void Desktop::toggleNumLockState() |
994 | { | 1005 | { |
995 | tb->toggleNumLockState(); | 1006 | tb->toggleNumLockState(); |
996 | } | 1007 | } |
997 | 1008 | ||
998 | void Desktop::toggleCapsLockState() | 1009 | void Desktop::toggleCapsLockState() |
999 | { | 1010 | { |
1000 | tb->toggleCapsLockState(); | 1011 | tb->toggleCapsLockState(); |
1001 | } | 1012 | } |
1002 | 1013 | ||
1003 | void Desktop::styleChange( QStyle &s ) | 1014 | void Desktop::styleChange( QStyle &s ) |
1004 | { | 1015 | { |
1005 | QWidget::styleChange( s ); | 1016 | QWidget::styleChange( s ); |
1006 | int displayw = qApp->desktop() ->width(); | 1017 | int displayw = qApp->desktop() ->width(); |
1007 | int displayh = qApp->desktop() ->height(); | 1018 | int displayh = qApp->desktop() ->height(); |
1008 | 1019 | ||
1009 | QSize sz = tb->sizeHint(); | 1020 | QSize sz = tb->sizeHint(); |
1010 | 1021 | ||
1011 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 1022 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
1012 | } | 1023 | } |
1013 | 1024 | ||
1014 | void DesktopApplication::shutdown() | 1025 | void DesktopApplication::shutdown() |
1015 | { | 1026 | { |
1016 | if ( type() != GuiServer ) | 1027 | if ( type() != GuiServer ) |
1017 | return ; | 1028 | return ; |
1018 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 1029 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
1019 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), | 1030 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), |
1020 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); | 1031 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); |
1021 | sd->showMaximized(); | 1032 | sd->showMaximized(); |
1022 | } | 1033 | } |
1023 | 1034 | ||
1024 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) | 1035 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) |
1025 | { | 1036 | { |
1026 | switch ( t ) { | 1037 | switch ( t ) { |
1027 | case ShutdownImpl::ShutdownSystem: | 1038 | case ShutdownImpl::ShutdownSystem: |
1028 | execlp( "shutdown", "shutdown", "-h", "now", ( void* ) 0 ); | 1039 | execlp( "shutdown", "shutdown", "-h", "now", ( void* ) 0 ); |
1029 | break; | 1040 | break; |
1030 | case ShutdownImpl::RebootSystem: | 1041 | case ShutdownImpl::RebootSystem: |
1031 | execlp( "shutdown", "shutdown", "-r", "now", ( void* ) 0 ); | 1042 | execlp( "shutdown", "shutdown", "-r", "now", ( void* ) 0 ); |
1032 | break; | 1043 | break; |
1033 | case ShutdownImpl::RestartDesktop: | 1044 | case ShutdownImpl::RestartDesktop: |
1034 | restart(); | 1045 | restart(); |
1035 | break; | 1046 | break; |
1036 | case ShutdownImpl::TerminateDesktop: | 1047 | case ShutdownImpl::TerminateDesktop: |
1037 | prepareForTermination( FALSE ); | 1048 | prepareForTermination( FALSE ); |
1038 | 1049 | ||
1039 | // This is a workaround for a Qt bug | 1050 | // This is a workaround for a Qt bug |
1040 | // clipboard applet has to stop its poll timer, or Qt/E | 1051 | // clipboard applet has to stop its poll timer, or Qt/E |
1041 | // will hang on quit() right before it emits aboutToQuit() | 1052 | // will hang on quit() right before it emits aboutToQuit() |
1042 | emit aboutToQuit ( ); | 1053 | emit aboutToQuit ( ); |
1043 | 1054 | ||
1044 | quit(); | 1055 | quit(); |
1045 | break; | 1056 | break; |
1046 | } | 1057 | } |
1047 | } | 1058 | } |
1048 | 1059 | ||
1049 | void DesktopApplication::restart() | 1060 | void DesktopApplication::restart() |
1050 | { | 1061 | { |
1051 | prepareForTermination( TRUE ); | 1062 | prepareForTermination( TRUE ); |
1052 | 1063 | ||
1053 | #ifdef Q_WS_QWS | 1064 | #ifdef Q_WS_QWS |
1054 | 1065 | ||
1055 | for ( int fd = 3; fd < 100; fd++ ) | 1066 | for ( int fd = 3; fd < 100; fd++ ) |
1056 | close( fd ); | 1067 | close( fd ); |
1057 | #if defined(QT_DEMO_SINGLE_FLOPPY) | 1068 | #if defined(QT_DEMO_SINGLE_FLOPPY) |
1058 | 1069 | ||
1059 | execl( "/sbin/init", "qpe", 0 ); | 1070 | execl( "/sbin/init", "qpe", 0 ); |
1060 | #elif defined(QT_QWS_CASSIOPEIA) | 1071 | #elif defined(QT_QWS_CASSIOPEIA) |
1061 | 1072 | ||
1062 | execl( "/bin/sh", "sh", 0 ); | 1073 | execl( "/bin/sh", "sh", 0 ); |
1063 | #else | 1074 | #else |
1064 | 1075 | ||
1065 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); | 1076 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); |
1066 | #endif | 1077 | #endif |
1067 | 1078 | ||
1068 | exit( 1 ); | 1079 | exit( 1 ); |
1069 | #endif | 1080 | #endif |
1070 | } | 1081 | } |
1071 | 1082 | ||
1072 | void Desktop::startTransferServer() | 1083 | void Desktop::startTransferServer() |
1073 | { | 1084 | { |
1074 | // start qcop bridge server | 1085 | // start qcop bridge server |
1075 | qcopBridge = new QCopBridge( 4243 ); | 1086 | qcopBridge = new QCopBridge( 4243 ); |
1076 | if ( !qcopBridge->ok() ) { | 1087 | if ( !qcopBridge->ok() ) { |
1077 | delete qcopBridge; | 1088 | delete qcopBridge; |
1078 | qcopBridge = 0; | 1089 | qcopBridge = 0; |
1079 | } | 1090 | } |
1080 | // start transfer server | 1091 | // start transfer server |
1081 | transferServer = new TransferServer( 4242 ); | 1092 | transferServer = new TransferServer( 4242 ); |
1082 | if ( !transferServer->ok() ) { | 1093 | if ( !transferServer->ok() ) { |
1083 | delete transferServer; | 1094 | delete transferServer; |
1084 | transferServer = 0; | 1095 | transferServer = 0; |
1085 | } | 1096 | } |
1086 | if ( !transferServer || !qcopBridge ) | 1097 | if ( !transferServer || !qcopBridge ) |
1087 | startTimer( 2000 ); | 1098 | startTimer( 2000 ); |
1088 | } | 1099 | } |
1089 | 1100 | ||
1090 | void Desktop::timerEvent( QTimerEvent *e ) | 1101 | void Desktop::timerEvent( QTimerEvent *e ) |
1091 | { | 1102 | { |
1092 | killTimer( e->timerId() ); | 1103 | killTimer( e->timerId() ); |
1093 | startTransferServer(); | 1104 | startTransferServer(); |
1094 | } | 1105 | } |
1095 | 1106 | ||
1096 | void Desktop::terminateServers() | 1107 | void Desktop::terminateServers() |
1097 | { | 1108 | { |
1098 | delete transferServer; | 1109 | delete transferServer; |
1099 | delete qcopBridge; | 1110 | delete qcopBridge; |
1100 | transferServer = 0; | 1111 | transferServer = 0; |
1101 | qcopBridge = 0; | 1112 | qcopBridge = 0; |
1102 | } | 1113 | } |
1103 | 1114 | ||
1104 | void Desktop::rereadVolumes() | 1115 | void Desktop::rereadVolumes() |
1105 | { | 1116 | { |
1106 | Config cfg( "qpe" ); | 1117 | Config cfg( "qpe" ); |
1107 | cfg.setGroup( "Volume" ); | 1118 | cfg.setGroup( "Volume" ); |
1108 | touchclick = cfg.readBoolEntry( "TouchSound" ); | 1119 | touchclick = cfg.readBoolEntry( "TouchSound" ); |
1109 | keyclick = cfg.readBoolEntry( "KeySound" ); | 1120 | keyclick = cfg.readBoolEntry( "KeySound" ); |
1110 | alarmsound = cfg.readBoolEntry( "AlarmSound" ); | 1121 | alarmsound = cfg.readBoolEntry( "AlarmSound" ); |
1111 | } | 1122 | } |
1112 | 1123 | ||
1113 | void Desktop::keyClick() | 1124 | void Desktop::keyClick() |
1114 | { | 1125 | { |
1115 | if ( keyclick ) | 1126 | if ( keyclick ) |
1116 | ODevice::inst ( ) -> keySound ( ); | 1127 | ODevice::inst ( ) -> keySound ( ); |
1117 | } | 1128 | } |
1118 | 1129 | ||
1119 | void Desktop::screenClick() | 1130 | void Desktop::screenClick() |
1120 | { | 1131 | { |
1121 | if ( touchclick ) | 1132 | if ( touchclick ) |
1122 | ODevice::inst ( ) -> touchSound ( ); | 1133 | ODevice::inst ( ) -> touchSound ( ); |
1123 | } | 1134 | } |
1124 | 1135 | ||
1125 | void Desktop::soundAlarm() | 1136 | void Desktop::soundAlarm() |
1126 | { | 1137 | { |
1127 | if ( qpedesktop-> alarmsound ) | 1138 | if ( qpedesktop-> alarmsound ) |
1128 | ODevice::inst ( ) -> alarmSound ( ); | 1139 | ODevice::inst ( ) -> alarmSound ( ); |
1129 | } | 1140 | } |
1130 | 1141 | ||
1131 | bool Desktop::eventFilter( QObject *, QEvent *ev ) | 1142 | bool Desktop::eventFilter( QObject *, QEvent *ev ) |
1132 | { | 1143 | { |
1133 | if ( ev->type() == QEvent::KeyPress ) { | 1144 | if ( ev->type() == QEvent::KeyPress ) { |
1134 | QKeyEvent *ke = (QKeyEvent *)ev; | 1145 | QKeyEvent *ke = (QKeyEvent *)ev; |
1135 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 1146 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
1136 | QWidget *active = qApp->activeWindow(); | 1147 | QWidget *active = qApp->activeWindow(); |
1137 | if ( active && active->isPopup() ) { | 1148 | if ( active && active->isPopup() ) { |
1138 | active->close(); | 1149 | active->close(); |
1139 | } | 1150 | } |
1140 | raiseMenu(); | 1151 | raiseMenu(); |
1141 | return TRUE; | 1152 | return TRUE; |
1142 | } | 1153 | } |
1143 | } | 1154 | } |
1144 | return FALSE; | 1155 | return FALSE; |
1145 | } | 1156 | } |
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index 15d8ef7..8308811 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -1,153 +1,154 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef __DESKTOP_H__ | 21 | #ifndef __DESKTOP_H__ |
22 | #define __DESKTOP_H__ | 22 | #define __DESKTOP_H__ |
23 | 23 | ||
24 | 24 | ||
25 | #include "shutdownimpl.h" | 25 | #include "shutdownimpl.h" |
26 | 26 | ||
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | 31 | ||
32 | class Background; | 32 | class Background; |
33 | class Launcher; | 33 | class Launcher; |
34 | class TaskBar; | 34 | class TaskBar; |
35 | class PowerStatus; | 35 | class PowerStatus; |
36 | class QCopBridge; | 36 | class QCopBridge; |
37 | class TransferServer; | 37 | class TransferServer; |
38 | class DesktopPowerAlerter; | 38 | class DesktopPowerAlerter; |
39 | class PackageSlave; | 39 | class PackageSlave; |
40 | class QPEScreenSaver; | 40 | class QPEScreenSaver; |
41 | 41 | ||
42 | class DesktopApplication : public QPEApplication | 42 | class DesktopApplication : public QPEApplication |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | DesktopApplication( int& argc, char **argv, Type t ); | 46 | DesktopApplication( int& argc, char **argv, Type t ); |
47 | ~DesktopApplication(); | 47 | ~DesktopApplication(); |
48 | 48 | ||
49 | static void switchLCD ( bool on ); // only for togglePower in Desktop | 49 | static void switchLCD ( bool on ); // only for togglePower in Desktop |
50 | 50 | ||
51 | signals: | 51 | signals: |
52 | void menu(); | 52 | void menu(); |
53 | void home(); | 53 | void home(); |
54 | void datebook(); | 54 | void datebook(); |
55 | void contacts(); | 55 | void contacts(); |
56 | void launch(); | 56 | void launch(); |
57 | void email(); | 57 | void email(); |
58 | void backlight(); | 58 | void backlight(); |
59 | void power(); | 59 | void power(); |
60 | void symbol(); | 60 | void symbol(); |
61 | void numLockStateToggle(); | 61 | void numLockStateToggle(); |
62 | void capsLockStateToggle(); | 62 | void capsLockStateToggle(); |
63 | void prepareForRestart(); | 63 | void prepareForRestart(); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | #ifdef Q_WS_QWS | 66 | #ifdef Q_WS_QWS |
67 | 67 | ||
68 | bool qwsEventFilter( QWSEvent * ); | 68 | bool qwsEventFilter( QWSEvent * ); |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | void shutdown(); | 71 | void shutdown(); |
72 | void restart(); | 72 | void restart(); |
73 | 73 | ||
74 | public slots: | 74 | public slots: |
75 | virtual void desktopMessage ( const QCString &msg, const QByteArray &data ); | 75 | virtual void desktopMessage ( const QCString &msg, const QByteArray &data ); |
76 | virtual void systemMessage ( const QCString &msg, const QByteArray &data ); | 76 | virtual void systemMessage ( const QCString &msg, const QByteArray &data ); |
77 | 77 | ||
78 | protected slots: | 78 | protected slots: |
79 | void shutdown( ShutdownImpl::Type ); | 79 | void shutdown( ShutdownImpl::Type ); |
80 | void psTimeout(); | 80 | void psTimeout( int ); |
81 | void apmTimeout(); | ||
81 | void sendCard(); | 82 | void sendCard(); |
82 | private: | 83 | private: |
83 | void reloadPowerWarnSettings(); | 84 | void reloadPowerWarnSettings(); |
84 | DesktopPowerAlerter *pa; | 85 | DesktopPowerAlerter *pa; |
85 | PowerStatus *ps; | 86 | PowerStatus *ps; |
86 | QTimer *cardSendTimer; | 87 | QTimer *cardSendTimer; |
87 | QCopChannel *channel; | 88 | QCopChannel *channel; |
88 | QPEScreenSaver *m_screensaver; | 89 | QPEScreenSaver *m_screensaver; |
89 | QTimer * m_timer; | 90 | QTimer * m_timer; |
90 | int m_powerVeryLow; | 91 | int m_powerVeryLow; |
91 | int m_powerCritical; | 92 | int m_powerCritical; |
92 | 93 | int m_currentPowerLevel; | |
93 | }; | 94 | }; |
94 | 95 | ||
95 | 96 | ||
96 | class Desktop : public QWidget | 97 | class Desktop : public QWidget |
97 | { | 98 | { |
98 | Q_OBJECT | 99 | Q_OBJECT |
99 | public: | 100 | public: |
100 | Desktop(); | 101 | Desktop(); |
101 | ~Desktop(); | 102 | ~Desktop(); |
102 | 103 | ||
103 | static bool screenLocked(); | 104 | static bool screenLocked(); |
104 | 105 | ||
105 | void show(); | 106 | void show(); |
106 | void checkMemory(); | 107 | void checkMemory(); |
107 | 108 | ||
108 | void keyClick(); | 109 | void keyClick(); |
109 | void screenClick(); | 110 | void screenClick(); |
110 | static void soundAlarm(); | 111 | static void soundAlarm(); |
111 | 112 | ||
112 | public slots: | 113 | public slots: |
113 | void raiseDatebook(); | 114 | void raiseDatebook(); |
114 | void raiseContacts(); | 115 | void raiseContacts(); |
115 | void raiseMenu(); | 116 | void raiseMenu(); |
116 | void raiseLauncher(); | 117 | void raiseLauncher(); |
117 | void raiseEmail(); | 118 | void raiseEmail(); |
118 | void execAutoStart(); | 119 | void execAutoStart(); |
119 | void togglePower(); | 120 | void togglePower(); |
120 | void toggleLight(); | 121 | void toggleLight(); |
121 | void toggleNumLockState(); | 122 | void toggleNumLockState(); |
122 | void toggleCapsLockState(); | 123 | void toggleCapsLockState(); |
123 | void toggleSymbolInput(); | 124 | void toggleSymbolInput(); |
124 | void terminateServers(); | 125 | void terminateServers(); |
125 | void rereadVolumes(); | 126 | void rereadVolumes(); |
126 | 127 | ||
127 | void home ( ); | 128 | void home ( ); |
128 | 129 | ||
129 | protected: | 130 | protected: |
130 | void executeOrModify( const QString& appLnkFile ); | 131 | void executeOrModify( const QString& appLnkFile ); |
131 | void styleChange( QStyle & ); | 132 | void styleChange( QStyle & ); |
132 | void timerEvent( QTimerEvent *e ); | 133 | void timerEvent( QTimerEvent *e ); |
133 | bool eventFilter( QObject *, QEvent * ); | 134 | bool eventFilter( QObject *, QEvent * ); |
134 | 135 | ||
135 | QWidget *bg; | 136 | QWidget *bg; |
136 | Launcher *launcher; | 137 | Launcher *launcher; |
137 | TaskBar *tb; | 138 | TaskBar *tb; |
138 | 139 | ||
139 | private: | 140 | private: |
140 | void startTransferServer(); | 141 | void startTransferServer(); |
141 | bool recoverMemory(); | 142 | bool recoverMemory(); |
142 | 143 | ||
143 | QCopBridge *qcopBridge; | 144 | QCopBridge *qcopBridge; |
144 | TransferServer *transferServer; | 145 | TransferServer *transferServer; |
145 | PackageSlave *packageSlave; | 146 | PackageSlave *packageSlave; |
146 | 147 | ||
147 | QDateTime suspendTime; | 148 | QDateTime suspendTime; |
148 | bool keyclick, touchclick, alarmsound; | 149 | bool keyclick, touchclick, alarmsound; |
149 | }; | 150 | }; |
150 | 151 | ||
151 | 152 | ||
152 | #endif // __DESKTOP_H__ | 153 | #endif // __DESKTOP_H__ |
153 | 154 | ||