author | harlekin <harlekin> | 2002-08-27 21:11:47 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-27 21:11:47 (UTC) |
commit | a6432554a1e64d54c53c1400aa1dfa11ae83f11a (patch) (unidiff) | |
tree | baae8b562962d952904e07a5b2317041a9e37ede | |
parent | 86352e32f449ecf00de254674b7dcac72bc34a14 (diff) | |
download | opie-a6432554a1e64d54c53c1400aa1dfa11ae83f11a.zip opie-a6432554a1e64d54c53c1400aa1dfa11ae83f11a.tar.gz opie-a6432554a1e64d54c53c1400aa1dfa11ae83f11a.tar.bz2 |
small fix for autostart
-rw-r--r-- | core/launcher/desktop.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 552c7c3..fb10602 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -171,115 +171,115 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | |||
171 | stream >> k; | 171 | stream >> k; |
172 | stream >> c; | 172 | stream >> c; |
173 | stream >> m; | 173 | stream >> m; |
174 | 174 | ||
175 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); | 175 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); |
176 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 176 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
177 | } | 177 | } |
178 | else if (msg == "suspend()"){ | 178 | else if (msg == "suspend()"){ |
179 | emit power(); | 179 | emit power(); |
180 | } | 180 | } |
181 | 181 | ||
182 | } | 182 | } |
183 | 183 | ||
184 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 184 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
185 | 185 | ||
186 | #ifdef Q_WS_QWS | 186 | #ifdef Q_WS_QWS |
187 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 187 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
188 | { | 188 | { |
189 | qpedesktop->checkMemory(); | 189 | qpedesktop->checkMemory(); |
190 | 190 | ||
191 | if ( e->type == QWSEvent::Key ) { | 191 | if ( e->type == QWSEvent::Key ) { |
192 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 192 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
193 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 193 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
194 | return TRUE; | 194 | return TRUE; |
195 | bool press = ke->simpleData.is_press; | 195 | bool press = ke->simpleData.is_press; |
196 | bool autoRepeat= ke->simpleData.is_auto_repeat; | 196 | bool autoRepeat= ke->simpleData.is_auto_repeat; |
197 | 197 | ||
198 | /* | 198 | /* |
199 | app that registers key/message to be sent back to the app, when it doesn't have focus, | 199 | app that registers key/message to be sent back to the app, when it doesn't have focus, |
200 | when user presses key, unless keyboard has been requested from app. | 200 | when user presses key, unless keyboard has been requested from app. |
201 | will not send multiple repeats if user holds key | 201 | will not send multiple repeats if user holds key |
202 | i.e. one shot | 202 | i.e. one shot |
203 | 203 | ||
204 | */ | 204 | */ |
205 | if (!keyRegisterList.isEmpty()) { | 205 | if (!keyRegisterList.isEmpty()) { |
206 | KeyRegisterList::Iterator it; | 206 | KeyRegisterList::Iterator it; |
207 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { | 207 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { |
208 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() && press) { | 208 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() && press) { |
209 | if(press) qDebug("press"); else qDebug("release"); | 209 | if(press) qDebug("press"); else qDebug("release"); |
210 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | 210 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | if ( !keyboardGrabbed() ) { | 215 | if ( !keyboardGrabbed() ) { |
216 | if ( ke->simpleData.keycode == Key_F9 ) { | 216 | if ( ke->simpleData.keycode == Key_F9 ) { |
217 | if ( press ) emit datebook(); | 217 | if ( press ) emit datebook(); |
218 | return TRUE; | 218 | return TRUE; |
219 | } | 219 | } |
220 | if ( ke->simpleData.keycode == Key_F10 ) { | 220 | if ( ke->simpleData.keycode == Key_F10 ) { |
221 | if ( !press && cardSendTimer ) { | 221 | if ( !press && cardSendTimer ) { |
222 | emit contacts(); | 222 | emit contacts(); |
223 | delete cardSendTimer; | 223 | delete cardSendTimer; |
224 | } else if ( press ) { | 224 | } else if ( press ) { |
225 | cardSendTimer = new QTimer(); | 225 | cardSendTimer = new QTimer(); |
226 | cardSendTimer->start( 2000, TRUE ); | 226 | cardSendTimer->start( 2000, TRUE ); |
227 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 227 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
228 | } | 228 | } |
229 | return TRUE; | 229 | return TRUE; |
230 | } | 230 | } |
231 | /* menu key now opens application menu/toolbar | 231 | /* menu key now opens application menu/toolbar |
232 | if ( ke->simpleData.keycode == Key_F11 ) { | 232 | if ( ke->simpleData.keycode == Key_F11 ) { |
233 | if ( press ) emit menu(); | 233 | if ( press ) emit menu(); |
234 | return TRUE; | 234 | return TRUE; |
235 | } | 235 | } |
236 | */ | 236 | */ |
237 | if ( ke->simpleData.keycode == Key_F12 ) { | 237 | if ( ke->simpleData.keycode == Key_F12 ) { |
238 | while( activePopupWidget() ) | 238 | while( activePopupWidget() ) |
239 | activePopupWidget()->close(); | 239 | activePopupWidget()->close(); |
240 | if ( press ) emit launch(); | 240 | if ( press ) emit launch(); |
241 | return TRUE; | 241 | return TRUE; |
242 | } | 242 | } |
243 | if ( ke->simpleData.keycode == Key_F13 ) { | 243 | if ( ke->simpleData.keycode == Key_F13 ) { |
244 | if ( press ) emit email(); | 244 | if ( press ) emit email(); |
245 | return TRUE; | 245 | return TRUE; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | if ( ke->simpleData.keycode == Key_F34 ) { | 249 | if ( ke->simpleData.keycode == Key_F34 ) { |
250 | if ( press ) emit power(); | 250 | if ( press ) emit power(); |
251 | return TRUE; | 251 | return TRUE; |
252 | } | 252 | } |
253 | // This was used for the iPAQ PowerButton | 253 | // This was used for the iPAQ PowerButton |
254 | // See main.cpp for new KeyboardFilter | 254 | // See main.cpp for new KeyboardFilter |
255 | // | 255 | // |
256 | // if ( ke->simpleData.keycode == Key_SysReq ) { | 256 | // if ( ke->simpleData.keycode == Key_SysReq ) { |
257 | // if ( press ) emit power(); | 257 | // if ( press ) emit power(); |
258 | // return TRUE; | 258 | // return TRUE; |
259 | // } | 259 | // } |
260 | if ( ke->simpleData.keycode == Key_F35 ) { | 260 | if ( ke->simpleData.keycode == Key_F35 ) { |
261 | if ( press ) emit backlight(); | 261 | if ( press ) emit backlight(); |
262 | return TRUE; | 262 | return TRUE; |
263 | } | 263 | } |
264 | if ( ke->simpleData.keycode == Key_F32 ) { | 264 | if ( ke->simpleData.keycode == Key_F32 ) { |
265 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 265 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
266 | return TRUE; | 266 | return TRUE; |
267 | } | 267 | } |
268 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | 268 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { |
269 | if ( press ) emit symbol(); | 269 | if ( press ) emit symbol(); |
270 | return TRUE; | 270 | return TRUE; |
271 | } | 271 | } |
272 | if ( ke->simpleData.keycode == Key_NumLock ) { | 272 | if ( ke->simpleData.keycode == Key_NumLock ) { |
273 | if ( press ) emit numLockStateToggle(); | 273 | if ( press ) emit numLockStateToggle(); |
274 | } | 274 | } |
275 | if ( ke->simpleData.keycode == Key_CapsLock ) { | 275 | if ( ke->simpleData.keycode == Key_CapsLock ) { |
276 | if ( press ) emit capsLockStateToggle(); | 276 | if ( press ) emit capsLockStateToggle(); |
277 | } | 277 | } |
278 | if (( press && !autoRepeat ) || ( !press && autoRepeat )) | 278 | if (( press && !autoRepeat ) || ( !press && autoRepeat )) |
279 | qpedesktop->keyClick(); | 279 | qpedesktop->keyClick(); |
280 | } else { | 280 | } else { |
281 | if ( e->type == QWSEvent::Mouse ) { | 281 | if ( e->type == QWSEvent::Mouse ) { |
282 | QWSMouseEvent *me = (QWSMouseEvent *)e; | 282 | QWSMouseEvent *me = (QWSMouseEvent *)e; |
283 | static bool up = TRUE; | 283 | static bool up = TRUE; |
284 | if ( me->simpleData.state&LeftButton ) { | 284 | if ( me->simpleData.state&LeftButton ) { |
285 | if ( up ) { | 285 | if ( up ) { |
@@ -530,211 +530,210 @@ void Desktop::raiseMenu() | |||
530 | cfg.setGroup("AppsKey"); | 530 | cfg.setGroup("AppsKey"); |
531 | QString tempItem; | 531 | QString tempItem; |
532 | tempItem = cfg.readEntry("Right2nd","Popup Menu"); | 532 | tempItem = cfg.readEntry("Right2nd","Popup Menu"); |
533 | if(tempItem == "Popup Menu" || tempItem.isEmpty()) { | 533 | if(tempItem == "Popup Menu" || tempItem.isEmpty()) { |
534 | Global::terminateBuiltin("calibrate"); | 534 | Global::terminateBuiltin("calibrate"); |
535 | tb->startMenu()->launch(); | 535 | tb->startMenu()->launch(); |
536 | } else { | 536 | } else { |
537 | QCopEnvelope e("QPE/System","execute(QString)"); | 537 | QCopEnvelope e("QPE/System","execute(QString)"); |
538 | e << tempItem; | 538 | e << tempItem; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | 541 | ||
542 | void Desktop::raiseEmail() | 542 | void Desktop::raiseEmail() |
543 | { | 543 | { |
544 | Config cfg("qpe"); //F13, 'Mail' | 544 | Config cfg("qpe"); //F13, 'Mail' |
545 | cfg.setGroup("AppsKey"); | 545 | cfg.setGroup("AppsKey"); |
546 | QString tempItem; | 546 | QString tempItem; |
547 | tempItem = cfg.readEntry("RightEnd","Mail"); | 547 | tempItem = cfg.readEntry("RightEnd","Mail"); |
548 | if(tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty()) executeOrModify("Applications/qtmail.desktop"); | 548 | if(tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty()) executeOrModify("Applications/qtmail.desktop"); |
549 | else { | 549 | else { |
550 | QCopEnvelope e("QPE/System","execute(QString)"); | 550 | QCopEnvelope e("QPE/System","execute(QString)"); |
551 | e << tempItem; | 551 | e << tempItem; |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | // autoStarts apps on resume and start | 555 | // autoStarts apps on resume and start |
556 | void Desktop::execAutoStart() { | 556 | void Desktop::execAutoStart() { |
557 | QString appName; | 557 | QString appName; |
558 | int delay; | 558 | int delay; |
559 | QDateTime now = QDateTime::currentDateTime(); | 559 | QDateTime now = QDateTime::currentDateTime(); |
560 | Config cfg( "autostart" ); | 560 | Config cfg( "autostart" ); |
561 | cfg.setGroup( "AutoStart" ); | 561 | cfg.setGroup( "AutoStart" ); |
562 | appName = cfg.readEntry("Apps", ""); | 562 | appName = cfg.readEntry( "Apps", "" ); |
563 | delay = (cfg.readEntry("Delay", "0" )).toInt(); | 563 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); |
564 | // If the time between suspend and resume was longer then the | 564 | // If the time between suspend and resume was longer then the |
565 | // value saved as delay, start the app | 565 | // value saved as delay, start the app |
566 | if ( suspendTime.secsTo(now) >= (delay*60) ) { | 566 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
567 | QCopEnvelope e("QPE/System", "execute(QString)"); | 567 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
568 | e << QString(appName); | 568 | e << QString( appName ); |
569 | } //else { | 569 | } |
570 | //} | ||
571 | } | 570 | } |
572 | 571 | ||
573 | #if defined(QPE_HAVE_TOGGLELIGHT) | 572 | #if defined(QPE_HAVE_TOGGLELIGHT) |
574 | #include <qpe/config.h> | 573 | #include <qpe/config.h> |
575 | 574 | ||
576 | #include <sys/ioctl.h> | 575 | #include <sys/ioctl.h> |
577 | #include <sys/types.h> | 576 | #include <sys/types.h> |
578 | #include <fcntl.h> | 577 | #include <fcntl.h> |
579 | #include <unistd.h> | 578 | #include <unistd.h> |
580 | #include <errno.h> | 579 | #include <errno.h> |
581 | #include <linux/ioctl.h> | 580 | #include <linux/ioctl.h> |
582 | #include <time.h> | 581 | #include <time.h> |
583 | #endif | 582 | #endif |
584 | 583 | ||
585 | static bool blanked=FALSE; | 584 | static bool blanked=FALSE; |
586 | 585 | ||
587 | static void blankScreen() | 586 | static void blankScreen() |
588 | { | 587 | { |
589 | if ( !qt_screen ) return; | 588 | if ( !qt_screen ) return; |
590 | /* Should use a big black window instead. | 589 | /* Should use a big black window instead. |
591 | QGfx* g = qt_screen->screenGfx(); | 590 | QGfx* g = qt_screen->screenGfx(); |
592 | g->fillRect(0,0,qt_screen->width(),qt_screen->height()); | 591 | g->fillRect(0,0,qt_screen->width(),qt_screen->height()); |
593 | delete g; | 592 | delete g; |
594 | */ | 593 | */ |
595 | blanked = TRUE; | 594 | blanked = TRUE; |
596 | } | 595 | } |
597 | 596 | ||
598 | static void darkScreen() | 597 | static void darkScreen() |
599 | { | 598 | { |
600 | extern void qpe_setBacklight(int); | 599 | extern void qpe_setBacklight(int); |
601 | qpe_setBacklight(0); // force off | 600 | qpe_setBacklight(0); // force off |
602 | } | 601 | } |
603 | 602 | ||
604 | 603 | ||
605 | void Desktop::togglePower() | 604 | void Desktop::togglePower() |
606 | { | 605 | { |
607 | extern void qpe_setBacklight ( int ); // We need to toggle the LCD fast - no time to send a QCop | 606 | extern void qpe_setBacklight ( int ); // We need to toggle the LCD fast - no time to send a QCop |
608 | 607 | ||
609 | static bool excllock = false; | 608 | static bool excllock = false; |
610 | 609 | ||
611 | if ( excllock ) | 610 | if ( excllock ) |
612 | return; | 611 | return; |
613 | 612 | ||
614 | excllock = true; | 613 | excllock = true; |
615 | 614 | ||
616 | bool wasloggedin = loggedin; | 615 | bool wasloggedin = loggedin; |
617 | loggedin=0; | 616 | loggedin=0; |
618 | suspendTime = QDateTime::currentDateTime(); | 617 | suspendTime = QDateTime::currentDateTime(); |
619 | 618 | ||
620 | qpe_setBacklight ( 0 ); // force LCD off | 619 | qpe_setBacklight ( 0 ); // force LCD off |
621 | 620 | ||
622 | if ( wasloggedin ) | 621 | if ( wasloggedin ) |
623 | blankScreen(); | 622 | blankScreen(); |
624 | 623 | ||
625 | ODevice::inst ( )-> suspend ( ); | 624 | ODevice::inst ( )-> suspend ( ); |
626 | 625 | ||
627 | QWSServer::screenSaverActivate ( false ); | 626 | QWSServer::screenSaverActivate ( false ); |
628 | 627 | ||
629 | qpe_setBacklight ( -3 ); // force LCD on | 628 | qpe_setBacklight ( -3 ); // force LCD on |
630 | 629 | ||
631 | { | 630 | { |
632 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep | 631 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep |
633 | } | 632 | } |
634 | 633 | ||
635 | if ( wasloggedin ) | 634 | if ( wasloggedin ) |
636 | login(TRUE); | 635 | login(TRUE); |
637 | 636 | ||
638 | execAutoStart(); | 637 | execAutoStart(); |
639 | //qcopBridge->closeOpenConnections(); | 638 | //qcopBridge->closeOpenConnections(); |
640 | //qDebug("called togglePower()!!!!!!"); | 639 | //qDebug("called togglePower()!!!!!!"); |
641 | 640 | ||
642 | qApp-> processEvents ( ); | 641 | qApp-> processEvents ( ); |
643 | 642 | ||
644 | excllock = false; | 643 | excllock = false; |
645 | } | 644 | } |
646 | 645 | ||
647 | void Desktop::toggleLight() | 646 | void Desktop::toggleLight() |
648 | { | 647 | { |
649 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 648 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
650 | e << -2; // toggle | 649 | e << -2; // toggle |
651 | } | 650 | } |
652 | 651 | ||
653 | void Desktop::toggleSymbolInput() | 652 | void Desktop::toggleSymbolInput() |
654 | { | 653 | { |
655 | tb->toggleSymbolInput(); | 654 | tb->toggleSymbolInput(); |
656 | } | 655 | } |
657 | 656 | ||
658 | void Desktop::toggleNumLockState() | 657 | void Desktop::toggleNumLockState() |
659 | { | 658 | { |
660 | tb->toggleNumLockState(); | 659 | tb->toggleNumLockState(); |
661 | } | 660 | } |
662 | 661 | ||
663 | void Desktop::toggleCapsLockState() | 662 | void Desktop::toggleCapsLockState() |
664 | { | 663 | { |
665 | tb->toggleCapsLockState(); | 664 | tb->toggleCapsLockState(); |
666 | } | 665 | } |
667 | 666 | ||
668 | void Desktop::styleChange( QStyle &s ) | 667 | void Desktop::styleChange( QStyle &s ) |
669 | { | 668 | { |
670 | QWidget::styleChange( s ); | 669 | QWidget::styleChange( s ); |
671 | int displayw = qApp->desktop()->width(); | 670 | int displayw = qApp->desktop()->width(); |
672 | int displayh = qApp->desktop()->height(); | 671 | int displayh = qApp->desktop()->height(); |
673 | 672 | ||
674 | QSize sz = tb->sizeHint(); | 673 | QSize sz = tb->sizeHint(); |
675 | 674 | ||
676 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 675 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
677 | } | 676 | } |
678 | 677 | ||
679 | void DesktopApplication::shutdown() | 678 | void DesktopApplication::shutdown() |
680 | { | 679 | { |
681 | if ( type() != GuiServer ) | 680 | if ( type() != GuiServer ) |
682 | return; | 681 | return; |
683 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 682 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
684 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), | 683 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), |
685 | this, SLOT(shutdown(ShutdownImpl::Type)) ); | 684 | this, SLOT(shutdown(ShutdownImpl::Type)) ); |
686 | sd->showMaximized(); | 685 | sd->showMaximized(); |
687 | } | 686 | } |
688 | 687 | ||
689 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) | 688 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) |
690 | { | 689 | { |
691 | switch ( t ) { | 690 | switch ( t ) { |
692 | case ShutdownImpl::ShutdownSystem: | 691 | case ShutdownImpl::ShutdownSystem: |
693 | execlp("shutdown", "shutdown", "-h", "now", (void*)0); | 692 | execlp("shutdown", "shutdown", "-h", "now", (void*)0); |
694 | break; | 693 | break; |
695 | case ShutdownImpl::RebootSystem: | 694 | case ShutdownImpl::RebootSystem: |
696 | execlp("shutdown", "shutdown", "-r", "now", (void*)0); | 695 | execlp("shutdown", "shutdown", "-r", "now", (void*)0); |
697 | break; | 696 | break; |
698 | case ShutdownImpl::RestartDesktop: | 697 | case ShutdownImpl::RestartDesktop: |
699 | restart(); | 698 | restart(); |
700 | break; | 699 | break; |
701 | case ShutdownImpl::TerminateDesktop: | 700 | case ShutdownImpl::TerminateDesktop: |
702 | prepareForTermination(FALSE); | 701 | prepareForTermination(FALSE); |
703 | 702 | ||
704 | // This is a workaround for a Qt bug | 703 | // This is a workaround for a Qt bug |
705 | // clipboard applet has to stop its poll timer, or Qt/E | 704 | // clipboard applet has to stop its poll timer, or Qt/E |
706 | // will hang on quit() right before it emits aboutToQuit() | 705 | // will hang on quit() right before it emits aboutToQuit() |
707 | emit aboutToQuit ( ); | 706 | emit aboutToQuit ( ); |
708 | 707 | ||
709 | quit(); | 708 | quit(); |
710 | break; | 709 | break; |
711 | } | 710 | } |
712 | } | 711 | } |
713 | 712 | ||
714 | void DesktopApplication::restart() | 713 | void DesktopApplication::restart() |
715 | { | 714 | { |
716 | prepareForTermination(TRUE); | 715 | prepareForTermination(TRUE); |
717 | 716 | ||
718 | #ifdef Q_WS_QWS | 717 | #ifdef Q_WS_QWS |
719 | for ( int fd = 3; fd < 100; fd++ ) | 718 | for ( int fd = 3; fd < 100; fd++ ) |
720 | close( fd ); | 719 | close( fd ); |
721 | #if defined(QT_DEMO_SINGLE_FLOPPY) | 720 | #if defined(QT_DEMO_SINGLE_FLOPPY) |
722 | execl( "/sbin/init", "qpe", 0 ); | 721 | execl( "/sbin/init", "qpe", 0 ); |
723 | #elif defined(QT_QWS_CASSIOPEIA) | 722 | #elif defined(QT_QWS_CASSIOPEIA) |
724 | execl( "/bin/sh", "sh", 0 ); | 723 | execl( "/bin/sh", "sh", 0 ); |
725 | #else | 724 | #else |
726 | execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 ); | 725 | execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 ); |
727 | #endif | 726 | #endif |
728 | exit(1); | 727 | exit(1); |
729 | #endif | 728 | #endif |
730 | } | 729 | } |
731 | 730 | ||
732 | void Desktop::startTransferServer() | 731 | void Desktop::startTransferServer() |
733 | { | 732 | { |
734 | // start qcop bridge server | 733 | // start qcop bridge server |
735 | qcopBridge = new QCopBridge( 4243 ); | 734 | qcopBridge = new QCopBridge( 4243 ); |
736 | if ( !qcopBridge->ok() ) { | 735 | if ( !qcopBridge->ok() ) { |
737 | delete qcopBridge; | 736 | delete qcopBridge; |
738 | qcopBridge = 0; | 737 | qcopBridge = 0; |
739 | } | 738 | } |
740 | // start transfer server | 739 | // start transfer server |
@@ -769,42 +768,42 @@ void Desktop::rereadVolumes() | |||
769 | keyclick = cfg.readBoolEntry("KeySound"); | 768 | keyclick = cfg.readBoolEntry("KeySound"); |
770 | alarmsound = cfg.readBoolEntry("AlarmSound"); | 769 | alarmsound = cfg.readBoolEntry("AlarmSound"); |
771 | // Config cfg("Sound"); | 770 | // Config cfg("Sound"); |
772 | // cfg.setGroup("System"); | 771 | // cfg.setGroup("System"); |
773 | // touchclick = cfg.readBoolEntry("Touch"); | 772 | // touchclick = cfg.readBoolEntry("Touch"); |
774 | // keyclick = cfg.readBoolEntry("Key"); | 773 | // keyclick = cfg.readBoolEntry("Key"); |
775 | } | 774 | } |
776 | 775 | ||
777 | void Desktop::keyClick() | 776 | void Desktop::keyClick() |
778 | { | 777 | { |
779 | if ( keyclick ) | 778 | if ( keyclick ) |
780 | ODevice::inst ( )-> keySound ( ); | 779 | ODevice::inst ( )-> keySound ( ); |
781 | } | 780 | } |
782 | 781 | ||
783 | void Desktop::screenClick() | 782 | void Desktop::screenClick() |
784 | { | 783 | { |
785 | if ( touchclick ) | 784 | if ( touchclick ) |
786 | ODevice::inst ( )-> touchSound ( ); | 785 | ODevice::inst ( )-> touchSound ( ); |
787 | } | 786 | } |
788 | 787 | ||
789 | void Desktop::soundAlarm() | 788 | void Desktop::soundAlarm() |
790 | { | 789 | { |
791 | if ( qpedesktop-> alarmsound ) | 790 | if ( qpedesktop-> alarmsound ) |
792 | ODevice::inst ( )-> alarmSound ( ); | 791 | ODevice::inst ( )-> alarmSound ( ); |
793 | } | 792 | } |
794 | 793 | ||
795 | bool Desktop::eventFilter( QObject *, QEvent *ev ) | 794 | bool Desktop::eventFilter( QObject *, QEvent *ev ) |
796 | { | 795 | { |
797 | if ( ev-> type ( ) == QEvent::KeyPress ) { | 796 | if ( ev-> type ( ) == QEvent::KeyPress ) { |
798 | QKeyEvent *ke = (QKeyEvent *) ev; | 797 | QKeyEvent *ke = (QKeyEvent *) ev; |
799 | if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key | 798 | if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key |
800 | QWidget *active = qApp-> activeWindow ( ); | 799 | QWidget *active = qApp-> activeWindow ( ); |
801 | 800 | ||
802 | if ( active && active-> isPopup ( )) | 801 | if ( active && active-> isPopup ( )) |
803 | active->close(); | 802 | active->close(); |
804 | 803 | ||
805 | raiseMenu ( ); | 804 | raiseMenu ( ); |
806 | return true; | 805 | return true; |
807 | } | 806 | } |
808 | } | 807 | } |
809 | return false; | 808 | return false; |
810 | } | 809 | } |