summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 680cc06..547daa9 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -464,201 +464,204 @@ void Desktop::raiseLauncher()
464 else 464 else
465 launcher->raise(); 465 launcher->raise();
466} 466}
467 467
468void Desktop::executeOrModify(const QString& appLnkFile) 468void Desktop::executeOrModify(const QString& appLnkFile)
469{ 469{
470 AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile); 470 AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile);
471 if ( lnk.isValid() ) { 471 if ( lnk.isValid() ) {
472 QCString app = lnk.exec().utf8(); 472 QCString app = lnk.exec().utf8();
473 Global::terminateBuiltin("calibrate"); 473 Global::terminateBuiltin("calibrate");
474 if ( QCopChannel::isRegistered("QPE/Application/" + app) ) { 474 if ( QCopChannel::isRegistered("QPE/Application/" + app) ) {
475 MRUList::addTask(&lnk); 475 MRUList::addTask(&lnk);
476 if ( hasVisibleWindow(app) ) 476 if ( hasVisibleWindow(app) )
477 QCopChannel::send("QPE/Application/" + app, "nextView()"); 477 QCopChannel::send("QPE/Application/" + app, "nextView()");
478 else 478 else
479 QCopChannel::send("QPE/Application/" + app, "raise()"); 479 QCopChannel::send("QPE/Application/" + app, "raise()");
480 } else { 480 } else {
481 lnk.execute(); 481 lnk.execute();
482 } 482 }
483 } 483 }
484} 484}
485 485
486void Desktop::raiseDatebook() 486void Desktop::raiseDatebook()
487{ 487{
488 executeOrModify("Applications/datebook.desktop"); 488 executeOrModify("Applications/datebook.desktop");
489} 489}
490 490
491void Desktop::raiseContacts() 491void Desktop::raiseContacts()
492{ 492{
493 executeOrModify("Applications/addressbook.desktop"); 493 executeOrModify("Applications/addressbook.desktop");
494} 494}
495 495
496void Desktop::raiseMenu() 496void Desktop::raiseMenu()
497{ 497{
498 Global::terminateBuiltin("calibrate"); 498 Global::terminateBuiltin("calibrate");
499 tb->startMenu()->launch(); 499 tb->startMenu()->launch();
500} 500}
501 501
502void Desktop::raiseEmail() 502void Desktop::raiseEmail()
503{ 503{
504 executeOrModify("Applications/qtmail.desktop"); 504 executeOrModify("Applications/qtmail.desktop");
505} 505}
506 506
507// autoStarts apps on resume and start 507// autoStarts apps on resume and start
508void Desktop::execAutoStart() 508void Desktop::execAutoStart()
509{ 509{
510 QString appName; 510 QString appName;
511 Config cfg( "autostart" ); 511 Config cfg( "autostart" );
512 cfg.setGroup( "AutoStart" ); 512 cfg.setGroup( "AutoStart" );
513 appName = cfg.readEntry("Apps", ""); 513 appName = cfg.readEntry("Apps", "");
514 QCopEnvelope e("QPE/System", "execute(QString)"); 514 QCopEnvelope e("QPE/System", "execute(QString)");
515 e << QString(appName); 515 e << QString(appName);
516} 516}
517 517
518#if defined(QPE_HAVE_TOGGLELIGHT) 518#if defined(QPE_HAVE_TOGGLELIGHT)
519#include <qpe/config.h> 519#include <qpe/config.h>
520 520
521#include <sys/ioctl.h> 521#include <sys/ioctl.h>
522#include <sys/types.h> 522#include <sys/types.h>
523#include <fcntl.h> 523#include <fcntl.h>
524#include <unistd.h> 524#include <unistd.h>
525#include <errno.h> 525#include <errno.h>
526#include <linux/ioctl.h> 526#include <linux/ioctl.h>
527#include <time.h> 527#include <time.h>
528#endif 528#endif
529 529
530static bool blanked=FALSE; 530static bool blanked=FALSE;
531 531
532static void blankScreen() 532static void blankScreen()
533{ 533{
534 if ( !qt_screen ) return; 534 if ( !qt_screen ) return;
535 /* Should use a big black window instead. 535 /* Should use a big black window instead.
536 QGfx* g = qt_screen->screenGfx(); 536 QGfx* g = qt_screen->screenGfx();
537 g->fillRect(0,0,qt_screen->width(),qt_screen->height()); 537 g->fillRect(0,0,qt_screen->width(),qt_screen->height());
538 delete g; 538 delete g;
539 */ 539 */
540 blanked = TRUE; 540 blanked = TRUE;
541} 541}
542 542
543static void darkScreen() 543static void darkScreen()
544{ 544{
545 extern void qpe_setBacklight(int); 545 extern void qpe_setBacklight(int);
546 qpe_setBacklight(0); // force off 546 qpe_setBacklight(0); // force off
547} 547}
548 548
549 549
550void Desktop::togglePower() 550void Desktop::togglePower()
551{ 551{
552 bool wasloggedin = loggedin; 552 bool wasloggedin = loggedin;
553 loggedin=0; 553 loggedin=0;
554 darkScreen(); 554 darkScreen();
555 if ( wasloggedin ) 555 if ( wasloggedin )
556 blankScreen(); 556 blankScreen();
557 557
558 system("apm --suspend"); 558 system("apm --suspend");
559 559
560 sleep(2);
561
560 QWSServer::screenSaverActivate( FALSE ); 562 QWSServer::screenSaverActivate( FALSE );
561 { 563 {
562 QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep 564 QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep
563 QCopEnvelope e("QPE/System", "setBacklight(int)"); 565 QCopEnvelope e("QPE/System", "setBacklight(int)");
564 e << -3; // Force on 566 e << -3; // Force on
565 } 567 }
566 if ( wasloggedin ) { 568 if ( wasloggedin ) {
567 login(TRUE); 569 login(TRUE);
568 } 570 }
571
569 execAutoStart(); 572 execAutoStart();
570 //qcopBridge->closeOpenConnections(); 573 //qcopBridge->closeOpenConnections();
571 //qDebug("called togglePower()!!!!!!"); 574 //qDebug("called togglePower()!!!!!!");
572} 575}
573 576
574void Desktop::toggleLight() 577void Desktop::toggleLight()
575{ 578{
576 QCopEnvelope e("QPE/System", "setBacklight(int)"); 579 QCopEnvelope e("QPE/System", "setBacklight(int)");
577 e << -2; // toggle 580 e << -2; // toggle
578} 581}
579 582
580void Desktop::toggleSymbolInput() 583void Desktop::toggleSymbolInput()
581{ 584{
582 tb->toggleSymbolInput(); 585 tb->toggleSymbolInput();
583} 586}
584 587
585void Desktop::toggleNumLockState() 588void Desktop::toggleNumLockState()
586{ 589{
587 tb->toggleNumLockState(); 590 tb->toggleNumLockState();
588} 591}
589 592
590void Desktop::toggleCapsLockState() 593void Desktop::toggleCapsLockState()
591{ 594{
592 tb->toggleCapsLockState(); 595 tb->toggleCapsLockState();
593} 596}
594 597
595void Desktop::styleChange( QStyle &s ) 598void Desktop::styleChange( QStyle &s )
596{ 599{
597 QWidget::styleChange( s ); 600 QWidget::styleChange( s );
598 int displayw = qApp->desktop()->width(); 601 int displayw = qApp->desktop()->width();
599 int displayh = qApp->desktop()->height(); 602 int displayh = qApp->desktop()->height();
600 603
601 QSize sz = tb->sizeHint(); 604 QSize sz = tb->sizeHint();
602 605
603 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); 606 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
604} 607}
605 608
606void DesktopApplication::shutdown() 609void DesktopApplication::shutdown()
607{ 610{
608 if ( type() != GuiServer ) 611 if ( type() != GuiServer )
609 return; 612 return;
610 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 613 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
611 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), 614 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
612 this, SLOT(shutdown(ShutdownImpl::Type)) ); 615 this, SLOT(shutdown(ShutdownImpl::Type)) );
613 sd->showMaximized(); 616 sd->showMaximized();
614} 617}
615 618
616void DesktopApplication::shutdown( ShutdownImpl::Type t ) 619void DesktopApplication::shutdown( ShutdownImpl::Type t )
617{ 620{
618 switch ( t ) { 621 switch ( t ) {
619 case ShutdownImpl::ShutdownSystem: 622 case ShutdownImpl::ShutdownSystem:
620 execlp("shutdown", "shutdown", "-h", "now", (void*)0); 623 execlp("shutdown", "shutdown", "-h", "now", (void*)0);
621 break; 624 break;
622 case ShutdownImpl::RebootSystem: 625 case ShutdownImpl::RebootSystem:
623 execlp("shutdown", "shutdown", "-r", "now", (void*)0); 626 execlp("shutdown", "shutdown", "-r", "now", (void*)0);
624 break; 627 break;
625 case ShutdownImpl::RestartDesktop: 628 case ShutdownImpl::RestartDesktop:
626 restart(); 629 restart();
627 break; 630 break;
628 case ShutdownImpl::TerminateDesktop: 631 case ShutdownImpl::TerminateDesktop:
629 prepareForTermination(FALSE); 632 prepareForTermination(FALSE);
630 quit(); 633 quit();
631 break; 634 break;
632 } 635 }
633} 636}
634 637
635void DesktopApplication::restart() 638void DesktopApplication::restart()
636{ 639{
637 prepareForTermination(TRUE); 640 prepareForTermination(TRUE);
638 641
639#ifdef Q_WS_QWS 642#ifdef Q_WS_QWS
640 for ( int fd = 3; fd < 100; fd++ ) 643 for ( int fd = 3; fd < 100; fd++ )
641 close( fd ); 644 close( fd );
642#if defined(QT_DEMO_SINGLE_FLOPPY) 645#if defined(QT_DEMO_SINGLE_FLOPPY)
643 execl( "/sbin/init", "qpe", 0 ); 646 execl( "/sbin/init", "qpe", 0 );
644#elif defined(QT_QWS_CASSIOPEIA) 647#elif defined(QT_QWS_CASSIOPEIA)
645 execl( "/bin/sh", "sh", 0 ); 648 execl( "/bin/sh", "sh", 0 );
646#else 649#else
647 execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 ); 650 execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 );
648#endif 651#endif
649 exit(1); 652 exit(1);
650#endif 653#endif
651} 654}
652 655
653void Desktop::startTransferServer() 656void Desktop::startTransferServer()
654{ 657{
655 // start qcop bridge server 658 // start qcop bridge server
656 qcopBridge = new QCopBridge( 4243 ); 659 qcopBridge = new QCopBridge( 4243 );
657 if ( !qcopBridge->ok() ) { 660 if ( !qcopBridge->ok() ) {
658 delete qcopBridge; 661 delete qcopBridge;
659 qcopBridge = 0; 662 qcopBridge = 0;
660 } 663 }
661 // start transfer server 664 // start transfer server
662 transferServer = new TransferServer( 4242 ); 665 transferServer = new TransferServer( 4242 );
663 if ( !transferServer->ok() ) { 666 if ( !transferServer->ok() ) {
664 delete transferServer; 667 delete transferServer;