-rw-r--r-- | library/qpeapplication.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index ac7b779..c562f6c 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -47,99 +47,99 @@ | |||
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qdragobject.h> | 48 | #include <qdragobject.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qevent.h> | 50 | #include <qevent.h> |
51 | #include <qtooltip.h> | 51 | #include <qtooltip.h> |
52 | #include <qsignal.h> | 52 | #include <qsignal.h> |
53 | #include "qpeapplication.h" | 53 | #include "qpeapplication.h" |
54 | #include "qpestyle.h" | 54 | #include "qpestyle.h" |
55 | #include "styleinterface.h" | 55 | #include "styleinterface.h" |
56 | #if QT_VERSION >= 300 | 56 | #if QT_VERSION >= 300 |
57 | #include <qstylefactory.h> | 57 | #include <qstylefactory.h> |
58 | #else | 58 | #else |
59 | #include <qplatinumstyle.h> | 59 | #include <qplatinumstyle.h> |
60 | #include <qwindowsstyle.h> | 60 | #include <qwindowsstyle.h> |
61 | #include <qmotifstyle.h> | 61 | #include <qmotifstyle.h> |
62 | #include <qmotifplusstyle.h> | 62 | #include <qmotifplusstyle.h> |
63 | #include "lightstyle.h" | 63 | #include "lightstyle.h" |
64 | 64 | ||
65 | #include <qpe/qlibrary.h> | 65 | #include <qpe/qlibrary.h> |
66 | #endif | 66 | #endif |
67 | #include "global.h" | 67 | #include "global.h" |
68 | #include "resource.h" | 68 | #include "resource.h" |
69 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 69 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
70 | #include "qutfcodec.h" | 70 | #include "qutfcodec.h" |
71 | #endif | 71 | #endif |
72 | #include "config.h" | 72 | #include "config.h" |
73 | #include "network.h" | 73 | #include "network.h" |
74 | #ifdef QWS | 74 | #ifdef QWS |
75 | #include "fontmanager.h" | 75 | #include "fontmanager.h" |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | #include "alarmserver.h" | 78 | #include "alarmserver.h" |
79 | #include "applnk.h" | 79 | #include "applnk.h" |
80 | #include "qpemenubar.h" | 80 | #include "qpemenubar.h" |
81 | #include "textcodecinterface.h" | 81 | #include "textcodecinterface.h" |
82 | #include "imagecodecinterface.h" | 82 | #include "imagecodecinterface.h" |
83 | 83 | ||
84 | #include <unistd.h> | 84 | #include <unistd.h> |
85 | #include <sys/file.h> | 85 | #include <sys/file.h> |
86 | #include <sys/ioctl.h> | 86 | #include <sys/ioctl.h> |
87 | #include <sys/soundcard.h> | 87 | #include <sys/soundcard.h> |
88 | 88 | ||
89 | #include "qt_override_p.h" | 89 | #include "qt_override_p.h" |
90 | 90 | ||
91 | 91 | ||
92 | class QPEApplicationData | 92 | class QPEApplicationData |
93 | { | 93 | { |
94 | public: | 94 | public: |
95 | QPEApplicationData ( ) | 95 | QPEApplicationData ( ) |
96 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 96 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
97 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 97 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
98 | keep_running( true ), qpe_main_widget( 0 ) | 98 | keep_running( true ), qpe_main_widget( 0 ) |
99 | 99 | ||
100 | { | 100 | { |
101 | qcopq.setAutoDelete( TRUE ); | 101 | qcopq.setAutoDelete( TRUE ); |
102 | } | 102 | } |
103 | 103 | ||
104 | int presstimer; | 104 | int presstimer; |
105 | QWidget* presswidget; | 105 | QWidget* presswidget; |
106 | QPoint presspos; | 106 | QPoint presspos; |
107 | 107 | ||
108 | bool rightpressed : 1; | 108 | bool rightpressed : 1; |
109 | bool kbgrabbed : 1; | 109 | bool kbgrabbed : 1; |
110 | bool notbusysent : 1; | 110 | bool notbusysent : 1; |
111 | bool preloaded : 1; | 111 | bool preloaded : 1; |
112 | bool forceshow : 1; | 112 | bool forceshow : 1; |
113 | bool nomaximize : 1; | 113 | bool nomaximize : 1; |
114 | bool keep_running : 1; | 114 | bool keep_running : 1; |
115 | 115 | ||
116 | QString appName; | 116 | QString appName; |
117 | struct QCopRec | 117 | struct QCopRec |
118 | { | 118 | { |
119 | QCopRec( const QCString &ch, const QCString &msg, | 119 | QCopRec( const QCString &ch, const QCString &msg, |
120 | const QByteArray &d ) : | 120 | const QByteArray &d ) : |
121 | channel( ch ), message( msg ), data( d ) | 121 | channel( ch ), message( msg ), data( d ) |
122 | { } | 122 | { } |
123 | 123 | ||
124 | QCString channel; | 124 | QCString channel; |
125 | QCString message; | 125 | QCString message; |
126 | QByteArray data; | 126 | QByteArray data; |
127 | }; | 127 | }; |
128 | QWidget* qpe_main_widget; | 128 | QWidget* qpe_main_widget; |
129 | QList<QCopRec> qcopq; | 129 | QList<QCopRec> qcopq; |
130 | 130 | ||
131 | void enqueueQCop( const QCString &ch, const QCString &msg, | 131 | void enqueueQCop( const QCString &ch, const QCString &msg, |
132 | const QByteArray &data ) | 132 | const QByteArray &data ) |
133 | { | 133 | { |
134 | qcopq.append( new QCopRec( ch, msg, data ) ); | 134 | qcopq.append( new QCopRec( ch, msg, data ) ); |
135 | } | 135 | } |
136 | void sendQCopQ() | 136 | void sendQCopQ() |
137 | { | 137 | { |
138 | QCopRec * r; | 138 | QCopRec * r; |
139 | #ifndef QT_NO_COP | 139 | #ifndef QT_NO_COP |
140 | 140 | ||
141 | for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) | 141 | for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) |
142 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 142 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | qcopq.clear(); | 145 | qcopq.clear(); |
@@ -471,103 +471,103 @@ static void setTreble( int t = 0, int percent = -1 ) | |||
471 | 471 | ||
472 | This signal is emitted when a message is received on this | 472 | This signal is emitted when a message is received on this |
473 | application's QPE/Application/<i>appname</i> \link qcop.html | 473 | application's QPE/Application/<i>appname</i> \link qcop.html |
474 | QCop\endlink channel. | 474 | QCop\endlink channel. |
475 | 475 | ||
476 | The slot to which you connect this signal uses \a msg and \a data | 476 | The slot to which you connect this signal uses \a msg and \a data |
477 | in the following way: | 477 | in the following way: |
478 | 478 | ||
479 | \code | 479 | \code |
480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
481 | { | 481 | { |
482 | QDataStream stream( data, IO_ReadOnly ); | 482 | QDataStream stream( data, IO_ReadOnly ); |
483 | if ( msg == "someMessage(int,int,int)" ) { | 483 | if ( msg == "someMessage(int,int,int)" ) { |
484 | int a,b,c; | 484 | int a,b,c; |
485 | stream >> a >> b >> c; | 485 | stream >> a >> b >> c; |
486 | ... | 486 | ... |
487 | } else if ( msg == "otherMessage(QString)" ) { | 487 | } else if ( msg == "otherMessage(QString)" ) { |
488 | ... | 488 | ... |
489 | } | 489 | } |
490 | } | 490 | } |
491 | \endcode | 491 | \endcode |
492 | 492 | ||
493 | \sa qcop.html | 493 | \sa qcop.html |
494 | Note that messages received here may be processed by qpe application | 494 | Note that messages received here may be processed by qpe application |
495 | and emitted as signals, such as flush() and reload(). | 495 | and emitted as signals, such as flush() and reload(). |
496 | */ | 496 | */ |
497 | 497 | ||
498 | /*! | 498 | /*! |
499 | Constructs a QPEApplication just as you would construct | 499 | Constructs a QPEApplication just as you would construct |
500 | a QApplication, passing \a argc, \a argv, and \a t. | 500 | a QApplication, passing \a argc, \a argv, and \a t. |
501 | 501 | ||
502 | For applications, \a t should be the default, GuiClient. Only | 502 | For applications, \a t should be the default, GuiClient. Only |
503 | the Qtopia server passes GuiServer. | 503 | the Qtopia server passes GuiServer. |
504 | */ | 504 | */ |
505 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 505 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
506 | : QApplication( argc, argv, t ) | 506 | : QApplication( argc, argv, t ) |
507 | { | 507 | { |
508 | d = new QPEApplicationData; | 508 | d = new QPEApplicationData; |
509 | d->loadTextCodecs(); | 509 | d->loadTextCodecs(); |
510 | d->loadImageCodecs(); | 510 | d->loadImageCodecs(); |
511 | int dw = desktop() ->width(); | 511 | int dw = desktop() ->width(); |
512 | 512 | ||
513 | if ( dw < 200 ) { | 513 | if ( dw < 200 ) { |
514 | setFont( QFont( "helvetica", 8 ) ); | 514 | setFont( QFont( "helvetica", 8 ) ); |
515 | AppLnk::setSmallIconSize( 10 ); | 515 | AppLnk::setSmallIconSize( 10 ); |
516 | AppLnk::setBigIconSize( 28 ); | 516 | AppLnk::setBigIconSize( 28 ); |
517 | } | 517 | } |
518 | else if ( dw > 600 ) { | 518 | else if ( dw > 600 ) { |
519 | setFont( QFont( "helvetica", 12 ) ); | 519 | setFont( QFont( "helvetica", 18 ) ); |
520 | AppLnk::setSmallIconSize( 24 ); | 520 | AppLnk::setSmallIconSize( 24 ); |
521 | AppLnk::setBigIconSize( 48 ); | 521 | AppLnk::setBigIconSize( 48 ); |
522 | } | 522 | } |
523 | else if ( dw > 200 ) { | 523 | else if ( dw > 200 ) { |
524 | setFont( QFont( "helvetica", 10 ) ); | 524 | setFont( QFont( "helvetica", 10 ) ); |
525 | AppLnk::setSmallIconSize( 16 ); | 525 | AppLnk::setSmallIconSize( 14 ); |
526 | AppLnk::setBigIconSize( 32 ); | 526 | AppLnk::setBigIconSize( 32 ); |
527 | } | 527 | } |
528 | 528 | ||
529 | 529 | ||
530 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 530 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
531 | 531 | ||
532 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 532 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
533 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 533 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
534 | 534 | ||
535 | QString qcopfn( "/tmp/qcop-msg-" ); | 535 | QString qcopfn( "/tmp/qcop-msg-" ); |
536 | qcopfn += QString( argv[ 0 ] ); // append command name | 536 | qcopfn += QString( argv[ 0 ] ); // append command name |
537 | 537 | ||
538 | QFile f( qcopfn ); | 538 | QFile f( qcopfn ); |
539 | if ( f.open( IO_ReadOnly ) ) { | 539 | if ( f.open( IO_ReadOnly ) ) { |
540 | flock( f.handle(), LOCK_EX ); | 540 | flock( f.handle(), LOCK_EX ); |
541 | } | 541 | } |
542 | 542 | ||
543 | sysChannel = new QCopChannel( "QPE/System", this ); | 543 | sysChannel = new QCopChannel( "QPE/System", this ); |
544 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 544 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
545 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 545 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
546 | 546 | ||
547 | QCString channel = QCString( argv[ 0 ] ); | 547 | QCString channel = QCString( argv[ 0 ] ); |
548 | channel.replace( QRegExp( ".*/" ), "" ); | 548 | channel.replace( QRegExp( ".*/" ), "" ); |
549 | d->appName = channel; | 549 | d->appName = channel; |
550 | channel = "QPE/Application/" + channel; | 550 | channel = "QPE/Application/" + channel; |
551 | pidChannel = new QCopChannel( channel, this ); | 551 | pidChannel = new QCopChannel( channel, this ); |
552 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 552 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
553 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 553 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
554 | 554 | ||
555 | if ( f.isOpen() ) { | 555 | if ( f.isOpen() ) { |
556 | d->keep_running = FALSE; | 556 | d->keep_running = FALSE; |
557 | QDataStream ds( &f ); | 557 | QDataStream ds( &f ); |
558 | QCString channel, message; | 558 | QCString channel, message; |
559 | QByteArray data; | 559 | QByteArray data; |
560 | while ( !ds.atEnd() ) { | 560 | while ( !ds.atEnd() ) { |
561 | ds >> channel >> message >> data; | 561 | ds >> channel >> message >> data; |
562 | d->enqueueQCop( channel, message, data ); | 562 | d->enqueueQCop( channel, message, data ); |
563 | } | 563 | } |
564 | 564 | ||
565 | flock( f.handle(), LOCK_UN ); | 565 | flock( f.handle(), LOCK_UN ); |
566 | f.close(); | 566 | f.close(); |
567 | f.remove(); | 567 | f.remove(); |
568 | } | 568 | } |
569 | 569 | ||
570 | for ( int a = 0; a < argc; a++ ) { | 570 | for ( int a = 0; a < argc; a++ ) { |
571 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 571 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
572 | argv[ a ] = argv[ a + 1 ]; | 572 | argv[ a ] = argv[ a + 1 ]; |
573 | a++; | 573 | a++; |
@@ -769,120 +769,120 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
769 | if ( popup ) | 769 | if ( popup ) |
770 | popup->close(); | 770 | popup->close(); |
771 | if ( active->inherits( "QDialog" ) ) { | 771 | if ( active->inherits( "QDialog" ) ) { |
772 | HackDialog * d = ( HackDialog * ) active; | 772 | HackDialog * d = ( HackDialog * ) active; |
773 | d->acceptIt(); | 773 | d->acceptIt(); |
774 | return TRUE; | 774 | return TRUE; |
775 | } | 775 | } |
776 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 776 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
777 | QSignal s; | 777 | QSignal s; |
778 | s.connect( active, SLOT( accept() ) ); | 778 | s.connect( active, SLOT( accept() ) ); |
779 | s.activate(); | 779 | s.activate(); |
780 | } | 780 | } |
781 | else { | 781 | else { |
782 | // do the same as with the select key: Map to the default action of the widget: | 782 | // do the same as with the select key: Map to the default action of the widget: |
783 | mapToDefaultAction( ke, Qt::Key_Return ); | 783 | mapToDefaultAction( ke, Qt::Key_Return ); |
784 | } | 784 | } |
785 | } | 785 | } |
786 | } | 786 | } |
787 | } | 787 | } |
788 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 788 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
789 | // Use special "select" key to do whatever default action a widget has | 789 | // Use special "select" key to do whatever default action a widget has |
790 | mapToDefaultAction( ke, Qt::Key_Space ); | 790 | mapToDefaultAction( ke, Qt::Key_Space ); |
791 | } | 791 | } |
792 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 792 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
793 | ke->simpleData.is_press ) { | 793 | ke->simpleData.is_press ) { |
794 | // Escape key closes app if focus on toplevel | 794 | // Escape key closes app if focus on toplevel |
795 | QWidget * active = activeWindow(); | 795 | QWidget * active = activeWindow(); |
796 | if ( active && active->testWFlags( WType_TopLevel ) && | 796 | if ( active && active->testWFlags( WType_TopLevel ) && |
797 | ( int ) active->winId() == ke->simpleData.window && | 797 | ( int ) active->winId() == ke->simpleData.window && |
798 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 798 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
799 | if ( active->inherits( "QDialog" ) ) { | 799 | if ( active->inherits( "QDialog" ) ) { |
800 | HackDialog * d = ( HackDialog * ) active; | 800 | HackDialog * d = ( HackDialog * ) active; |
801 | d->rejectIt(); | 801 | d->rejectIt(); |
802 | return TRUE; | 802 | return TRUE; |
803 | } | 803 | } |
804 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | 804 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { |
805 | active->close(); | 805 | active->close(); |
806 | } | 806 | } |
807 | } | 807 | } |
808 | } | 808 | } |
809 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 809 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
810 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 810 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
811 | // but we cannot access libopie function within libqpe :( | 811 | // but we cannot access libopie function within libqpe :( |
812 | 812 | ||
813 | QWidget * active = activeWindow ( ); | 813 | QWidget * active = activeWindow ( ); |
814 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 814 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
815 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 815 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
816 | QChar ch ( ke-> simpleData.unicode ); | 816 | QChar ch ( ke-> simpleData.unicode ); |
817 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 817 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
818 | ke-> simpleData.keycode, | 818 | ke-> simpleData.keycode, |
819 | ch. latin1 ( ), | 819 | ch. latin1 ( ), |
820 | ke-> simpleData.modifiers, | 820 | ke-> simpleData.modifiers, |
821 | QString ( ch ), | 821 | QString ( ch ), |
822 | ke-> simpleData.is_auto_repeat, 1 ); | 822 | ke-> simpleData.is_auto_repeat, 1 ); |
823 | 823 | ||
824 | QObject *which = QWidget::keyboardGrabber ( ); | 824 | QObject *which = QWidget::keyboardGrabber ( ); |
825 | if ( !which ) | 825 | if ( !which ) |
826 | which = QApplication::focusWidget ( ); | 826 | which = QApplication::focusWidget ( ); |
827 | if ( !which ) | 827 | if ( !which ) |
828 | which = QApplication::activeWindow ( ); | 828 | which = QApplication::activeWindow ( ); |
829 | if ( !which ) | 829 | if ( !which ) |
830 | which = qApp; | 830 | which = qApp; |
831 | 831 | ||
832 | QApplication::sendEvent ( which, &qke ); | 832 | QApplication::sendEvent ( which, &qke ); |
833 | } | 833 | } |
834 | else { // we didn't grab the keyboard, so send the event to the launcher | 834 | else { // we didn't grab the keyboard, so send the event to the launcher |
835 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 835 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
836 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 836 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | return true; | 839 | return true; |
840 | } | 840 | } |
841 | } | 841 | } |
842 | if ( e->type == QWSEvent::Focus ) { | 842 | if ( e->type == QWSEvent::Focus ) { |
843 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 843 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
844 | if ( !fe->simpleData.get_focus ) { | 844 | if ( !fe->simpleData.get_focus ) { |
845 | QWidget * active = activeWindow(); | 845 | QWidget * active = activeWindow(); |
846 | while ( active && active->isPopup() ) { | 846 | while ( active && active->isPopup() ) { |
847 | active->close(); | 847 | active->close(); |
848 | active = activeWindow(); | 848 | active = activeWindow(); |
849 | } | 849 | } |
850 | } | 850 | } |
851 | else { | 851 | else { |
852 | // make sure our modal widget is ALWAYS on top | 852 | // make sure our modal widget is ALWAYS on top |
853 | QWidget *topm = activeModalWidget(); | 853 | QWidget *topm = activeModalWidget(); |
854 | if ( topm ) { | 854 | if ( topm ) { |
855 | topm->raise(); | 855 | topm->raise(); |
856 | } | 856 | } |
857 | } | 857 | } |
858 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 858 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
859 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 859 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
860 | if ( m == AlwaysOff ) | 860 | if ( m == AlwaysOff ) |
861 | Global::hideInputMethod(); | 861 | Global::hideInputMethod(); |
862 | if ( m == AlwaysOn ) | 862 | if ( m == AlwaysOn ) |
863 | Global::showInputMethod(); | 863 | Global::showInputMethod(); |
864 | } | 864 | } |
865 | } | 865 | } |
866 | return QApplication::qwsEventFilter( e ); | 866 | return QApplication::qwsEventFilter( e ); |
867 | } | 867 | } |
868 | #endif | 868 | #endif |
869 | 869 | ||
870 | /*! | 870 | /*! |
871 | Destroys the QPEApplication. | 871 | Destroys the QPEApplication. |
872 | */ | 872 | */ |
873 | QPEApplication::~QPEApplication() | 873 | QPEApplication::~QPEApplication() |
874 | { | 874 | { |
875 | ungrabKeyboard(); | 875 | ungrabKeyboard(); |
876 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 876 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
877 | // Need to delete QCopChannels early, since the display will | 877 | // Need to delete QCopChannels early, since the display will |
878 | // be gone by the time we get to ~QObject(). | 878 | // be gone by the time we get to ~QObject(). |
879 | delete sysChannel; | 879 | delete sysChannel; |
880 | delete pidChannel; | 880 | delete pidChannel; |
881 | #endif | 881 | #endif |
882 | 882 | ||
883 | delete d; | 883 | delete d; |
884 | } | 884 | } |
885 | 885 | ||
886 | /*! | 886 | /*! |
887 | Returns <tt>$OPIEDIR/</tt>. | 887 | Returns <tt>$OPIEDIR/</tt>. |
888 | */ | 888 | */ |
@@ -1002,99 +1002,99 @@ void QPEApplication::applyStyle() | |||
1002 | color = config.readEntry( "Base", "#FFFFFF" ); | 1002 | color = config.readEntry( "Base", "#FFFFFF" ); |
1003 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1003 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1004 | 1004 | ||
1005 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1005 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1006 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1006 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1007 | 1007 | ||
1008 | setPalette( pal, TRUE ); | 1008 | setPalette( pal, TRUE ); |
1009 | 1009 | ||
1010 | // Window Decoration | 1010 | // Window Decoration |
1011 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 1011 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
1012 | 1012 | ||
1013 | // don't set a custom deco | 1013 | // don't set a custom deco |
1014 | if ( nostyle & Opie::Force_Decoration ) | 1014 | if ( nostyle & Opie::Force_Decoration ) |
1015 | dec = ""; | 1015 | dec = ""; |
1016 | 1016 | ||
1017 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1017 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1018 | 1018 | ||
1019 | if ( dec != d->decorationName ) { | 1019 | if ( dec != d->decorationName ) { |
1020 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1020 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1021 | d->decorationName = dec; | 1021 | d->decorationName = dec; |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | // Font | 1024 | // Font |
1025 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1025 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1026 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1026 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1027 | 1027 | ||
1028 | // don't set a custom font | 1028 | // don't set a custom font |
1029 | if ( nostyle & Opie::Force_Font ) { | 1029 | if ( nostyle & Opie::Force_Font ) { |
1030 | ff = "Helvetica"; | 1030 | ff = "Helvetica"; |
1031 | fs = 10; | 1031 | fs = 10; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | setFont ( QFont ( ff, fs ), true ); | 1034 | setFont ( QFont ( ff, fs ), true ); |
1035 | 1035 | ||
1036 | // revert to global blocking policy ... | 1036 | // revert to global blocking policy ... |
1037 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1037 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1038 | Opie::force_appearance &= ~nostyle; | 1038 | Opie::force_appearance &= ~nostyle; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1041 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1042 | { | 1042 | { |
1043 | #ifdef Q_WS_QWS | 1043 | #ifdef Q_WS_QWS |
1044 | QDataStream stream( data, IO_ReadOnly ); | 1044 | QDataStream stream( data, IO_ReadOnly ); |
1045 | if ( msg == "applyStyle()" ) { | 1045 | if ( msg == "applyStyle()" ) { |
1046 | applyStyle(); | 1046 | applyStyle(); |
1047 | } | 1047 | } |
1048 | else if ( msg == "toggleApplicationMenu()" ) { | 1048 | else if ( msg == "toggleApplicationMenu()" ) { |
1049 | QWidget *active = activeWindow ( ); | 1049 | QWidget *active = activeWindow ( ); |
1050 | 1050 | ||
1051 | if ( active ) { | 1051 | if ( active ) { |
1052 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1052 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1053 | bool oldactive = man-> isActive ( ); | 1053 | bool oldactive = man-> isActive ( ); |
1054 | 1054 | ||
1055 | man-> setActive( !man-> isActive() ); | 1055 | man-> setActive( !man-> isActive() ); |
1056 | 1056 | ||
1057 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1057 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1058 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1058 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | } | 1061 | } |
1062 | else if ( msg == "setDefaultRotation(int)" ) { | 1062 | else if ( msg == "setDefaultRotation(int)" ) { |
1063 | if ( type() == GuiServer ) { | 1063 | if ( type() == GuiServer ) { |
1064 | int r; | 1064 | int r; |
1065 | stream >> r; | 1065 | stream >> r; |
1066 | setDefaultRotation( r ); | 1066 | setDefaultRotation( r ); |
1067 | } | 1067 | } |
1068 | } | 1068 | } |
1069 | else if ( msg == "setCurrentRotation(int)" ) { | 1069 | else if ( msg == "setCurrentRotation(int)" ) { |
1070 | int r; | 1070 | int r; |
1071 | stream >> r; | 1071 | stream >> r; |
1072 | setCurrentRotation( r ); | 1072 | setCurrentRotation( r ); |
1073 | } | 1073 | } |
1074 | else if ( msg == "shutdown()" ) { | 1074 | else if ( msg == "shutdown()" ) { |
1075 | if ( type() == GuiServer ) | 1075 | if ( type() == GuiServer ) |
1076 | shutdown(); | 1076 | shutdown(); |
1077 | } | 1077 | } |
1078 | else if ( msg == "quit()" ) { | 1078 | else if ( msg == "quit()" ) { |
1079 | if ( type() != GuiServer ) | 1079 | if ( type() != GuiServer ) |
1080 | tryQuit(); | 1080 | tryQuit(); |
1081 | } | 1081 | } |
1082 | else if ( msg == "forceQuit()" ) { | 1082 | else if ( msg == "forceQuit()" ) { |
1083 | if ( type() != GuiServer ) | 1083 | if ( type() != GuiServer ) |
1084 | quit(); | 1084 | quit(); |
1085 | } | 1085 | } |
1086 | else if ( msg == "restart()" ) { | 1086 | else if ( msg == "restart()" ) { |
1087 | if ( type() == GuiServer ) | 1087 | if ( type() == GuiServer ) |
1088 | restart(); | 1088 | restart(); |
1089 | } | 1089 | } |
1090 | else if ( msg == "language(QString)" ) { | 1090 | else if ( msg == "language(QString)" ) { |
1091 | if ( type() == GuiServer ) { | 1091 | if ( type() == GuiServer ) { |
1092 | QString l; | 1092 | QString l; |
1093 | stream >> l; | 1093 | stream >> l; |
1094 | QString cl = getenv( "LANG" ); | 1094 | QString cl = getenv( "LANG" ); |
1095 | if ( cl != l ) { | 1095 | if ( cl != l ) { |
1096 | if ( l.isNull() ) | 1096 | if ( l.isNull() ) |
1097 | unsetenv( "LANG" ); | 1097 | unsetenv( "LANG" ); |
1098 | else | 1098 | else |
1099 | setenv( "LANG", l.latin1(), 1 ); | 1099 | setenv( "LANG", l.latin1(), 1 ); |
1100 | restart(); | 1100 | restart(); |