-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 | |||
@@ -195,19 +195,19 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | |||
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 | } |
@@ -245,17 +245,17 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | |||
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(); |
@@ -554,25 +554,24 @@ void Desktop::raiseEmail() | |||
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> |
@@ -602,20 +601,20 @@ static void darkScreen() | |||
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 | ||
@@ -633,19 +632,19 @@ void Desktop::togglePower() | |||
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 | } |
@@ -695,22 +694,22 @@ void DesktopApplication::shutdown( ShutdownImpl::Type t ) | |||
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); |
@@ -793,17 +792,17 @@ void Desktop::soundAlarm() | |||
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; |