-rw-r--r-- | core/launcher/desktop.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 86527f6..6def126 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -498,41 +498,42 @@ Desktop::Desktop() : | |||
498 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 498 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
499 | 499 | ||
500 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); | 500 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); |
501 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); | 501 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); |
502 | 502 | ||
503 | int displayw = qApp->desktop() ->width(); | 503 | int displayw = qApp->desktop() ->width(); |
504 | int displayh = qApp->desktop() ->height(); | 504 | int displayh = qApp->desktop() ->height(); |
505 | 505 | ||
506 | 506 | ||
507 | QSize sz = tb->sizeHint(); | 507 | QSize sz = tb->sizeHint(); |
508 | 508 | ||
509 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 509 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
510 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 510 | layout(); |
511 | 511 | ||
512 | tb->show(); | 512 | tb->show(); |
513 | launcher->showMaximized(); | 513 | launcher->showMaximized(); |
514 | launcher->show(); | 514 | launcher->show(); |
515 | launcher->raise(); | 515 | launcher->raise(); |
516 | #if defined(QPE_HAVE_MEMALERTER) | 516 | #if defined(QPE_HAVE_MEMALERTER) |
517 | 517 | ||
518 | initMemalerter(); | 518 | initMemalerter(); |
519 | #endif | 519 | #endif |
520 | // start services | 520 | // start services |
521 | startTransferServer(); | 521 | startTransferServer(); |
522 | ( void ) new IrServer( this ); | 522 | ( void ) new IrServer( this ); |
523 | 523 | ||
524 | packageSlave = new PackageSlave( this ); | 524 | packageSlave = new PackageSlave( this ); |
525 | 525 | ||
526 | qApp->installEventFilter( this ); | 526 | qApp->installEventFilter( this ); |
527 | qApp->desktop()->installEventFilter( this ); | ||
527 | 528 | ||
528 | qApp-> setMainWidget ( launcher ); | 529 | qApp-> setMainWidget ( launcher ); |
529 | } | 530 | } |
530 | 531 | ||
531 | void Desktop::show() | 532 | void Desktop::show() |
532 | { | 533 | { |
533 | login( TRUE ); | 534 | login( TRUE ); |
534 | QWidget::show(); | 535 | QWidget::show(); |
535 | } | 536 | } |
536 | 537 | ||
537 | Desktop::~Desktop() | 538 | Desktop::~Desktop() |
538 | { | 539 | { |
@@ -723,30 +724,25 @@ void Desktop::toggleNumLockState() | |||
723 | { | 724 | { |
724 | tb->toggleNumLockState(); | 725 | tb->toggleNumLockState(); |
725 | } | 726 | } |
726 | 727 | ||
727 | void Desktop::toggleCapsLockState() | 728 | void Desktop::toggleCapsLockState() |
728 | { | 729 | { |
729 | tb->toggleCapsLockState(); | 730 | tb->toggleCapsLockState(); |
730 | } | 731 | } |
731 | 732 | ||
732 | void Desktop::styleChange( QStyle &s ) | 733 | void Desktop::styleChange( QStyle &s ) |
733 | { | 734 | { |
734 | QWidget::styleChange( s ); | 735 | QWidget::styleChange( s ); |
735 | int displayw = qApp->desktop() ->width(); | 736 | layout(); |
736 | int displayh = qApp->desktop() ->height(); | ||
737 | |||
738 | QSize sz = tb->sizeHint(); | ||
739 | |||
740 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | ||
741 | } | 737 | } |
742 | 738 | ||
743 | void DesktopApplication::shutdown() | 739 | void DesktopApplication::shutdown() |
744 | { | 740 | { |
745 | if ( type() != GuiServer ) | 741 | if ( type() != GuiServer ) |
746 | return ; | 742 | return ; |
747 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 743 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
748 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), | 744 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), |
749 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); | 745 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); |
750 | sd->showMaximized(); | 746 | sd->showMaximized(); |
751 | } | 747 | } |
752 | 748 | ||
@@ -797,48 +793,69 @@ void DesktopApplication::restart() | |||
797 | #elif defined(QT_QWS_CASSIOPEIA) | 793 | #elif defined(QT_QWS_CASSIOPEIA) |
798 | 794 | ||
799 | execl( "/bin/sh", "sh", 0 ); | 795 | execl( "/bin/sh", "sh", 0 ); |
800 | #else | 796 | #else |
801 | 797 | ||
802 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); | 798 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); |
803 | #endif | 799 | #endif |
804 | 800 | ||
805 | exit( 1 ); | 801 | exit( 1 ); |
806 | #endif | 802 | #endif |
807 | } | 803 | } |
808 | 804 | ||
805 | void Desktop::layout() | ||
806 | { | ||
807 | int displayw = qApp->desktop() ->width(); | ||
808 | int displayh = qApp->desktop() ->height(); | ||
809 | |||
810 | QSize sz = tb->sizeHint(); | ||
811 | |||
812 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | ||
813 | tb->calcMaxWindowRect(); | ||
814 | } | ||
815 | |||
809 | void Desktop::startTransferServer() | 816 | void Desktop::startTransferServer() |
810 | { | 817 | { |
811 | // start qcop bridge server | 818 | // start qcop bridge server |
812 | qcopBridge = new QCopBridge( 4243 ); | 819 | qcopBridge = new QCopBridge( 4243 ); |
813 | if ( !qcopBridge->ok() ) { | 820 | if ( !qcopBridge->ok() ) { |
814 | delete qcopBridge; | 821 | delete qcopBridge; |
815 | qcopBridge = 0; | 822 | qcopBridge = 0; |
816 | } | 823 | } |
817 | // start transfer server | 824 | // start transfer server |
818 | transferServer = new TransferServer( 4242 ); | 825 | transferServer = new TransferServer( 4242 ); |
819 | if ( !transferServer->ok() ) { | 826 | if ( !transferServer->ok() ) { |
820 | delete transferServer; | 827 | delete transferServer; |
821 | transferServer = 0; | 828 | transferServer = 0; |
822 | } | 829 | } |
823 | if ( !transferServer || !qcopBridge ) | 830 | if ( !transferServer || !qcopBridge ) |
824 | startTimer( 2000 ); | 831 | startTimer( 2000 ); |
825 | } | 832 | } |
826 | 833 | ||
827 | void Desktop::timerEvent( QTimerEvent *e ) | 834 | void Desktop::timerEvent( QTimerEvent *e ) |
828 | { | 835 | { |
829 | killTimer( e->timerId() ); | 836 | killTimer( e->timerId() ); |
830 | startTransferServer(); | 837 | startTransferServer(); |
831 | } | 838 | } |
832 | 839 | ||
840 | bool Desktop::eventFilter( QObject *o, QEvent *ev ) | ||
841 | { | ||
842 | if ( o != qApp->desktop() || ev->type() != QEvent::Resize ) | ||
843 | return QWidget::eventFilter( o, ev ); | ||
844 | |||
845 | layout(); | ||
846 | |||
847 | return QWidget::eventFilter( o, ev ); | ||
848 | } | ||
849 | |||
833 | void Desktop::terminateServers() | 850 | void Desktop::terminateServers() |
834 | { | 851 | { |
835 | delete transferServer; | 852 | delete transferServer; |
836 | delete qcopBridge; | 853 | delete qcopBridge; |
837 | transferServer = 0; | 854 | transferServer = 0; |
838 | qcopBridge = 0; | 855 | qcopBridge = 0; |
839 | } | 856 | } |
840 | 857 | ||
841 | void DesktopApplication::rereadVolumes() | 858 | void DesktopApplication::rereadVolumes() |
842 | { | 859 | { |
843 | Config cfg( "qpe" ); | 860 | Config cfg( "qpe" ); |
844 | cfg. setGroup ( "Volume" ); | 861 | cfg. setGroup ( "Volume" ); |