-rw-r--r-- | core/launcher/desktop.cpp | 450 |
1 files changed, 246 insertions, 204 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 64043e7..cf33011 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -58,5 +58,5 @@ public: | |||
58 | QCopKeyRegister() : keyCode(0) { } | 58 | QCopKeyRegister() : keyCode(0) { } |
59 | QCopKeyRegister(int k, const QString &c, const QString &m) | 59 | QCopKeyRegister(int k, const QString &c, const QString &m) |
60 | : keyCode(k), channel(c), message(m) { } | 60 | : keyCode(k), channel(c), message(m) { } |
61 | 61 | ||
62 | int getKeyCode() const { return keyCode; } | 62 | int getKeyCode() const { return keyCode; } |
@@ -77,8 +77,8 @@ static void login(bool at_poweron) | |||
77 | { | 77 | { |
78 | if ( !loggedin ) { | 78 | if ( !loggedin ) { |
79 | Global::terminateBuiltin("calibrate"); | 79 | Global::terminateBuiltin("calibrate"); |
80 | Password::authenticate(at_poweron); | 80 | Password::authenticate(at_poweron); |
81 | loggedin=1; | 81 | loggedin=1; |
82 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 82 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
83 | } | 83 | } |
84 | } | 84 | } |
@@ -97,12 +97,12 @@ class DesktopPowerAlerter : public QMessageBox | |||
97 | public: | 97 | public: |
98 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 98 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
99 | : QMessageBox( tr("Battery Status"), "Low Battery", | 99 | : QMessageBox( tr("Battery Status"), "Low Battery", |
100 | QMessageBox::Critical, | 100 | QMessageBox::Critical, |
101 | QMessageBox::Ok | QMessageBox::Default, | 101 | QMessageBox::Ok | QMessageBox::Default, |
102 | QMessageBox::NoButton, QMessageBox::NoButton, | 102 | QMessageBox::NoButton, QMessageBox::NoButton, |
103 | parent, name, FALSE ) | 103 | parent, name, FALSE ) |
104 | { | 104 | { |
105 | currentPriority = INT_MAX; | 105 | currentPriority = INT_MAX; |
106 | alertCount = 0; | 106 | alertCount = 0; |
107 | } | 107 | } |
108 | 108 | ||
@@ -118,7 +118,7 @@ void DesktopPowerAlerter::alert( const QString &text, int priority ) | |||
118 | alertCount++; | 118 | alertCount++; |
119 | if ( alertCount < priority ) | 119 | if ( alertCount < priority ) |
120 | return; | 120 | return; |
121 | if ( priority > currentPriority ) | 121 | if ( priority > currentPriority ) |
122 | return; | 122 | return; |
123 | currentPriority = priority; | 123 | currentPriority = priority; |
124 | setText( text ); | 124 | setText( text ); |
@@ -148,5 +148,5 @@ DesktopApplication::DesktopApplication( int& argc, char **argv, Type t ) | |||
148 | channel = new QCopChannel( "QPE/Desktop", this ); | 148 | channel = new QCopChannel( "QPE/Desktop", this ); |
149 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 149 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
150 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 150 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
151 | } | 151 | } |
152 | 152 | ||
@@ -162,15 +162,15 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | |||
162 | QDataStream stream( data, IO_ReadOnly ); | 162 | QDataStream stream( data, IO_ReadOnly ); |
163 | if (msg == "keyRegister(int key, QString channel, QString message)") | 163 | if (msg == "keyRegister(int key, QString channel, QString message)") |
164 | { | 164 | { |
165 | int k; | 165 | int k; |
166 | QString c, m; | 166 | QString c, m; |
167 | 167 | ||
168 | stream >> k; | 168 | stream >> k; |
169 | stream >> c; | 169 | stream >> c; |
170 | stream >> m; | 170 | stream >> m; |
171 | 171 | ||
172 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); | 172 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); |
173 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 173 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
174 | } | 174 | } |
175 | else if (msg == "suspend()"){ | 175 | else if (msg == "suspend()"){ |
176 | emit power(); | 176 | emit power(); |
@@ -187,96 +187,96 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | |||
187 | 187 | ||
188 | if ( e->type == QWSEvent::Key ) { | 188 | if ( e->type == QWSEvent::Key ) { |
189 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 189 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
190 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 190 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
191 | return TRUE; | 191 | return TRUE; |
192 | bool press = ke->simpleData.is_press; | 192 | bool press = ke->simpleData.is_press; |
193 | 193 | ||
194 | if (!keyRegisterList.isEmpty()) | 194 | if (!keyRegisterList.isEmpty()) |
195 | { | 195 | { |
196 | KeyRegisterList::Iterator it; | 196 | KeyRegisterList::Iterator it; |
197 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | 197 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) |
198 | { | 198 | { |
199 | if ((*it).getKeyCode() == ke->simpleData.keycode) | 199 | if ((*it).getKeyCode() == ke->simpleData.keycode) |
200 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | 200 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | if ( !keyboardGrabbed() ) { | 204 | if ( !keyboardGrabbed() ) { |
205 | if ( ke->simpleData.keycode == Key_F9 ) { | 205 | if ( ke->simpleData.keycode == Key_F9 ) { |
206 | if ( press ) emit datebook(); | 206 | if ( press ) emit datebook(); |
207 | return TRUE; | 207 | return TRUE; |
208 | } | 208 | } |
209 | if ( ke->simpleData.keycode == Key_F10 ) { | 209 | if ( ke->simpleData.keycode == Key_F10 ) { |
210 | if ( !press && cardSendTimer ) { | 210 | if ( !press && cardSendTimer ) { |
211 | emit contacts(); | 211 | emit contacts(); |
212 | delete cardSendTimer; | 212 | delete cardSendTimer; |
213 | } else if ( press ) { | 213 | } else if ( press ) { |
214 | cardSendTimer = new QTimer(); | 214 | cardSendTimer = new QTimer(); |
215 | cardSendTimer->start( 2000, TRUE ); | 215 | cardSendTimer->start( 2000, TRUE ); |
216 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 216 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
217 | } | 217 | } |
218 | return TRUE; | 218 | return TRUE; |
219 | } | 219 | } |
220 | /* menu key now opens application menu/toolbar | 220 | /* menu key now opens application menu/toolbar |
221 | if ( ke->simpleData.keycode == Key_F11 ) { | 221 | if ( ke->simpleData.keycode == Key_F11 ) { |
222 | if ( press ) emit menu(); | 222 | if ( press ) emit menu(); |
223 | return TRUE; | 223 | return TRUE; |
224 | } | 224 | } |
225 | */ | 225 | */ |
226 | if ( ke->simpleData.keycode == Key_F12 ) { | 226 | if ( ke->simpleData.keycode == Key_F12 ) { |
227 | while( activePopupWidget() ) | 227 | while( activePopupWidget() ) |
228 | activePopupWidget()->close(); | 228 | activePopupWidget()->close(); |
229 | if ( press ) emit launch(); | 229 | if ( press ) emit launch(); |
230 | return TRUE; | 230 | return TRUE; |
231 | } | 231 | } |
232 | if ( ke->simpleData.keycode == Key_F13 ) { | 232 | if ( ke->simpleData.keycode == Key_F13 ) { |
233 | if ( press ) emit email(); | 233 | if ( press ) emit email(); |
234 | return TRUE; | 234 | return TRUE; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | if ( ke->simpleData.keycode == Key_F34 ) { | 238 | if ( ke->simpleData.keycode == Key_F34 ) { |
239 | if ( press ) emit power(); | 239 | if ( press ) emit power(); |
240 | return TRUE; | 240 | return TRUE; |
241 | } | 241 | } |
242 | if ( ke->simpleData.keycode == Key_SysReq ) { | 242 | if ( ke->simpleData.keycode == Key_SysReq ) { |
243 | if ( press ) emit power(); | 243 | if ( press ) emit power(); |
244 | return TRUE; | 244 | return TRUE; |
245 | } | 245 | } |
246 | if ( ke->simpleData.keycode == Key_F35 ) { | 246 | if ( ke->simpleData.keycode == Key_F35 ) { |
247 | if ( press ) emit backlight(); | 247 | if ( press ) emit backlight(); |
248 | return TRUE; | 248 | return TRUE; |
249 | } | 249 | } |
250 | if ( ke->simpleData.keycode == Key_F32 ) { | 250 | if ( ke->simpleData.keycode == Key_F32 ) { |
251 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 251 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
252 | return TRUE; | 252 | return TRUE; |
253 | } | 253 | } |
254 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | 254 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { |
255 | if ( press ) emit symbol(); | 255 | if ( press ) emit symbol(); |
256 | return TRUE; | 256 | return TRUE; |
257 | } | 257 | } |
258 | if ( ke->simpleData.keycode == Key_NumLock ) { | 258 | if ( ke->simpleData.keycode == Key_NumLock ) { |
259 | if ( press ) emit numLockStateToggle(); | 259 | if ( press ) emit numLockStateToggle(); |
260 | } | 260 | } |
261 | if ( ke->simpleData.keycode == Key_CapsLock ) { | 261 | if ( ke->simpleData.keycode == Key_CapsLock ) { |
262 | if ( press ) emit capsLockStateToggle(); | 262 | if ( press ) emit capsLockStateToggle(); |
263 | } | 263 | } |
264 | if ( press ) | 264 | if ( press ) |
265 | qpedesktop->keyClick(); | 265 | qpedesktop->keyClick(); |
266 | } else { | 266 | } else { |
267 | if ( e->type == QWSEvent::Mouse ) { | 267 | if ( e->type == QWSEvent::Mouse ) { |
268 | QWSMouseEvent *me = (QWSMouseEvent *)e; | 268 | QWSMouseEvent *me = (QWSMouseEvent *)e; |
269 | static bool up = TRUE; | 269 | static bool up = TRUE; |
270 | if ( me->simpleData.state&LeftButton ) { | 270 | if ( me->simpleData.state&LeftButton ) { |
271 | if ( up ) { | 271 | if ( up ) { |
272 | up = FALSE; | 272 | up = FALSE; |
273 | qpedesktop->screenClick(); | 273 | qpedesktop->screenClick(); |
274 | } | 274 | } |
275 | } else { | 275 | } else { |
276 | up = TRUE; | 276 | up = TRUE; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | return QPEApplication::qwsEventFilter( e ); | 281 | return QPEApplication::qwsEventFilter( e ); |
282 | } | 282 | } |
@@ -290,14 +290,14 @@ void DesktopApplication::psTimeout() | |||
290 | 290 | ||
291 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { | 291 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { |
292 | pa->alert( tr( "Battery is running very low." ), 6 ); | 292 | pa->alert( tr( "Battery is running very low." ), 6 ); |
293 | } | 293 | } |
294 | 294 | ||
295 | if ( ps->batteryStatus() == PowerStatus::Critical ) { | 295 | if ( ps->batteryStatus() == PowerStatus::Critical ) { |
296 | pa->alert( tr( "Battery level is critical!\n" | 296 | pa->alert( tr( "Battery level is critical!\n" |
297 | "Keep power off until power restored!" ), 1 ); | 297 | "Keep power off until power restored!" ), 1 ); |
298 | } | 298 | } |
299 | 299 | ||
300 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { | 300 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { |
301 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); | 301 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); |
302 | } | 302 | } |
303 | } | 303 | } |
@@ -312,7 +312,7 @@ void DesktopApplication::sendCard() | |||
312 | 312 | ||
313 | if ( QFile::exists( card ) ) { | 313 | if ( QFile::exists( card ) ) { |
314 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); | 314 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); |
315 | QString mimetype = "text/x-vCard"; | 315 | QString mimetype = "text/x-vCard"; |
316 | e << tr("business card") << card << mimetype; | 316 | e << tr("business card") << card << mimetype; |
317 | } | 317 | } |
318 | } | 318 | } |
@@ -401,34 +401,34 @@ void Desktop::checkMemory() | |||
401 | 401 | ||
402 | if(existingMessage) | 402 | if(existingMessage) |
403 | return; // don't show a second message while still on first | 403 | return; // don't show a second message while still on first |
404 | 404 | ||
405 | existingMessage = TRUE; | 405 | existingMessage = TRUE; |
406 | switch ( memstate ) { | 406 | switch ( memstate ) { |
407 | case Unknown: | 407 | case Unknown: |
408 | break; | 408 | break; |
409 | case Low: | 409 | case Low: |
410 | memstate = Unknown; | 410 | memstate = Unknown; |
411 | if ( recoverMemory() ) | 411 | if ( recoverMemory() ) |
412 | ignoreNormal = TRUE; | 412 | ignoreNormal = TRUE; |
413 | else | 413 | else |
414 | QMessageBox::warning( 0 , "Memory Status", | 414 | QMessageBox::warning( 0 , "Memory Status", |
415 | "The memory smacks of shortage. \n" | 415 | "The memory smacks of shortage. \n" |
416 | "Please save data. " ); | 416 | "Please save data. " ); |
417 | break; | 417 | break; |
418 | case Normal: | 418 | case Normal: |
419 | memstate = Unknown; | 419 | memstate = Unknown; |
420 | if ( ignoreNormal ) | 420 | if ( ignoreNormal ) |
421 | ignoreNormal = FALSE; | 421 | ignoreNormal = FALSE; |
422 | else | 422 | else |
423 | QMessageBox::information ( 0 , "Memory Status", | 423 | QMessageBox::information ( 0 , "Memory Status", |
424 | "There is enough memory again." ); | 424 | "There is enough memory again." ); |
425 | break; | 425 | break; |
426 | case VeryLow: | 426 | case VeryLow: |
427 | memstate = Unknown; | 427 | memstate = Unknown; |
428 | QMessageBox::critical( 0 , "Memory Status", | 428 | QMessageBox::critical( 0 , "Memory Status", |
429 | "The memory is very low. \n" | 429 | "The memory is very low. \n" |
430 | "Please end this application \n" | 430 | "Please end this application \n" |
431 | "immediately." ); | 431 | "immediately." ); |
432 | recoverMemory(); | 432 | recoverMemory(); |
433 | } | 433 | } |
434 | existingMessage = FALSE; | 434 | existingMessage = FALSE; |
@@ -441,6 +441,6 @@ static bool isVisibleWindow(int wid) | |||
441 | QWSWindow* w; | 441 | QWSWindow* w; |
442 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 442 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
443 | if ( w->winId() == wid ) | 443 | if ( w->winId() == wid ) |
444 | return !w->isFullyObscured(); | 444 | return !w->isFullyObscured(); |
445 | } | 445 | } |
446 | return FALSE; | 446 | return FALSE; |
@@ -452,6 +452,6 @@ static bool hasVisibleWindow(const QString& clientname) | |||
452 | QWSWindow* w; | 452 | QWSWindow* w; |
453 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 453 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
454 | if ( w->client()->identity() == clientname && !w->isFullyObscured() ) | 454 | if ( w->client()->identity() == clientname && !w->isFullyObscured() ) |
455 | return TRUE; | 455 | return TRUE; |
456 | } | 456 | } |
457 | return FALSE; | 457 | return FALSE; |
@@ -460,8 +460,17 @@ static bool hasVisibleWindow(const QString& clientname) | |||
460 | void Desktop::raiseLauncher() | 460 | void Desktop::raiseLauncher() |
461 | { | 461 | { |
462 | if ( isVisibleWindow(launcher->winId()) ) | 462 | Config cfg("qpe"); //F12 'Home' |
463 | launcher->nextView(); | 463 | cfg.setGroup("AppsKey"); |
464 | else | 464 | QString tempItem; |
465 | launcher->raise(); | 465 | tempItem = cfg.readEntry("Middle","Home"); |
466 | if(tempItem == "Home" || tempItem.isEmpty()) { | ||
467 | if ( isVisibleWindow(launcher->winId()) ) | ||
468 | launcher->nextView(); | ||
469 | else | ||
470 | launcher->raise(); | ||
471 | } else { | ||
472 | QCopEnvelope e("QPE/System","execute(QString)"); | ||
473 | e << tempItem; | ||
474 | } | ||
466 | } | 475 | } |
467 | 476 | ||
@@ -470,15 +479,15 @@ void Desktop::executeOrModify(const QString& appLnkFile) | |||
470 | AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile); | 479 | AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile); |
471 | if ( lnk.isValid() ) { | 480 | if ( lnk.isValid() ) { |
472 | QCString app = lnk.exec().utf8(); | 481 | QCString app = lnk.exec().utf8(); |
473 | Global::terminateBuiltin("calibrate"); | 482 | Global::terminateBuiltin("calibrate"); |
474 | if ( QCopChannel::isRegistered("QPE/Application/" + app) ) { | 483 | if ( QCopChannel::isRegistered("QPE/Application/" + app) ) { |
475 | MRUList::addTask(&lnk); | 484 | MRUList::addTask(&lnk); |
476 | if ( hasVisibleWindow(app) ) | 485 | if ( hasVisibleWindow(app) ) |
477 | QCopChannel::send("QPE/Application/" + app, "nextView()"); | 486 | QCopChannel::send("QPE/Application/" + app, "nextView()"); |
478 | else | 487 | else |
479 | QCopChannel::send("QPE/Application/" + app, "raise()"); | 488 | QCopChannel::send("QPE/Application/" + app, "raise()"); |
480 | } else { | 489 | } else { |
481 | lnk.execute(); | 490 | lnk.execute(); |
482 | } | 491 | } |
483 | } | 492 | } |
484 | } | 493 | } |
@@ -486,21 +495,54 @@ void Desktop::executeOrModify(const QString& appLnkFile) | |||
486 | void Desktop::raiseDatebook() | 495 | void Desktop::raiseDatebook() |
487 | { | 496 | { |
488 | executeOrModify("Applications/datebook.desktop"); | 497 | Config cfg("qpe"); //F9 'Activity' |
498 | cfg.setGroup("AppsKey"); | ||
499 | QString tempItem; | ||
500 | tempItem = cfg.readEntry("LeftEnd","Calender"); | ||
501 | if(tempItem == "Calender" || tempItem.isEmpty()) executeOrModify("Applications/datebook.desktop"); | ||
502 | else { | ||
503 | QCopEnvelope e("QPE/System","execute(QString)"); | ||
504 | e << tempItem; | ||
505 | } | ||
489 | } | 506 | } |
490 | 507 | ||
491 | void Desktop::raiseContacts() | 508 | void Desktop::raiseContacts() |
492 | { | 509 | { |
493 | executeOrModify("Applications/addressbook.desktop"); | 510 | Config cfg("qpe"); //F10, 'Contacts' |
511 | cfg.setGroup("AppsKey"); | ||
512 | QString tempItem; | ||
513 | tempItem = cfg.readEntry("Left2nd","Address Book"); | ||
514 | if(tempItem == "Address Book" || tempItem.isEmpty()) executeOrModify("Applications/addressbook.desktop"); | ||
515 | else { | ||
516 | QCopEnvelope e("QPE/System","execute(QString)"); | ||
517 | e << tempItem; | ||
518 | } | ||
494 | } | 519 | } |
495 | 520 | ||
496 | void Desktop::raiseMenu() | 521 | void Desktop::raiseMenu() |
497 | { | 522 | { |
523 | Config cfg("qpe"); //F11, 'Menu' | ||
524 | cfg.setGroup("AppsKey"); | ||
525 | QString tempItem; | ||
526 | tempItem = cfg.readEntry("Right2nd","Popup Menu"); | ||
527 | if(tempItem == "Popup Menu" || tempItem.isEmpty()) { | ||
498 | Global::terminateBuiltin("calibrate"); | 528 | Global::terminateBuiltin("calibrate"); |
499 | tb->startMenu()->launch(); | 529 | tb->startMenu()->launch(); |
530 | } else { | ||
531 | QCopEnvelope e("QPE/System","execute(QString)"); | ||
532 | e << tempItem; | ||
533 | } | ||
500 | } | 534 | } |
501 | 535 | ||
502 | void Desktop::raiseEmail() | 536 | void Desktop::raiseEmail() |
503 | { | 537 | { |
504 | executeOrModify("Applications/qtmail.desktop"); | 538 | Config cfg("qpe"); //F13, 'Mail' |
539 | cfg.setGroup("AppsKey"); | ||
540 | QString tempItem; | ||
541 | tempItem = cfg.readEntry("RightEnd","Mail"); | ||
542 | if(tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty()) executeOrModify("Applications/qtmail.desktop"); | ||
543 | else { | ||
544 | QCopEnvelope e("QPE/System","execute(QString)"); | ||
545 | e << tempItem; | ||
546 | } | ||
505 | } | 547 | } |
506 | 548 | ||
@@ -610,8 +652,8 @@ void DesktopApplication::shutdown() | |||
610 | { | 652 | { |
611 | if ( type() != GuiServer ) | 653 | if ( type() != GuiServer ) |
612 | return; | 654 | return; |
613 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 655 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
614 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), | 656 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), |
615 | this, SLOT(shutdown(ShutdownImpl::Type)) ); | 657 | this, SLOT(shutdown(ShutdownImpl::Type)) ); |
616 | sd->showMaximized(); | 658 | sd->showMaximized(); |
617 | } | 659 | } |
@@ -620,17 +662,17 @@ void DesktopApplication::shutdown( ShutdownImpl::Type t ) | |||
620 | { | 662 | { |
621 | switch ( t ) { | 663 | switch ( t ) { |
622 | case ShutdownImpl::ShutdownSystem: | 664 | case ShutdownImpl::ShutdownSystem: |
623 | execlp("shutdown", "shutdown", "-h", "now", (void*)0); | 665 | execlp("shutdown", "shutdown", "-h", "now", (void*)0); |
624 | break; | 666 | break; |
625 | case ShutdownImpl::RebootSystem: | 667 | case ShutdownImpl::RebootSystem: |
626 | execlp("shutdown", "shutdown", "-r", "now", (void*)0); | 668 | execlp("shutdown", "shutdown", "-r", "now", (void*)0); |
627 | break; | 669 | break; |
628 | case ShutdownImpl::RestartDesktop: | 670 | case ShutdownImpl::RestartDesktop: |
629 | restart(); | 671 | restart(); |
630 | break; | 672 | break; |
631 | case ShutdownImpl::TerminateDesktop: | 673 | case ShutdownImpl::TerminateDesktop: |
632 | prepareForTermination(FALSE); | 674 | prepareForTermination(FALSE); |
633 | quit(); | 675 | quit(); |
634 | break; | 676 | break; |
635 | } | 677 | } |
636 | } | 678 | } |
@@ -642,5 +684,5 @@ void DesktopApplication::restart() | |||
642 | #ifdef Q_WS_QWS | 684 | #ifdef Q_WS_QWS |
643 | for ( int fd = 3; fd < 100; fd++ ) | 685 | for ( int fd = 3; fd < 100; fd++ ) |
644 | close( fd ); | 686 | close( fd ); |
645 | #if defined(QT_DEMO_SINGLE_FLOPPY) | 687 | #if defined(QT_DEMO_SINGLE_FLOPPY) |
646 | execl( "/sbin/init", "qpe", 0 ); | 688 | execl( "/sbin/init", "qpe", 0 ); |
@@ -659,15 +701,15 @@ void Desktop::startTransferServer() | |||
659 | qcopBridge = new QCopBridge( 4243 ); | 701 | qcopBridge = new QCopBridge( 4243 ); |
660 | if ( !qcopBridge->ok() ) { | 702 | if ( !qcopBridge->ok() ) { |
661 | delete qcopBridge; | 703 | delete qcopBridge; |
662 | qcopBridge = 0; | 704 | qcopBridge = 0; |
663 | } | 705 | } |
664 | // start transfer server | 706 | // start transfer server |
665 | transferServer = new TransferServer( 4242 ); | 707 | transferServer = new TransferServer( 4242 ); |
666 | if ( !transferServer->ok() ) { | 708 | if ( !transferServer->ok() ) { |
667 | delete transferServer; | 709 | delete transferServer; |
668 | transferServer = 0; | 710 | transferServer = 0; |
669 | } | 711 | } |
670 | if ( !transferServer || !qcopBridge ) | 712 | if ( !transferServer || !qcopBridge ) |
671 | startTimer( 2000 ); | 713 | startTimer( 2000 ); |
672 | } | 714 | } |
673 | 715 | ||
@@ -698,5 +740,5 @@ void Desktop::keyClick() | |||
698 | #ifdef CUSTOM_SOUND_KEYCLICK | 740 | #ifdef CUSTOM_SOUND_KEYCLICK |
699 | if ( keyclick ) | 741 | if ( keyclick ) |
700 | CUSTOM_SOUND_KEYCLICK; | 742 | CUSTOM_SOUND_KEYCLICK; |
701 | #endif | 743 | #endif |
702 | } | 744 | } |
@@ -706,5 +748,5 @@ void Desktop::screenClick() | |||
706 | #ifdef CUSTOM_SOUND_TOUCH | 748 | #ifdef CUSTOM_SOUND_TOUCH |
707 | if ( touchclick ) | 749 | if ( touchclick ) |
708 | CUSTOM_SOUND_TOUCH; | 750 | CUSTOM_SOUND_TOUCH; |
709 | #endif | 751 | #endif |
710 | } | 752 | } |
@@ -720,13 +762,13 @@ bool Desktop::eventFilter( QObject *w, QEvent *ev ) | |||
720 | { | 762 | { |
721 | if ( ev->type() == QEvent::KeyPress ) { | 763 | if ( ev->type() == QEvent::KeyPress ) { |
722 | QKeyEvent *ke = (QKeyEvent *)ev; | 764 | QKeyEvent *ke = (QKeyEvent *)ev; |
723 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 765 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
724 | QWidget *active = qApp->activeWindow(); | 766 | QWidget *active = qApp->activeWindow(); |
725 | if ( active && active->isPopup() ) { | 767 | if ( active && active->isPopup() ) { |
726 | active->close(); | 768 | active->close(); |
727 | } | 769 | } |
728 | raiseMenu(); | 770 | raiseMenu(); |
729 | return TRUE; | 771 | return TRUE; |
730 | } | 772 | } |
731 | } | 773 | } |
732 | return FALSE; | 774 | return FALSE; |