-rw-r--r-- | core/launcher/serverapp.cpp | 106 |
1 files changed, 58 insertions, 48 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index f1bce40..a2302d8 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp | |||
@@ -29,84 +29,90 @@ | |||
29 | #include <qtopia/config.h> | 29 | #include <qtopia/config.h> |
30 | #include <qtopia/power.h> | 30 | #include <qtopia/power.h> |
31 | 31 | ||
32 | #ifdef Q_WS_QWS | 32 | #ifdef Q_WS_QWS |
33 | #include <qtopia/qcopenvelope_qws.h> | 33 | #include <qtopia/qcopenvelope_qws.h> |
34 | #endif | 34 | #endif |
35 | #include <qtopia/global.h> | 35 | #include <qtopia/global.h> |
36 | using namespace Opie::Core; | 36 | using namespace Opie::Core; |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | #ifdef Q_WS_QWS | 39 | #ifdef Q_WS_QWS |
40 | #include <qgfx_qws.h> | 40 | #include <qgfx_qws.h> |
41 | #endif | 41 | #endif |
42 | #include <qmessagebox.h> | 42 | #include <qmessagebox.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qpainter.h> | 44 | #include <qpainter.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | #include <qpixmapcache.h> | 46 | #include <qpixmapcache.h> |
47 | 47 | ||
48 | /* STD */ | 48 | /* STD */ |
49 | #ifdef Q_OS_WIN32 | 49 | #ifdef Q_OS_WIN32 |
50 | #include <io.h> | 50 | #include <io.h> |
51 | #include <process.h> | 51 | #include <process.h> |
52 | #else | 52 | #else |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | #endif | 54 | #endif |
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | 56 | ||
57 | static ServerApplication *serverApp = 0; | 57 | static ServerApplication *serverApp = 0; |
58 | static int loggedin=0; | 58 | static int loggedin=0; |
59 | 59 | ||
60 | QCopKeyRegister::QCopKeyRegister() | 60 | QCopKeyRegister::QCopKeyRegister() |
61 | : m_keyCode( 0 ) { | 61 | : m_keyCode( 0 ) |
62 | { | ||
62 | } | 63 | } |
63 | 64 | ||
64 | QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) | 65 | QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) |
65 | :m_keyCode( k ), m_channel( c ), m_message( m ) { | 66 | :m_keyCode( k ), m_channel( c ), m_message( m ) |
67 | { | ||
66 | } | 68 | } |
67 | 69 | ||
68 | int QCopKeyRegister::keyCode()const { | 70 | int QCopKeyRegister::keyCode() const |
71 | { | ||
69 | return m_keyCode; | 72 | return m_keyCode; |
70 | } | 73 | } |
71 | 74 | ||
72 | QCString QCopKeyRegister::channel()const { | 75 | QCString QCopKeyRegister::channel() const |
76 | { | ||
73 | return m_channel; | 77 | return m_channel; |
74 | } | 78 | } |
75 | 79 | ||
76 | QCString QCopKeyRegister::message()const { | 80 | QCString QCopKeyRegister::message() const |
81 | { | ||
77 | return m_message; | 82 | return m_message; |
78 | } | 83 | } |
79 | 84 | ||
80 | bool QCopKeyRegister::send() { | 85 | bool QCopKeyRegister::send() |
86 | { | ||
81 | if (m_channel.isNull() ) | 87 | if (m_channel.isNull() ) |
82 | return false; | 88 | return false; |
83 | 89 | ||
84 | QCopEnvelope( m_channel, m_message ); | 90 | QCopEnvelope( m_channel, m_message ); |
85 | 91 | ||
86 | return true; | 92 | return true; |
87 | } | 93 | } |
88 | 94 | ||
89 | //--------------------------------------------------------------------------- | 95 | //--------------------------------------------------------------------------- |
90 | 96 | ||
91 | /* | 97 | /* |
92 | Priority is number of alerts that are needed to pop up | 98 | Priority is number of alerts that are needed to pop up |
93 | alert. | 99 | alert. |
94 | */ | 100 | */ |
95 | class DesktopPowerAlerter : public QMessageBox | 101 | class DesktopPowerAlerter : public QMessageBox |
96 | { | 102 | { |
97 | Q_OBJECT | 103 | Q_OBJECT |
98 | public: | 104 | public: |
99 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 105 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
100 | : QMessageBox( tr("Battery Status"), tr("Low Battery"), | 106 | : QMessageBox( tr("Battery Status"), tr("Low Battery"), |
101 | QMessageBox::Critical, | 107 | QMessageBox::Critical, |
102 | QMessageBox::Ok | QMessageBox::Default, | 108 | QMessageBox::Ok | QMessageBox::Default, |
103 | QMessageBox::NoButton, QMessageBox::NoButton, | 109 | QMessageBox::NoButton, QMessageBox::NoButton, |
104 | parent, name, FALSE ) | 110 | parent, name, FALSE ) |
105 | { | 111 | { |
106 | currentPriority = INT_MAX; | 112 | currentPriority = INT_MAX; |
107 | alertCount = 0; | 113 | alertCount = 0; |
108 | } | 114 | } |
109 | 115 | ||
110 | void alert( const QString &text, int priority ); | 116 | void alert( const QString &text, int priority ); |
111 | void hideEvent( QHideEvent * ); | 117 | void hideEvent( QHideEvent * ); |
112 | private: | 118 | private: |
@@ -128,104 +134,105 @@ void DesktopPowerAlerter::alert( const QString &text, int priority ) | |||
128 | 134 | ||
129 | 135 | ||
130 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 136 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
131 | { | 137 | { |
132 | QMessageBox::hideEvent( e ); | 138 | QMessageBox::hideEvent( e ); |
133 | alertCount = 0; | 139 | alertCount = 0; |
134 | currentPriority = INT_MAX; | 140 | currentPriority = INT_MAX; |
135 | } | 141 | } |
136 | 142 | ||
137 | //--------------------------------------------------------------------------- | 143 | //--------------------------------------------------------------------------- |
138 | 144 | ||
139 | KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0) | 145 | KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0) |
140 | { | 146 | { |
141 | /* We don't do this cause it would interfere with ODevice */ | 147 | /* We don't do this cause it would interfere with ODevice */ |
142 | #if 0 | 148 | #if 0 |
143 | qwsServer->setKeyboardFilter(this); | 149 | qwsServer->setKeyboardFilter(this); |
144 | #endif | 150 | #endif |
145 | } | 151 | } |
146 | 152 | ||
147 | void KeyFilter::timerEvent(QTimerEvent* e) | 153 | void KeyFilter::timerEvent(QTimerEvent* e) |
148 | { | 154 | { |
149 | if ( e->timerId() == held_tid ) { | 155 | if ( e->timerId() == held_tid ) { |
150 | killTimer(held_tid); | 156 | killTimer(held_tid); |
151 | // button held | 157 | // button held |
152 | if ( heldButton ) { | 158 | if ( heldButton ) { |
153 | emit activate(heldButton, TRUE); | 159 | emit activate(heldButton, TRUE); |
154 | heldButton = 0; | 160 | heldButton = 0; |
155 | } | 161 | } |
156 | held_tid = 0; | 162 | held_tid = 0; |
157 | } | 163 | } |
158 | } | 164 | } |
159 | 165 | ||
160 | void KeyFilter::registerKey( const QCopKeyRegister& key ) { | 166 | void KeyFilter::registerKey( const QCopKeyRegister& key ) |
167 | { | ||
161 | m_keys.insert( key.keyCode(), key ); | 168 | m_keys.insert( key.keyCode(), key ); |
162 | } | 169 | } |
163 | 170 | ||
164 | void KeyFilter::unregisterKey( const QCopKeyRegister& key ) { | 171 | void KeyFilter::unregisterKey( const QCopKeyRegister& key ) |
172 | { | ||
165 | m_keys.remove( key.keyCode() ); | 173 | m_keys.remove( key.keyCode() ); |
166 | } | 174 | } |
167 | 175 | ||
168 | bool KeyFilter::keyRegistered( int key ) { | 176 | bool KeyFilter::keyRegistered( int key ) |
177 | { | ||
169 | /* | 178 | /* |
170 | * Check if we've a key registered | 179 | * Check if we've a key registered |
171 | */ | 180 | */ |
172 | if ( !m_keys[key].send()) | 181 | if ( !m_keys[key].send()) |
173 | return false; | 182 | return false; |
174 | else | 183 | else |
175 | return true; | 184 | return true; |
176 | |||
177 | } | 185 | } |
178 | 186 | ||
179 | bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepeat) | 187 | bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepeat) |
180 | { | 188 | { |
181 | if ( !loggedin | 189 | if ( !loggedin |
182 | // Permitted keys | 190 | // Permitted keys |
183 | && keycode != Key_F34 // power | 191 | && keycode != Key_F34 // power |
184 | && keycode != Key_F30 // select | 192 | && keycode != Key_F30 // select |
185 | && keycode != Key_Enter | 193 | && keycode != Key_Enter |
186 | && keycode != Key_Return | 194 | && keycode != Key_Return |
187 | && keycode != Key_Space | 195 | && keycode != Key_Space |
188 | && keycode != Key_Left | 196 | && keycode != Key_Left |
189 | && keycode != Key_Right | 197 | && keycode != Key_Right |
190 | && keycode != Key_Up | 198 | && keycode != Key_Up |
191 | && keycode != Key_Down ) | 199 | && keycode != Key_Down ) |
192 | return TRUE; | 200 | return TRUE; |
193 | 201 | ||
194 | /* check if it was registered */ | 202 | /* check if it was registered */ |
195 | if (!db ) { | 203 | if (!db ) { |
196 | if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) ) | 204 | if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) ) |
197 | return true; | 205 | return true; |
198 | }else { | 206 | } else { |
199 | |||
200 | 207 | ||
201 | // First check to see if DeviceButtonManager knows something about this button: | 208 | // First check to see if DeviceButtonManager knows something about this button: |
202 | const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode); | 209 | const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode); |
203 | if (button && !autoRepeat) { | 210 | if (button && !autoRepeat) { |
204 | if ( held_tid ) { | 211 | if ( held_tid ) { |
205 | killTimer(held_tid); | 212 | killTimer(held_tid); |
206 | held_tid = 0; | 213 | held_tid = 0; |
207 | } | 214 | } |
208 | if ( button->heldAction().isNull() ) { | 215 | if ( button->heldAction().isNull() ) { |
209 | if ( press ) | 216 | if ( press ) |
210 | emit activate(button, FALSE); | 217 | emit activate(button, FALSE); |
211 | } else if ( press ) { | 218 | } else if ( press ) { |
212 | heldButton = button; | 219 | heldButton = button; |
213 | held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); | 220 | held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); |
214 | } else if ( heldButton ) { | 221 | } else if ( heldButton ) { |
215 | heldButton = 0; | 222 | heldButton = 0; |
216 | emit activate(button, FALSE); | 223 | emit activate(button, FALSE); |
217 | } | 224 | } |
218 | QWSServer::screenSaverActivate(FALSE); | 225 | QWSServer::screenSaverActivate(FALSE); |
219 | return TRUE; | 226 | return TRUE; |
220 | } | 227 | } |
221 | return false; | 228 | return false; |
222 | } | 229 | } |
223 | if ( keycode == HardKey_Suspend ) { | 230 | if ( keycode == HardKey_Suspend ) { |
224 | if ( press ) emit power(); | 231 | if ( press ) emit power(); |
225 | return TRUE; | 232 | return TRUE; |
226 | } | 233 | } |
227 | if ( keycode == HardKey_Backlight ) { | 234 | if ( keycode == HardKey_Backlight ) { |
228 | if ( press ) emit backlight(); | 235 | if ( press ) emit backlight(); |
229 | return TRUE; | 236 | return TRUE; |
230 | } | 237 | } |
231 | if ( keycode == Key_F32 ) { | 238 | if ( keycode == Key_F32 ) { |
@@ -237,77 +244,78 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe | |||
237 | if ( keycode == Key_F31 ) { | 244 | if ( keycode == Key_F31 ) { |
238 | if ( press ) emit symbol(); | 245 | if ( press ) emit symbol(); |
239 | QWSServer::screenSaverActivate(FALSE); | 246 | QWSServer::screenSaverActivate(FALSE); |
240 | return TRUE; | 247 | return TRUE; |
241 | } | 248 | } |
242 | 249 | ||
243 | if ( keycode == Key_NumLock ) | 250 | if ( keycode == Key_NumLock ) |
244 | if ( press ) emit numLockStateToggle(); | 251 | if ( press ) emit numLockStateToggle(); |
245 | 252 | ||
246 | if ( keycode == Key_CapsLock ) | 253 | if ( keycode == Key_CapsLock ) |
247 | if ( press ) emit capsLockStateToggle(); | 254 | if ( press ) emit capsLockStateToggle(); |
248 | 255 | ||
249 | if ( serverApp ) | 256 | if ( serverApp ) |
250 | serverApp->keyClick(keycode,press,autoRepeat); | 257 | serverApp->keyClick(keycode,press,autoRepeat); |
251 | 258 | ||
252 | return FALSE; | 259 | return FALSE; |
253 | } | 260 | } |
254 | 261 | ||
255 | enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown; | 262 | enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown; |
256 | 263 | ||
257 | #if defined(QPE_HAVE_MEMALERTER) | 264 | #if defined(QPE_HAVE_MEMALERTER) |
258 | QPE_MEMALERTER_IMPL | 265 | QPE_MEMALERTER_IMPL |
259 | #endif | 266 | #endif |
260 | 267 | ||
261 | 268 | ||
262 | 269 | ||
263 | //--------------------------------------------------------------------------- | 270 | //--------------------------------------------------------------------------- |
264 | 271 | ||
265 | bool ServerApplication::doRestart = FALSE; | 272 | bool ServerApplication::doRestart = FALSE; |
266 | bool ServerApplication::allowRestart = TRUE; | 273 | bool ServerApplication::allowRestart = TRUE; |
267 | bool ServerApplication::ms_is_starting = TRUE; | 274 | bool ServerApplication::ms_is_starting = TRUE; |
268 | 275 | ||
269 | void ServerApplication::switchLCD( bool on ) { | 276 | void ServerApplication::switchLCD( bool on ) |
277 | { | ||
270 | if ( !qApp ) | 278 | if ( !qApp ) |
271 | return; | 279 | return; |
272 | 280 | ||
273 | ServerApplication *dapp = ServerApplication::me() ; | 281 | ServerApplication *dapp = ServerApplication::me() ; |
274 | 282 | ||
275 | if ( !dapp-> m_screensaver ) | 283 | if ( !dapp-> m_screensaver ) |
276 | return; | 284 | return; |
277 | 285 | ||
278 | if ( on ) { | 286 | if ( on ) { |
279 | dapp-> m_screensaver-> setDisplayState ( true ); | 287 | dapp-> m_screensaver-> setDisplayState ( true ); |
280 | dapp-> m_screensaver-> setBacklight ( -3 ); | 288 | dapp-> m_screensaver-> setBacklight ( -3 ); |
281 | }else | 289 | } else |
282 | dapp-> m_screensaver-> setDisplayState ( false ); | 290 | dapp-> m_screensaver-> setDisplayState ( false ); |
283 | 291 | ||
284 | 292 | ||
285 | } | 293 | } |
286 | 294 | ||
287 | ServerApplication::ServerApplication( int& argc, char **argv, Type t ) | 295 | ServerApplication::ServerApplication( int& argc, char **argv, Type t ) |
288 | : QPEApplication( argc, argv, t ) | 296 | : QPEApplication( argc, argv, t ) |
289 | { | 297 | { |
290 | ms_is_starting = true; | 298 | ms_is_starting = true; |
291 | 299 | ||
292 | // We know we'll have lots of cached pixmaps due to App/DocLnks | 300 | // We know we'll have lots of cached pixmaps due to App/DocLnks |
293 | QPixmapCache::setCacheLimit(512); | 301 | QPixmapCache::setCacheLimit(512); |
294 | 302 | ||
295 | m_ps = new PowerStatus; | 303 | m_ps = new PowerStatus; |
296 | m_ps_last = new PowerStatus; | 304 | m_ps_last = new PowerStatus; |
297 | pa = new DesktopPowerAlerter( 0 ); | 305 | pa = new DesktopPowerAlerter( 0 ); |
298 | 306 | ||
299 | m_apm_timer = new QTimer( this ); | 307 | m_apm_timer = new QTimer( this ); |
300 | connect(m_apm_timer, SIGNAL( timeout() ), | 308 | connect(m_apm_timer, SIGNAL( timeout() ), |
301 | this, SLOT( apmTimeout() ) ); | 309 | this, SLOT( apmTimeout() ) ); |
302 | 310 | ||
303 | reloadPowerWarnSettings(); | 311 | reloadPowerWarnSettings(); |
304 | 312 | ||
305 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 313 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
306 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), | 314 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
307 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); | 315 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); |
308 | 316 | ||
309 | channel = new QCopChannel("QPE/Launcher", this ); | 317 | channel = new QCopChannel("QPE/Launcher", this ); |
310 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), | 318 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
311 | this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) ); | 319 | this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) ); |
312 | 320 | ||
313 | m_screensaver = new OpieScreenSaver(); | 321 | m_screensaver = new OpieScreenSaver(); |
@@ -330,114 +338,115 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t ) | |||
330 | connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); | 338 | connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); |
331 | connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); | 339 | connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); |
332 | connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); | 340 | connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); |
333 | connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); | 341 | connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); |
334 | connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); | 342 | connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); |
335 | connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); | 343 | connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); |
336 | connect( kf, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), | 344 | connect( kf, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), |
337 | this,SIGNAL(activate(const Opie::Core::ODeviceButton*,bool))); | 345 | this,SIGNAL(activate(const Opie::Core::ODeviceButton*,bool))); |
338 | 346 | ||
339 | 347 | ||
340 | connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); | 348 | connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); |
341 | 349 | ||
342 | connect( this, SIGNAL(power() ), | 350 | connect( this, SIGNAL(power() ), |
343 | SLOT(togglePower() ) ); | 351 | SLOT(togglePower() ) ); |
344 | 352 | ||
345 | rereadVolumes(); | 353 | rereadVolumes(); |
346 | 354 | ||
347 | serverApp = this; | 355 | serverApp = this; |
348 | 356 | ||
349 | apmTimeout(); | 357 | apmTimeout(); |
350 | grabKeyboard(); | 358 | grabKeyboard(); |
351 | 359 | ||
352 | /* make sure the event filter is installed */ | 360 | /* make sure the event filter is installed */ |
353 | const ODeviceButton* but = ODevice::inst()->buttonForKeycode( -1 ); | 361 | const ODeviceButton* but = ODevice::inst()->buttonForKeycode( -1 ); |
354 | Q_CONST_UNUSED( but ) | 362 | Q_CONST_UNUSED( but ) |
355 | } | 363 | } |
356 | 364 | ||
357 | 365 | ||
358 | ServerApplication::~ServerApplication() | 366 | ServerApplication::~ServerApplication() |
359 | { | 367 | { |
360 | ungrabKeyboard(); | 368 | ungrabKeyboard(); |
361 | 369 | ||
362 | |||
363 | delete pa; | 370 | delete pa; |
364 | delete m_ps; | 371 | delete m_ps; |
365 | delete m_ps_last; | 372 | delete m_ps_last; |
366 | } | 373 | } |
367 | 374 | ||
368 | void ServerApplication::apmTimeout() { | 375 | void ServerApplication::apmTimeout() |
376 | { | ||
369 | serverApp-> checkMemory( ); // in case no events are generated | 377 | serverApp-> checkMemory( ); // in case no events are generated |
370 | *m_ps_last = *m_ps; | 378 | *m_ps_last = *m_ps; |
371 | *m_ps = PowerStatusManager::readStatus(); | 379 | *m_ps = PowerStatusManager::readStatus(); |
372 | 380 | ||
373 | if ( m_ps->acStatus() != m_ps_last-> acStatus() ) | 381 | if ( m_ps->acStatus() != m_ps_last-> acStatus() ) |
374 | m_screensaver-> powerStatusChanged( *m_ps ); | 382 | m_screensaver-> powerStatusChanged( *m_ps ); |
375 | 383 | ||
376 | if ( m_ps->acStatus() == PowerStatus::Online ) { | 384 | if ( m_ps->acStatus() == PowerStatus::Online ) { |
377 | return; | 385 | return; |
378 | } | 386 | } |
379 | 387 | ||
380 | int bat = m_ps-> batteryPercentRemaining(); | 388 | int bat = m_ps-> batteryPercentRemaining(); |
381 | 389 | ||
382 | if ( bat < m_ps_last-> batteryPercentRemaining() ) { | 390 | if ( bat < m_ps_last-> batteryPercentRemaining() ) { |
383 | if ( bat <= m_powerCritical ) { | 391 | if ( bat <= m_powerCritical ) { |
384 | QMessageBox battlow( | 392 | QMessageBox battlow( |
385 | tr("WARNING"), | 393 | tr("WARNING"), |
386 | tr("<p>The battery level is critical!" | 394 | tr("<p>The battery level is critical!" |
387 | "<p>Keep power off until AC is restored"), | 395 | "<p>Keep power off until AC is restored"), |
388 | QMessageBox::Warning, | 396 | QMessageBox::Warning, |
389 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, | 397 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, |
390 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 398 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
391 | battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); | 399 | battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); |
392 | battlow.exec(); | 400 | battlow.exec(); |
393 | } else if ( bat <= m_powerVeryLow ) | 401 | } else if ( bat <= m_powerVeryLow ) |
394 | pa->alert( tr( "The battery is running very low. "), 2 ); | 402 | pa->alert( tr( "The battery is running very low. "), 2 ); |
395 | } | 403 | } |
396 | 404 | ||
397 | if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { | 405 | if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { |
398 | QMessageBox battlow( | 406 | QMessageBox battlow( |
399 | tr("WARNING"), | 407 | tr("WARNING"), |
400 | tr("<p>The Back-up battery is very low" | 408 | tr("<p>The Back-up battery is very low" |
401 | "<p>Please charge the back-up battery"), | 409 | "<p>Please charge the back-up battery"), |
402 | QMessageBox::Warning, | 410 | QMessageBox::Warning, |
403 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, | 411 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, |
404 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 412 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
405 | battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); | 413 | battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); |
406 | battlow.exec(); | 414 | battlow.exec(); |
407 | } | 415 | } |
408 | } | 416 | } |
409 | 417 | ||
410 | void ServerApplication::systemMessage( const QCString& msg, | 418 | void ServerApplication::systemMessage( const QCString& msg, |
411 | const QByteArray& data ) { | 419 | const QByteArray& data ) |
420 | { | ||
412 | QDataStream stream ( data, IO_ReadOnly ); | 421 | QDataStream stream ( data, IO_ReadOnly ); |
413 | 422 | ||
414 | if ( msg == "setScreenSaverInterval(int)" ) { | 423 | if ( msg == "setScreenSaverInterval(int)" ) { |
415 | int time; | 424 | int time; |
416 | stream >> time; | 425 | stream >> time; |
417 | m_screensaver-> setInterval( time ); | 426 | m_screensaver-> setInterval( time ); |
418 | } | 427 | } |
419 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | 428 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { |
420 | int t1, t2, t3; | 429 | int t1, t2, t3; |
421 | stream >> t1 >> t2 >> t3; | 430 | stream >> t1 >> t2 >> t3; |
422 | m_screensaver-> setIntervals( t1, t2, t3 ); | 431 | m_screensaver-> setIntervals( t1, t2, t3 ); |
423 | } | 432 | } |
424 | else if ( msg == "setBacklight(int)" ) { | 433 | else if ( msg == "setBacklight(int)" ) { |
425 | int bright; | 434 | int bright; |
426 | stream >> bright; | 435 | stream >> bright; |
427 | m_screensaver-> setBacklight( bright ); | 436 | m_screensaver-> setBacklight( bright ); |
428 | } | 437 | } |
429 | else if ( msg == "setScreenSaverMode(int)" ) { | 438 | else if ( msg == "setScreenSaverMode(int)" ) { |
430 | int mode; | 439 | int mode; |
431 | stream >> mode; | 440 | stream >> mode; |
432 | m_screensaver-> setMode ( mode ); | 441 | m_screensaver-> setMode ( mode ); |
433 | } | 442 | } |
434 | else if ( msg == "reloadPowerWarnSettings()" ) { | 443 | else if ( msg == "reloadPowerWarnSettings()" ) { |
435 | reloadPowerWarnSettings(); | 444 | reloadPowerWarnSettings(); |
436 | } | 445 | } |
437 | else if ( msg == "setDisplayState(int)" ) { | 446 | else if ( msg == "setDisplayState(int)" ) { |
438 | int state; | 447 | int state; |
439 | stream >> state; | 448 | stream >> state; |
440 | m_screensaver-> setDisplayState ( state != 0 ); | 449 | m_screensaver-> setDisplayState ( state != 0 ); |
441 | } | 450 | } |
442 | else if ( msg == "suspend()" ) { | 451 | else if ( msg == "suspend()" ) { |
443 | emit power(); | 452 | emit power(); |
@@ -492,275 +501,276 @@ void ServerApplication::launcherMessage( const QCString & msg, const QByteArray | |||
492 | bool ServerApplication::screenLocked() | 501 | bool ServerApplication::screenLocked() |
493 | { | 502 | { |
494 | return loggedin == 0; | 503 | return loggedin == 0; |
495 | } | 504 | } |
496 | 505 | ||
497 | void ServerApplication::login(bool at_poweron) | 506 | void ServerApplication::login(bool at_poweron) |
498 | { | 507 | { |
499 | if ( !loggedin ) { | 508 | if ( !loggedin ) { |
500 | Global::terminateBuiltin("calibrate"); // No tr | 509 | Global::terminateBuiltin("calibrate"); // No tr |
501 | Opie::Security::MultiauthPassword::authenticate(at_poweron); | 510 | Opie::Security::MultiauthPassword::authenticate(at_poweron); |
502 | loggedin=1; | 511 | loggedin=1; |
503 | #ifndef QT_NO_COP | 512 | #ifndef QT_NO_COP |
504 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 513 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
505 | #endif | 514 | #endif |
506 | } | 515 | } |
507 | } | 516 | } |
508 | 517 | ||
509 | #if defined(QPE_HAVE_TOGGLELIGHT) | 518 | #if defined(QPE_HAVE_TOGGLELIGHT) |
510 | #include <qtopia/config.h> | 519 | #include <qtopia/config.h> |
511 | 520 | ||
512 | #include <sys/ioctl.h> | 521 | #include <sys/ioctl.h> |
513 | #include <sys/types.h> | 522 | #include <sys/types.h> |
514 | #include <fcntl.h> | 523 | #include <fcntl.h> |
515 | #include <unistd.h> | 524 | #include <unistd.h> |
516 | #include <errno.h> | 525 | #include <errno.h> |
517 | #include <linux/ioctl.h> | 526 | #include <linux/ioctl.h> |
518 | #include <time.h> | 527 | #include <time.h> |
519 | #endif | 528 | #endif |
520 | 529 | ||
521 | namespace { | 530 | namespace { |
522 | void execAutoStart(const QDateTime& suspendTime ) { | 531 | void execAutoStart(const QDateTime& suspendTime ) { |
523 | QString appName; | 532 | QString appName; |
524 | int delay; | 533 | int delay; |
525 | QDateTime now = QDateTime::currentDateTime(); | 534 | QDateTime now = QDateTime::currentDateTime(); |
526 | 535 | ||
527 | Config cfg( "autostart" ); | 536 | Config cfg( "autostart" ); |
528 | cfg.setGroup( "AutoStart" ); | 537 | cfg.setGroup( "AutoStart" ); |
529 | appName = cfg.readEntry( "Apps", "" ); | 538 | appName = cfg.readEntry( "Apps", "" ); |
530 | delay = cfg.readNumEntry( "Delay", 0 ); | 539 | delay = cfg.readNumEntry( "Delay", 0 ); |
531 | 540 | ||
532 | // If the time between suspend and resume was longer then the | 541 | // If the time between suspend and resume was longer then the |
533 | // value saved as delay, start the app | 542 | // value saved as delay, start the app |
534 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 543 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
535 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 544 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
536 | e << QString( appName ); | 545 | e << QString( appName ); |
537 | } | 546 | } |
538 | } | 547 | } |
539 | } | 548 | } |
540 | 549 | ||
541 | 550 | ||
542 | void ServerApplication::togglePower() | 551 | void ServerApplication::togglePower() |
543 | { | 552 | { |
544 | static bool excllock = false; | 553 | static bool excllock = false; |
545 | 554 | ||
546 | if ( excllock ) | 555 | if ( excllock ) |
547 | return ; | 556 | return ; |
548 | 557 | ||
549 | excllock = true; | 558 | excllock = true; |
550 | 559 | ||
551 | bool wasloggedin = loggedin; | 560 | bool wasloggedin = loggedin; |
552 | loggedin = 0; | 561 | loggedin = 0; |
553 | m_suspendTime = QDateTime::currentDateTime(); | 562 | m_suspendTime = QDateTime::currentDateTime(); |
554 | 563 | ||
555 | #ifdef QWS | 564 | #ifdef QWS |
556 | |||
557 | if ( Opie::Security::MultiauthPassword::needToAuthenticate ( true ) && qt_screen ) { | 565 | if ( Opie::Security::MultiauthPassword::needToAuthenticate ( true ) && qt_screen ) { |
558 | // Should use a big black window instead. | 566 | // Should use a big black window instead. |
559 | // But this would not show up fast enough | 567 | // But this would not show up fast enough |
560 | QGfx *g = qt_screen-> screenGfx ( ); | 568 | QGfx *g = qt_screen-> screenGfx ( ); |
561 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); | 569 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); |
562 | delete g; | 570 | delete g; |
563 | } | 571 | } |
564 | #endif | 572 | #endif |
565 | 573 | ||
566 | ODevice::inst ( )-> suspend ( ); | 574 | ODevice::inst ( )-> suspend ( ); |
567 | 575 | ||
568 | ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call | 576 | ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call |
569 | QWSServer::screenSaverActivate ( false ); | 577 | QWSServer::screenSaverActivate ( false ); |
570 | 578 | ||
571 | { | 579 | { |
572 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep | 580 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep |
573 | } | 581 | } |
574 | 582 | ||
575 | if ( wasloggedin ) | 583 | if ( wasloggedin ) |
576 | login ( true ); | 584 | login ( true ); |
577 | 585 | ||
578 | execAutoStart(m_suspendTime); | 586 | execAutoStart(m_suspendTime); |
579 | //qcopBridge->closeOpenConnections(); | 587 | //qcopBridge->closeOpenConnections(); |
580 | 588 | ||
581 | excllock = false; | 589 | excllock = false; |
582 | } | 590 | } |
583 | 591 | ||
584 | void ServerApplication::toggleLight() | 592 | void ServerApplication::toggleLight() |
585 | { | 593 | { |
586 | #ifndef QT_NO_COP | 594 | #ifndef QT_NO_COP |
587 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 595 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
588 | e << -2; // toggle | 596 | e << -2; // toggle |
589 | #endif | 597 | #endif |
590 | } | 598 | } |
591 | 599 | ||
592 | 600 | ||
593 | /* | 601 | /* |
594 | * We still listen to key events but handle them in | 602 | * We still listen to key events but handle them in |
595 | * a special class | 603 | * a special class |
596 | */ | 604 | */ |
597 | 605 | ||
598 | bool ServerApplication::eventFilter( QObject *o, QEvent *e) { | 606 | bool ServerApplication::eventFilter( QObject *o, QEvent *e) { |
599 | if ( e->type() != QEvent::KeyPress && | 607 | if ( e->type() != QEvent::KeyPress && |
600 | e->type() != QEvent::KeyRelease ) | 608 | e->type() != QEvent::KeyRelease ) |
601 | return QPEApplication::eventFilter( o, e ); | 609 | return QPEApplication::eventFilter( o, e ); |
602 | 610 | ||
603 | QKeyEvent *ke = static_cast<QKeyEvent*>( e ); | 611 | QKeyEvent *ke = static_cast<QKeyEvent*>( e ); |
604 | if ( kf->checkButtonAction( true, ke->key(), | 612 | if ( kf->checkButtonAction( true, ke->key(), |
605 | e->type() == QEvent::KeyPress, | 613 | e->type() == QEvent::KeyPress, |
606 | ke-> isAutoRepeat() )) | 614 | ke-> isAutoRepeat() )) |
607 | return true; | 615 | return true; |
608 | 616 | ||
609 | return QPEApplication::eventFilter( o, e ); | 617 | return QPEApplication::eventFilter( o, e ); |
610 | 618 | ||
611 | } | 619 | } |
612 | 620 | ||
613 | #ifdef Q_WS_QWS | 621 | #ifdef Q_WS_QWS |
614 | bool ServerApplication::qwsEventFilter( QWSEvent *e ) | 622 | bool ServerApplication::qwsEventFilter( QWSEvent *e ) |
615 | { | 623 | { |
616 | checkMemory(); | 624 | checkMemory(); |
617 | 625 | ||
618 | if ( e->type == QWSEvent::Mouse ) { | 626 | if ( e->type == QWSEvent::Mouse ) { |
619 | QWSMouseEvent *me = (QWSMouseEvent *)e; | 627 | QWSMouseEvent *me = (QWSMouseEvent *)e; |
620 | static bool up = TRUE; | 628 | static bool up = TRUE; |
621 | if ( me->simpleData.state&LeftButton ) { | 629 | if ( me->simpleData.state&LeftButton ) { |
622 | if ( up ) { | 630 | if ( up ) { |
623 | up = FALSE; | 631 | up = FALSE; |
624 | screenClick(TRUE); | 632 | screenClick(TRUE); |
633 | } | ||
634 | } else if ( !up ) { | ||
635 | up = TRUE; | ||
636 | screenClick(FALSE); | ||
625 | } | 637 | } |
626 | } else if ( !up ) { | 638 | } else |
627 | up = TRUE; | 639 | if ( e->type == QWSEvent::Key ) { |
628 | screenClick(FALSE); | ||
629 | } | ||
630 | }else if ( e->type == QWSEvent::Key ) { | ||
631 | QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e ); | 640 | QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e ); |
632 | if ( kf->checkButtonAction( false, | 641 | if ( kf->checkButtonAction( false, |
633 | ke-> simpleData.keycode, | 642 | ke-> simpleData.keycode, |
634 | ke-> simpleData.is_press, | 643 | ke-> simpleData.is_press, |
635 | ke-> simpleData.is_auto_repeat ) ) | 644 | ke-> simpleData.is_auto_repeat ) ) |
636 | return true; | 645 | return true; |
637 | } | 646 | } |
638 | 647 | ||
639 | return QPEApplication::qwsEventFilter( e ); | 648 | return QPEApplication::qwsEventFilter( e ); |
640 | } | 649 | } |
641 | #endif | 650 | #endif |
642 | 651 | ||
643 | 652 | ||
644 | /* ### FIXME libqtopia Plugin Safe Mode */ | 653 | /* ### FIXME libqtopia Plugin Safe Mode */ |
645 | 654 | ||
646 | void ServerApplication::showSafeMode() | 655 | void ServerApplication::showSafeMode() |
647 | { | 656 | { |
648 | #if 0 | 657 | #if 0 |
649 | if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, " | 658 | if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, " |
650 | "and the system is now in Safe Mode. " | 659 | "and the system is now in Safe Mode. " |
651 | "Plugins are not loaded in Safe Mode. " | 660 | "Plugins are not loaded in Safe Mode. " |
652 | "You can use the Plugin Manager to " | 661 | "You can use the Plugin Manager to " |
653 | "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) { | 662 | "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) |
654 | Global::execute( "pluginmanager" ); | 663 | { |
664 | Global::execute( "pluginmanager" ); | ||
655 | } | 665 | } |
656 | #endif | 666 | #endif |
657 | } | 667 | } |
658 | 668 | ||
659 | void ServerApplication::clearSafeMode() | 669 | void ServerApplication::clearSafeMode() |
660 | { | 670 | { |
661 | #if 0 | 671 | #if 0 |
662 | // If we've been running OK for a while then we won't bother going into | 672 | // If we've been running OK for a while then we won't bother going into |
663 | // safe mode immediately on the next crash. | 673 | // safe mode immediately on the next crash. |
664 | Config cfg( "PluginLoader" ); | 674 | Config cfg( "PluginLoader" ); |
665 | cfg.setGroup( "Global" ); | 675 | cfg.setGroup( "Global" ); |
666 | QString mode = cfg.readEntry( "Mode", "Normal" ); | 676 | QString mode = cfg.readEntry( "Mode", "Normal" ); |
667 | if ( mode == "MaybeSafe" ) { | 677 | if ( mode == "MaybeSafe" ) { |
668 | cfg.writeEntry( "Mode", "Normal" ); | 678 | cfg.writeEntry( "Mode", "Normal" ); |
669 | } | 679 | } |
670 | #endif | 680 | #endif |
671 | } | 681 | } |
672 | 682 | ||
673 | 683 | ||
674 | void ServerApplication::shutdown() | 684 | void ServerApplication::shutdown() |
675 | { | 685 | { |
676 | if ( type() != GuiServer ) | 686 | if ( type() != GuiServer ) |
677 | return; | 687 | return; |
678 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 688 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
679 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), | 689 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), |
680 | this, SLOT(shutdown(ShutdownImpl::Type)) ); | 690 | this, SLOT(shutdown(ShutdownImpl::Type)) ); |
681 | QPEApplication::showWidget( sd ); | 691 | QPEApplication::showWidget( sd ); |
682 | } | 692 | } |
683 | 693 | ||
684 | void ServerApplication::shutdown( ShutdownImpl::Type t ) | 694 | void ServerApplication::shutdown( ShutdownImpl::Type t ) |
685 | { | 695 | { |
686 | char *opt = 0; | 696 | char *opt = 0; |
687 | 697 | ||
688 | switch ( t ) { | 698 | switch ( t ) { |
689 | case ShutdownImpl::ShutdownSystem: | 699 | case ShutdownImpl::ShutdownSystem: |
690 | opt = "-h"; | 700 | opt = "-h"; |
691 | // fall through | 701 | // fall through |
692 | case ShutdownImpl::RebootSystem: | 702 | case ShutdownImpl::RebootSystem: |
693 | if ( opt == 0 ) | 703 | if ( opt == 0 ) |
694 | opt = "-r"; | 704 | opt = "-r"; |
695 | 705 | ||
696 | if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) | 706 | if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) |
697 | perror("shutdown"); | 707 | perror("shutdown"); |
698 | // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); | 708 | // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); |
699 | 709 | ||
700 | break; | 710 | break; |
701 | case ShutdownImpl::RestartDesktop: | 711 | case ShutdownImpl::RestartDesktop: |
702 | restart(); | 712 | restart(); |
703 | break; | 713 | break; |
704 | case ShutdownImpl::TerminateDesktop: | 714 | case ShutdownImpl::TerminateDesktop: |
705 | prepareForTermination( FALSE ); | 715 | prepareForTermination( FALSE ); |
706 | 716 | ||
707 | // This is a workaround for a Qt bug | 717 | // This is a workaround for a Qt bug |
708 | // clipboard applet has to stop its poll timer, or Qt/E | 718 | // clipboard applet has to stop its poll timer, or Qt/E |
709 | // will hang on quit() right before it emits aboutToQuit() | 719 | // will hang on quit() right before it emits aboutToQuit() |
710 | emit aboutToQuit ( ); | 720 | emit aboutToQuit ( ); |
711 | 721 | ||
712 | quit(); | 722 | quit(); |
713 | break; | 723 | break; |
714 | } | 724 | } |
715 | } | 725 | } |
716 | 726 | ||
717 | void ServerApplication::restart() | 727 | void ServerApplication::restart() |
718 | { | 728 | { |
719 | if ( allowRestart ) { | 729 | if ( allowRestart ) { |
720 | 730 | ||
721 | /* | 731 | /* |
722 | * Applets and restart is a problem. Some applets delete | 732 | * Applets and restart is a problem. Some applets delete |
723 | * their widgets even if ownership gets transfered to the | 733 | * their widgets even if ownership gets transfered to the |
724 | * parent (Systray ) but deleting the applet may be unsafe | 734 | * parent (Systray ) but deleting the applet may be unsafe |
725 | * as well ( double deletion ). Some have topLevel widgets | 735 | * as well ( double deletion ). Some have topLevel widgets |
726 | * and when we dlclose and then delete the widget we will | 736 | * and when we dlclose and then delete the widget we will |
727 | * crash and an crash during restart is not nice | 737 | * crash and an crash during restart is not nice |
728 | */ | 738 | */ |
729 | #ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED | 739 | #ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED |
730 | /* same as above */ | 740 | /* same as above */ |
731 | emit aboutToQuit(); | 741 | emit aboutToQuit(); |
732 | prepareForTermination(TRUE); | 742 | prepareForTermination(TRUE); |
733 | doRestart = TRUE; | 743 | doRestart = TRUE; |
734 | quit(); | 744 | quit(); |
735 | #else | 745 | #else |
736 | prepareForTermination( true ); | 746 | prepareForTermination( true ); |
737 | for ( int fd = 3; fd < 100; fd++ ) | 747 | for ( int fd = 3; fd < 100; fd++ ) |
738 | close( fd ); | 748 | close( fd ); |
739 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); | 749 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); |
740 | exit( 1 ); | 750 | exit( 1 ); |
741 | #endif | 751 | #endif |
742 | } | 752 | } |
743 | } | 753 | } |
744 | 754 | ||
745 | void ServerApplication::rereadVolumes() | 755 | void ServerApplication::rereadVolumes() |
746 | { | 756 | { |
747 | Config cfg( "qpe" ); | 757 | Config cfg( "qpe" ); |
748 | cfg. setGroup ( "Volume" ); | 758 | cfg. setGroup ( "Volume" ); |
749 | 759 | ||
750 | m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); | 760 | m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); |
751 | m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); | 761 | m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); |
752 | m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); | 762 | m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); |
753 | } | 763 | } |
754 | 764 | ||
755 | 765 | ||
756 | void ServerApplication::checkMemory() | 766 | void ServerApplication::checkMemory() |
757 | { | 767 | { |
758 | #if defined(QPE_HAVE_MEMALERTER) | 768 | #if defined(QPE_HAVE_MEMALERTER) |
759 | static bool ignoreNormal=TRUE; | 769 | static bool ignoreNormal=TRUE; |
760 | static bool existingMessage=FALSE; | 770 | static bool existingMessage=FALSE; |
761 | 771 | ||
762 | if(existingMessage) | 772 | if(existingMessage) |
763 | return; // don't show a second message while still on first | 773 | return; // don't show a second message while still on first |
764 | 774 | ||
765 | existingMessage = TRUE; | 775 | existingMessage = TRUE; |
766 | switch ( memstate ) { | 776 | switch ( memstate ) { |