-rw-r--r-- | library/qpeapplication.cpp | 155 |
1 files changed, 108 insertions, 47 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c41dd06..852671a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -82,65 +82,65 @@ | |||
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() : presstimer( 0 ), presswidget( 0 ), kbgrabber( 0 ), | 95 | QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), kbgrabber( 0 ), |
96 | rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ), | 96 | rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ), |
97 | forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 ) | 97 | forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 ) |
98 | 98 | ||
99 | { | 99 | { |
100 | qcopq.setAutoDelete( TRUE ); | 100 | qcopq.setAutoDelete( TRUE ); |
101 | } | 101 | } |
102 | 102 | ||
103 | int presstimer; | 103 | int presstimer; |
104 | QWidget* presswidget; | 104 | QWidget* presswidget; |
105 | int kbgrabber; | 105 | int kbgrabber; |
106 | QPoint presspos; | 106 | QPoint presspos; |
107 | 107 | ||
108 | bool rightpressed : 1; | 108 | bool rightpressed : 1; |
109 | bool kbregrab : 1; | 109 | bool kbregrab : 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(); |
146 | } | 146 | } |
@@ -165,33 +165,33 @@ public: | |||
165 | // This works but disable it for now until it is safe to apply | 165 | // This works but disable it for now until it is safe to apply |
166 | // What is does is scan the .desktop files of all the apps for | 166 | // What is does is scan the .desktop files of all the apps for |
167 | // the applnk that has the corresponding argv[0] as this program | 167 | // the applnk that has the corresponding argv[0] as this program |
168 | // then it uses the name stored in the .desktop file as the caption | 168 | // then it uses the name stored in the .desktop file as the caption |
169 | // for the main widget. This saves duplicating translations for | 169 | // for the main widget. This saves duplicating translations for |
170 | // the app name in the program and in the .desktop files. | 170 | // the app name in the program and in the .desktop files. |
171 | 171 | ||
172 | AppLnkSet apps( appsPath ); | 172 | AppLnkSet apps( appsPath ); |
173 | 173 | ||
174 | QList<AppLnk> appsList = apps.children(); | 174 | QList<AppLnk> appsList = apps.children(); |
175 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { | 175 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { |
176 | if ( (*it)->exec() == appName ) { | 176 | if ( (*it)->exec() == appName ) { |
177 | mw->setCaption( (*it)->name() ); | 177 | mw->setCaption( (*it)->name() ); |
178 | return TRUE; | 178 | return TRUE; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | */ | 181 | */ |
182 | return FALSE; | 182 | return FALSE; |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | void show(QWidget* mw, bool nomax) | 186 | void show(QWidget* mw, bool nomax) |
187 | { | 187 | { |
188 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); | 188 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); |
189 | nomaximize = nomax; | 189 | nomaximize = nomax; |
190 | qpe_main_widget = mw; | 190 | qpe_main_widget = mw; |
191 | #ifndef QT_NO_COP | 191 | #ifndef QT_NO_COP |
192 | 192 | ||
193 | sendQCopQ(); | 193 | sendQCopQ(); |
194 | #endif | 194 | #endif |
195 | 195 | ||
196 | if ( preloaded ) { | 196 | if ( preloaded ) { |
197 | if (forceshow) | 197 | if (forceshow) |
@@ -317,159 +317,201 @@ static void setMic( int t = 0, int percent = -1 ) | |||
317 | cfg.setGroup( "Volume" ); | 317 | cfg.setGroup( "Volume" ); |
318 | if ( percent < 0 ) | 318 | if ( percent < 0 ) |
319 | percent = cfg.readNumEntry( "Mic", 50 ); | 319 | percent = cfg.readNumEntry( "Mic", 50 ); |
320 | 320 | ||
321 | int fd = 0; | 321 | int fd = 0; |
322 | int mic = micMuted ? 0 : percent; | 322 | int mic = micMuted ? 0 : percent; |
323 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 323 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
324 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 324 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
325 | ::close( fd ); | 325 | ::close( fd ); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | break; | 328 | break; |
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | 332 | ||
333 | static void setBass( int t = 0, int percent = -1 ) | ||
334 | { | ||
335 | switch ( t ) { | ||
336 | case 0: { | ||
337 | Config cfg( "qpe" ); | ||
338 | cfg.setGroup( "Volume" ); | ||
339 | if ( percent < 0 ) | ||
340 | percent = cfg.readNumEntry( "BassPercent", 50 ); | ||
341 | |||
342 | int fd = 0; | ||
343 | int bass = percent; | ||
344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | ||
345 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | ||
346 | ::close( fd ); | ||
347 | } | ||
348 | } | ||
349 | break; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | |||
354 | static void setTreble( int t = 0, int percent = -1 ) | ||
355 | { | ||
356 | switch ( t ) { | ||
357 | case 0: { | ||
358 | Config cfg( "qpe" ); | ||
359 | cfg.setGroup( "Volume" ); | ||
360 | if ( percent < 0 ) | ||
361 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | ||
362 | |||
363 | int fd = 0; | ||
364 | int treble = percent; | ||
365 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | ||
366 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | ||
367 | ::close( fd ); | ||
368 | } | ||
369 | } | ||
370 | break; | ||
371 | } | ||
372 | } | ||
373 | |||
374 | |||
333 | /*! | 375 | /*! |
334 | \class QPEApplication qpeapplication.h | 376 | \class QPEApplication qpeapplication.h |
335 | \brief The QPEApplication class implements various system services | 377 | \brief The QPEApplication class implements various system services |
336 | that are available to all Qtopia applications. | 378 | that are available to all Qtopia applications. |
337 | 379 | ||
338 | Simply by using QPEApplication instead of QApplication, a standard Qt | 380 | Simply by using QPEApplication instead of QApplication, a standard Qt |
339 | application becomes a Qtopia application. It automatically follows | 381 | application becomes a Qtopia application. It automatically follows |
340 | style changes, quits and raises, and in the | 382 | style changes, quits and raises, and in the |
341 | case of \link docwidget.html document-oriented\endlink applications, | 383 | case of \link docwidget.html document-oriented\endlink applications, |
342 | changes the currently displayed document in response to the environment. | 384 | changes the currently displayed document in response to the environment. |
343 | 385 | ||
344 | To create a \link docwidget.html document-oriented\endlink | 386 | To create a \link docwidget.html document-oriented\endlink |
345 | application use showMainDocumentWidget(); to create a | 387 | application use showMainDocumentWidget(); to create a |
346 | non-document-oriented application use showMainWidget(). The | 388 | non-document-oriented application use showMainWidget(). The |
347 | keepRunning() function indicates whether the application will | 389 | keepRunning() function indicates whether the application will |
348 | continue running after it's processed the last \link qcop.html | 390 | continue running after it's processed the last \link qcop.html |
349 | QCop\endlink message. This can be changed using setKeepRunning(). | 391 | QCop\endlink message. This can be changed using setKeepRunning(). |
350 | 392 | ||
351 | A variety of signals are emitted when certain events occur, for | 393 | A variety of signals are emitted when certain events occur, for |
352 | example, timeChanged(), clockChanged(), weekChanged(), | 394 | example, timeChanged(), clockChanged(), weekChanged(), |
353 | dateFormatChanged() and volumeChanged(). If the application receives | 395 | dateFormatChanged() and volumeChanged(). If the application receives |
354 | a \link qcop.html QCop\endlink message on the application's | 396 | a \link qcop.html QCop\endlink message on the application's |
355 | QPE/Application/\e{appname} channel, the appMessage() signal is | 397 | QPE/Application/\e{appname} channel, the appMessage() signal is |
356 | emitted. There are also flush() and reload() signals, which | 398 | emitted. There are also flush() and reload() signals, which |
357 | are emitted when synching begins and ends respectively - upon these | 399 | are emitted when synching begins and ends respectively - upon these |
358 | signals, the application should save and reload any data | 400 | signals, the application should save and reload any data |
359 | files that are involved in synching. Most of these signals will initially | 401 | files that are involved in synching. Most of these signals will initially |
360 | be received and unfiltered through the appMessage() signal. | 402 | be received and unfiltered through the appMessage() signal. |
361 | 403 | ||
362 | This class also provides a set of useful static functions. The | 404 | This class also provides a set of useful static functions. The |
363 | qpeDir() and documentDir() functions return the respective paths. | 405 | qpeDir() and documentDir() functions return the respective paths. |
364 | The grabKeyboard() and ungrabKeyboard() functions are used to | 406 | The grabKeyboard() and ungrabKeyboard() functions are used to |
365 | control whether the application takes control of the device's | 407 | control whether the application takes control of the device's |
366 | physical buttons (e.g. application launch keys). The stylus' mode of | 408 | physical buttons (e.g. application launch keys). The stylus' mode of |
367 | operation is set with setStylusOperation() and retrieved with | 409 | operation is set with setStylusOperation() and retrieved with |
368 | stylusOperation(). There are also setInputMethodHint() and | 410 | stylusOperation(). There are also setInputMethodHint() and |
369 | inputMethodHint() functions. | 411 | inputMethodHint() functions. |
370 | 412 | ||
371 | \ingroup qtopiaemb | 413 | \ingroup qtopiaemb |
372 | */ | 414 | */ |
373 | 415 | ||
374 | /*! | 416 | /*! |
375 | \fn void QPEApplication::clientMoused() | 417 | \fn void QPEApplication::clientMoused() |
376 | 418 | ||
377 | \internal | 419 | \internal |
378 | */ | 420 | */ |
379 | 421 | ||
380 | /*! | 422 | /*! |
381 | \fn void QPEApplication::timeChanged(); | 423 | \fn void QPEApplication::timeChanged(); |
382 | This signal is emitted when the time changes outside the normal | 424 | This signal is emitted when the time changes outside the normal |
383 | passage of time, i.e. if the time is set backwards or forwards. | 425 | passage of time, i.e. if the time is set backwards or forwards. |
384 | */ | 426 | */ |
385 | 427 | ||
386 | /*! | 428 | /*! |
387 | \fn void QPEApplication::clockChanged( bool ampm ); | 429 | \fn void QPEApplication::clockChanged( bool ampm ); |
388 | 430 | ||
389 | This signal is emitted when the user changes the clock's style. If | 431 | This signal is emitted when the user changes the clock's style. If |
390 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 432 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
391 | they want a 24-hour clock. | 433 | they want a 24-hour clock. |
392 | */ | 434 | */ |
393 | 435 | ||
394 | /*! | 436 | /*! |
395 | \fn void QPEApplication::volumeChanged( bool muted ) | 437 | \fn void QPEApplication::volumeChanged( bool muted ) |
396 | 438 | ||
397 | This signal is emitted whenever the mute state is changed. If \a | 439 | This signal is emitted whenever the mute state is changed. If \a |
398 | muted is TRUE, then sound output has been muted. | 440 | muted is TRUE, then sound output has been muted. |
399 | */ | 441 | */ |
400 | 442 | ||
401 | /*! | 443 | /*! |
402 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 444 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
403 | 445 | ||
404 | This signal is emitted if the week start day is changed. If \a | 446 | This signal is emitted if the week start day is changed. If \a |
405 | startOnMonday is TRUE then the first day of the week is Monday; if | 447 | startOnMonday is TRUE then the first day of the week is Monday; if |
406 | \a startOnMonday is FALSE then the first day of the week is | 448 | \a startOnMonday is FALSE then the first day of the week is |
407 | Sunday. | 449 | Sunday. |
408 | */ | 450 | */ |
409 | 451 | ||
410 | /*! | 452 | /*! |
411 | \fn void QPEApplication::dateFormatChanged() | 453 | \fn void QPEApplication::dateFormatChanged() |
412 | 454 | ||
413 | This signal is emitted whenever the date format is changed. | 455 | This signal is emitted whenever the date format is changed. |
414 | */ | 456 | */ |
415 | 457 | ||
416 | /*! | 458 | /*! |
417 | \fn void QPEApplication::flush() | 459 | \fn void QPEApplication::flush() |
418 | 460 | ||
419 | ### | 461 | ### |
420 | */ | 462 | */ |
421 | 463 | ||
422 | /*! | 464 | /*! |
423 | \fn void QPEApplication::reload() | 465 | \fn void QPEApplication::reload() |
424 | 466 | ||
425 | */ | 467 | */ |
426 | 468 | ||
427 | /*! | 469 | /*! |
428 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 470 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
429 | 471 | ||
430 | This signal is emitted when a message is received on this | 472 | This signal is emitted when a message is received on this |
431 | application's QPE/Application/<i>appname</i> \link qcop.html | 473 | application's QPE/Application/<i>appname</i> \link qcop.html |
432 | QCop\endlink channel. | 474 | QCop\endlink channel. |
433 | 475 | ||
434 | 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 |
435 | in the following way: | 477 | in the following way: |
436 | 478 | ||
437 | \code | 479 | \code |
438 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
439 | { | 481 | { |
440 | QDataStream stream( data, IO_ReadOnly ); | 482 | QDataStream stream( data, IO_ReadOnly ); |
441 | if ( msg == "someMessage(int,int,int)" ) { | 483 | if ( msg == "someMessage(int,int,int)" ) { |
442 | int a,b,c; | 484 | int a,b,c; |
443 | stream >> a >> b >> c; | 485 | stream >> a >> b >> c; |
444 | ... | 486 | ... |
445 | } else if ( msg == "otherMessage(QString)" ) { | 487 | } else if ( msg == "otherMessage(QString)" ) { |
446 | ... | 488 | ... |
447 | } | 489 | } |
448 | } | 490 | } |
449 | \endcode | 491 | \endcode |
450 | 492 | ||
451 | \sa qcop.html | 493 | \sa qcop.html |
452 | Note that messages received here may be processed by qpe application | 494 | Note that messages received here may be processed by qpe application |
453 | and emitted as signals, such as flush() and reload(). | 495 | and emitted as signals, such as flush() and reload(). |
454 | */ | 496 | */ |
455 | 497 | ||
456 | /*! | 498 | /*! |
457 | Constructs a QPEApplication just as you would construct | 499 | Constructs a QPEApplication just as you would construct |
458 | a QApplication, passing \a argc, \a argv, and \a t. | 500 | a QApplication, passing \a argc, \a argv, and \a t. |
459 | 501 | ||
460 | For applications, \a t should be the default, GuiClient. Only | 502 | For applications, \a t should be the default, GuiClient. Only |
461 | the Qtopia server passes GuiServer. | 503 | the Qtopia server passes GuiServer. |
462 | */ | 504 | */ |
463 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 505 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
464 | : QApplication( argc, argv, t ) | 506 | : QApplication( argc, argv, t ) |
465 | { | 507 | { |
466 | d = new QPEApplicationData; | 508 | d = new QPEApplicationData; |
467 | d->loadTextCodecs(); | 509 | d->loadTextCodecs(); |
468 | d->loadImageCodecs(); | 510 | d->loadImageCodecs(); |
469 | int dw = desktop() ->width(); | 511 | int dw = desktop() ->width(); |
470 | qWarning( "Width %d", dw ); | 512 | qWarning( "Width %d", dw ); |
471 | if ( dw < 200 ) { | 513 | if ( dw < 200 ) { |
472 | setFont( QFont( "helvetica", 8 ) ); | 514 | setFont( QFont( "helvetica", 8 ) ); |
473 | AppLnk::setSmallIconSize( 10 ); | 515 | AppLnk::setSmallIconSize( 10 ); |
474 | AppLnk::setBigIconSize( 28 ); | 516 | AppLnk::setBigIconSize( 28 ); |
475 | } | 517 | } |
@@ -596,55 +638,55 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | |||
596 | #ifdef QT_NO_QWS_CURSOR | 638 | #ifdef QT_NO_QWS_CURSOR |
597 | // if we have no cursor, probably don't want tooltips | 639 | // if we have no cursor, probably don't want tooltips |
598 | QToolTip::setEnabled( FALSE ); | 640 | QToolTip::setEnabled( FALSE ); |
599 | #endif | 641 | #endif |
600 | } | 642 | } |
601 | 643 | ||
602 | static QPtrDict<void>* inputMethodDict = 0; | 644 | static QPtrDict<void>* inputMethodDict = 0; |
603 | static void createInputMethodDict() | 645 | static void createInputMethodDict() |
604 | { | 646 | { |
605 | if ( !inputMethodDict ) | 647 | if ( !inputMethodDict ) |
606 | inputMethodDict = new QPtrDict<void>; | 648 | inputMethodDict = new QPtrDict<void>; |
607 | } | 649 | } |
608 | 650 | ||
609 | /*! | 651 | /*! |
610 | Returns the currently set hint to the system as to whether | 652 | Returns the currently set hint to the system as to whether |
611 | widget \a w has any use for text input methods. | 653 | widget \a w has any use for text input methods. |
612 | 654 | ||
613 | 655 | ||
614 | \sa setInputMethodHint() InputMethodHint | 656 | \sa setInputMethodHint() InputMethodHint |
615 | */ | 657 | */ |
616 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 658 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
617 | { | 659 | { |
618 | if ( inputMethodDict && w ) | 660 | if ( inputMethodDict && w ) |
619 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 661 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
620 | return Normal; | 662 | return Normal; |
621 | } | 663 | } |
622 | 664 | ||
623 | /*! | 665 | /*! |
624 | \enum QPEApplication::InputMethodHint | 666 | \enum QPEApplication::InputMethodHint |
625 | 667 | ||
626 | \value Normal the application sometimes needs text input (the default). | 668 | \value Normal the application sometimes needs text input (the default). |
627 | \value AlwaysOff the application never needs text input. | 669 | \value AlwaysOff the application never needs text input. |
628 | \value AlwaysOn the application always needs text input. | 670 | \value AlwaysOn the application always needs text input. |
629 | */ | 671 | */ |
630 | 672 | ||
631 | /*! | 673 | /*! |
632 | Hints to the system that widget \a w has use for text input methods | 674 | Hints to the system that widget \a w has use for text input methods |
633 | as specified by \a mode. | 675 | as specified by \a mode. |
634 | 676 | ||
635 | \sa inputMethodHint() InputMethodHint | 677 | \sa inputMethodHint() InputMethodHint |
636 | */ | 678 | */ |
637 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 679 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
638 | { | 680 | { |
639 | createInputMethodDict(); | 681 | createInputMethodDict(); |
640 | if ( mode == Normal ) { | 682 | if ( mode == Normal ) { |
641 | inputMethodDict->remove | 683 | inputMethodDict->remove |
642 | ( w ); | 684 | ( w ); |
643 | } | 685 | } |
644 | else { | 686 | else { |
645 | inputMethodDict->insert( w, ( void* ) mode ); | 687 | inputMethodDict->insert( w, ( void* ) mode ); |
646 | } | 688 | } |
647 | } | 689 | } |
648 | 690 | ||
649 | class HackDialog : public QDialog | 691 | class HackDialog : public QDialog |
650 | { | 692 | { |
@@ -895,102 +937,102 @@ void QPEApplication::setDefaultRotation( int r ) | |||
895 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 937 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
896 | e << r; | 938 | e << r; |
897 | } | 939 | } |
898 | #endif | 940 | #endif |
899 | 941 | ||
900 | } | 942 | } |
901 | } | 943 | } |
902 | 944 | ||
903 | 945 | ||
904 | /*! | 946 | /*! |
905 | \internal | 947 | \internal |
906 | */ | 948 | */ |
907 | void QPEApplication::applyStyle() | 949 | void QPEApplication::applyStyle() |
908 | { | 950 | { |
909 | Config config( "qpe" ); | 951 | Config config( "qpe" ); |
910 | config.setGroup( "Appearance" ); | 952 | config.setGroup( "Appearance" ); |
911 | 953 | ||
912 | // don't block ourselves ... | 954 | // don't block ourselves ... |
913 | Opie::force_appearance = 0; | 955 | Opie::force_appearance = 0; |
914 | 956 | ||
915 | static QString appname = Opie::binaryName ( ); | 957 | static QString appname = Opie::binaryName ( ); |
916 | 958 | ||
917 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 959 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
918 | int nostyle = 0; | 960 | int nostyle = 0; |
919 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 961 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
920 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 962 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
921 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 963 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
922 | break; | 964 | break; |
923 | } | 965 | } |
924 | } | 966 | } |
925 | 967 | ||
926 | // Widget style | 968 | // Widget style |
927 | QString style = config.readEntry( "Style", "Light" ); | 969 | QString style = config.readEntry( "Style", "Light" ); |
928 | 970 | ||
929 | // don't set a custom style | 971 | // don't set a custom style |
930 | if ( nostyle & Opie::Force_Style ) | 972 | if ( nostyle & Opie::Force_Style ) |
931 | style = "Light"; | 973 | style = "Light"; |
932 | 974 | ||
933 | internalSetStyle ( style ); | 975 | internalSetStyle ( style ); |
934 | 976 | ||
935 | // Colors | 977 | // Colors |
936 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 978 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); |
937 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 979 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); |
938 | QPalette pal( btncolor, bgcolor ); | 980 | QPalette pal( btncolor, bgcolor ); |
939 | QString color = config.readEntry( "Highlight", "#800000" ); | 981 | QString color = config.readEntry( "Highlight", "#800000" ); |
940 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 982 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
941 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 983 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
942 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 984 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
943 | color = config.readEntry( "Text", "#000000" ); | 985 | color = config.readEntry( "Text", "#000000" ); |
944 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 986 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
945 | color = config.readEntry( "ButtonText", "#000000" ); | 987 | color = config.readEntry( "ButtonText", "#000000" ); |
946 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 988 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
947 | color = config.readEntry( "Base", "#FFFFFF" ); | 989 | color = config.readEntry( "Base", "#FFFFFF" ); |
948 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 990 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
949 | 991 | ||
950 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 992 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
951 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 993 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
952 | 994 | ||
953 | setPalette( pal, TRUE ); | 995 | setPalette( pal, TRUE ); |
954 | 996 | ||
955 | // Window Decoration | 997 | // Window Decoration |
956 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 998 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
957 | 999 | ||
958 | // don't set a custom deco | 1000 | // don't set a custom deco |
959 | if ( nostyle & Opie::Force_Decoration ) | 1001 | if ( nostyle & Opie::Force_Decoration ) |
960 | dec = ""; | 1002 | dec = ""; |
961 | 1003 | ||
962 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1004 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
963 | 1005 | ||
964 | if ( dec != d->decorationName ) { | 1006 | if ( dec != d->decorationName ) { |
965 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1007 | qwsSetDecoration( new QPEDecoration( dec ) ); |
966 | d->decorationName = dec; | 1008 | d->decorationName = dec; |
967 | } | 1009 | } |
968 | 1010 | ||
969 | // Font | 1011 | // Font |
970 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1012 | QString ff = config.readEntry( "FontFamily", font().family() ); |
971 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1013 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
972 | 1014 | ||
973 | // don't set a custom font | 1015 | // don't set a custom font |
974 | if ( nostyle & Opie::Force_Font ) { | 1016 | if ( nostyle & Opie::Force_Font ) { |
975 | ff = "Helvetica"; | 1017 | ff = "Helvetica"; |
976 | fs = 10; | 1018 | fs = 10; |
977 | } | 1019 | } |
978 | 1020 | ||
979 | setFont ( QFont ( ff, fs ), true ); | 1021 | setFont ( QFont ( ff, fs ), true ); |
980 | 1022 | ||
981 | // revert to global blocking policy ... | 1023 | // revert to global blocking policy ... |
982 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1024 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
983 | Opie::force_appearance &= ~nostyle; | 1025 | Opie::force_appearance &= ~nostyle; |
984 | } | 1026 | } |
985 | 1027 | ||
986 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1028 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
987 | { | 1029 | { |
988 | #ifdef Q_WS_QWS | 1030 | #ifdef Q_WS_QWS |
989 | QDataStream stream( data, IO_ReadOnly ); | 1031 | QDataStream stream( data, IO_ReadOnly ); |
990 | if ( msg == "applyStyle()" ) { | 1032 | if ( msg == "applyStyle()" ) { |
991 | applyStyle(); | 1033 | applyStyle(); |
992 | } | 1034 | } |
993 | else if ( msg == "setDefaultRotation(int)" ) { | 1035 | else if ( msg == "setDefaultRotation(int)" ) { |
994 | if ( type() == GuiServer ) { | 1036 | if ( type() == GuiServer ) { |
995 | int r; | 1037 | int r; |
996 | stream >> r; | 1038 | stream >> r; |
@@ -1103,32 +1145,51 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data | |||
1103 | else if ( msg == "volumeChange(bool)" ) { | 1145 | else if ( msg == "volumeChange(bool)" ) { |
1104 | stream >> muted; | 1146 | stream >> muted; |
1105 | setVolume(); | 1147 | setVolume(); |
1106 | emit volumeChanged( muted ); | 1148 | emit volumeChanged( muted ); |
1107 | } | 1149 | } |
1108 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1150 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1109 | int t, v; | 1151 | int t, v; |
1110 | stream >> t >> v; | 1152 | stream >> t >> v; |
1111 | setMic( t, v ); | 1153 | setMic( t, v ); |
1112 | emit micChanged( micMuted ); | 1154 | emit micChanged( micMuted ); |
1113 | } | 1155 | } |
1114 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1156 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1115 | stream >> micMuted; | 1157 | stream >> micMuted; |
1116 | setMic(); | 1158 | setMic(); |
1117 | emit micChanged( micMuted ); | 1159 | emit micChanged( micMuted ); |
1118 | } | 1160 | } |
1161 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1162 | int t, v; | ||
1163 | stream >> t >> v; | ||
1164 | setBass( t, v ); | ||
1165 | } | ||
1166 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1167 | setBass(); | ||
1168 | } | ||
1169 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1170 | int t, v; | ||
1171 | stream >> t >> v; | ||
1172 | setTreble( t, v ); | ||
1173 | } | ||
1174 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1175 | setTreble(); | ||
1176 | } | ||
1177 | |||
1178 | |||
1179 | |||
1119 | #endif | 1180 | #endif |
1120 | } | 1181 | } |
1121 | 1182 | ||
1122 | /*! | 1183 | /*! |
1123 | \internal | 1184 | \internal |
1124 | */ | 1185 | */ |
1125 | bool QPEApplication::raiseAppropriateWindow() | 1186 | bool QPEApplication::raiseAppropriateWindow() |
1126 | { | 1187 | { |
1127 | bool r = FALSE; | 1188 | bool r = FALSE; |
1128 | // ########## raise()ing main window should raise and set active | 1189 | // ########## raise()ing main window should raise and set active |
1129 | // ########## it and then all childen. This belongs in Qt/Embedded | 1190 | // ########## it and then all childen. This belongs in Qt/Embedded |
1130 | QWidget *top = d->qpe_main_widget; | 1191 | QWidget *top = d->qpe_main_widget; |
1131 | if ( !top ) | 1192 | if ( !top ) |
1132 | top = mainWidget(); | 1193 | top = mainWidget(); |
1133 | if ( top && d->keep_running ) { | 1194 | if ( top && d->keep_running ) { |
1134 | if ( top->isVisible() ) | 1195 | if ( top->isVisible() ) |
@@ -1216,82 +1277,82 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | |||
1216 | /* | 1277 | /* |
1217 | if ( raiseAppropriateWindow() ) | 1278 | if ( raiseAppropriateWindow() ) |
1218 | */ | 1279 | */ |
1219 | emit appMessage( msg, data); | 1280 | emit appMessage( msg, data); |
1220 | } | 1281 | } |
1221 | else { | 1282 | else { |
1222 | emit appMessage( msg, data); | 1283 | emit appMessage( msg, data); |
1223 | } | 1284 | } |
1224 | 1285 | ||
1225 | #endif | 1286 | #endif |
1226 | } | 1287 | } |
1227 | 1288 | ||
1228 | 1289 | ||
1229 | /*! | 1290 | /*! |
1230 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1291 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1231 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1292 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1232 | 1293 | ||
1233 | \sa showMainDocumentWidget() | 1294 | \sa showMainDocumentWidget() |
1234 | */ | 1295 | */ |
1235 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1296 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1236 | { | 1297 | { |
1237 | d->show(mw, nomaximize ); | 1298 | d->show(mw, nomaximize ); |
1238 | } | 1299 | } |
1239 | 1300 | ||
1240 | /*! | 1301 | /*! |
1241 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1302 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1242 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1303 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1243 | 1304 | ||
1244 | This calls designates the application as | 1305 | This calls designates the application as |
1245 | a \link docwidget.html document-oriented\endlink application. | 1306 | a \link docwidget.html document-oriented\endlink application. |
1246 | 1307 | ||
1247 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1308 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1248 | 1309 | ||
1249 | \sa showMainWidget() | 1310 | \sa showMainWidget() |
1250 | */ | 1311 | */ |
1251 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1312 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1252 | { | 1313 | { |
1253 | if ( mw && argc() == 2 ) | 1314 | if ( mw && argc() == 2 ) |
1254 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1315 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1255 | 1316 | ||
1256 | d->show(mw, nomaximize ); | 1317 | d->show(mw, nomaximize ); |
1257 | } | 1318 | } |
1258 | 1319 | ||
1259 | 1320 | ||
1260 | /*! | 1321 | /*! |
1261 | If an application is started via a \link qcop.html QCop\endlink | 1322 | If an application is started via a \link qcop.html QCop\endlink |
1262 | message, the application will process the \link qcop.html | 1323 | message, the application will process the \link qcop.html |
1263 | QCop\endlink message and then quit. If the application calls this | 1324 | QCop\endlink message and then quit. If the application calls this |
1264 | function while processing a \link qcop.html QCop\endlink message, | 1325 | function while processing a \link qcop.html QCop\endlink message, |
1265 | after processing its outstanding \link qcop.html QCop\endlink | 1326 | after processing its outstanding \link qcop.html QCop\endlink |
1266 | messages the application will start 'properly' and show itself. | 1327 | messages the application will start 'properly' and show itself. |
1267 | 1328 | ||
1268 | \sa keepRunning() | 1329 | \sa keepRunning() |
1269 | */ | 1330 | */ |
1270 | void QPEApplication::setKeepRunning() | 1331 | void QPEApplication::setKeepRunning() |
1271 | { | 1332 | { |
1272 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1333 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1273 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1334 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1274 | qpeApp->d->keep_running = TRUE; | 1335 | qpeApp->d->keep_running = TRUE; |
1275 | } | 1336 | } |
1276 | } | 1337 | } |
1277 | 1338 | ||
1278 | /*! | 1339 | /*! |
1279 | Returns TRUE if the application will quit after processing the | 1340 | Returns TRUE if the application will quit after processing the |
1280 | current list of qcop messages; otherwise returns FALSE. | 1341 | current list of qcop messages; otherwise returns FALSE. |
1281 | 1342 | ||
1282 | \sa setKeepRunning() | 1343 | \sa setKeepRunning() |
1283 | */ | 1344 | */ |
1284 | bool QPEApplication::keepRunning() const | 1345 | bool QPEApplication::keepRunning() const |
1285 | { | 1346 | { |
1286 | return d->keep_running; | 1347 | return d->keep_running; |
1287 | } | 1348 | } |
1288 | 1349 | ||
1289 | /*! | 1350 | /*! |
1290 | \internal | 1351 | \internal |
1291 | */ | 1352 | */ |
1292 | void QPEApplication::internalSetStyle( const QString &style ) | 1353 | void QPEApplication::internalSetStyle( const QString &style ) |
1293 | { | 1354 | { |
1294 | #if QT_VERSION >= 300 | 1355 | #if QT_VERSION >= 300 |
1295 | if ( style == "QPE" ) { | 1356 | if ( style == "QPE" ) { |
1296 | setStyle( new QPEStyle ); | 1357 | setStyle( new QPEStyle ); |
1297 | } | 1358 | } |
@@ -1406,57 +1467,57 @@ void QPEApplication::shutdown() | |||
1406 | \internal | 1467 | \internal |
1407 | */ | 1468 | */ |
1408 | void QPEApplication::restart() | 1469 | void QPEApplication::restart() |
1409 | { | 1470 | { |
1410 | // Implement in server's QPEApplication subclass | 1471 | // Implement in server's QPEApplication subclass |
1411 | } | 1472 | } |
1412 | 1473 | ||
1413 | static QPtrDict<void>* stylusDict = 0; | 1474 | static QPtrDict<void>* stylusDict = 0; |
1414 | static void createDict() | 1475 | static void createDict() |
1415 | { | 1476 | { |
1416 | if ( !stylusDict ) | 1477 | if ( !stylusDict ) |
1417 | stylusDict = new QPtrDict<void>; | 1478 | stylusDict = new QPtrDict<void>; |
1418 | } | 1479 | } |
1419 | 1480 | ||
1420 | /*! | 1481 | /*! |
1421 | Returns the current StylusMode for widget \a w. | 1482 | Returns the current StylusMode for widget \a w. |
1422 | 1483 | ||
1423 | \sa setStylusOperation() StylusMode | 1484 | \sa setStylusOperation() StylusMode |
1424 | */ | 1485 | */ |
1425 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1486 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1426 | { | 1487 | { |
1427 | if ( stylusDict ) | 1488 | if ( stylusDict ) |
1428 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1489 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
1429 | return LeftOnly; | 1490 | return LeftOnly; |
1430 | } | 1491 | } |
1431 | 1492 | ||
1432 | /*! | 1493 | /*! |
1433 | \enum QPEApplication::StylusMode | 1494 | \enum QPEApplication::StylusMode |
1434 | 1495 | ||
1435 | \value LeftOnly the stylus only generates LeftButton | 1496 | \value LeftOnly the stylus only generates LeftButton |
1436 | events (the default). | 1497 | events (the default). |
1437 | \value RightOnHold the stylus generates RightButton events | 1498 | \value RightOnHold the stylus generates RightButton events |
1438 | if the user uses the press-and-hold gesture. | 1499 | if the user uses the press-and-hold gesture. |
1439 | 1500 | ||
1440 | \sa setStylusOperation() stylusOperation() | 1501 | \sa setStylusOperation() stylusOperation() |
1441 | */ | 1502 | */ |
1442 | 1503 | ||
1443 | /*! | 1504 | /*! |
1444 | Causes widget \a w to receive mouse events according to the stylus | 1505 | Causes widget \a w to receive mouse events according to the stylus |
1445 | \a mode. | 1506 | \a mode. |
1446 | 1507 | ||
1447 | \sa stylusOperation() StylusMode | 1508 | \sa stylusOperation() StylusMode |
1448 | */ | 1509 | */ |
1449 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) | 1510 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) |
1450 | { | 1511 | { |
1451 | createDict(); | 1512 | createDict(); |
1452 | if ( mode == LeftOnly ) { | 1513 | if ( mode == LeftOnly ) { |
1453 | stylusDict->remove | 1514 | stylusDict->remove |
1454 | ( w ); | 1515 | ( w ); |
1455 | w->removeEventFilter( qApp ); | 1516 | w->removeEventFilter( qApp ); |
1456 | } | 1517 | } |
1457 | else { | 1518 | else { |
1458 | stylusDict->insert( w, ( void* ) mode ); | 1519 | stylusDict->insert( w, ( void* ) mode ); |
1459 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 1520 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
1460 | w->installEventFilter( qApp ); | 1521 | w->installEventFilter( qApp ); |
1461 | } | 1522 | } |
1462 | } | 1523 | } |
@@ -1575,33 +1636,33 @@ void QPEApplication::ungrabKeyboard() | |||
1575 | #ifndef QT_NO_COP | 1636 | #ifndef QT_NO_COP |
1576 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); | 1637 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); |
1577 | e << QString::null; | 1638 | e << QString::null; |
1578 | #endif | 1639 | #endif |
1579 | 1640 | ||
1580 | d->kbregrab = FALSE; | 1641 | d->kbregrab = FALSE; |
1581 | d->kbgrabber = 0; | 1642 | d->kbgrabber = 0; |
1582 | } | 1643 | } |
1583 | } | 1644 | } |
1584 | 1645 | ||
1585 | /*! | 1646 | /*! |
1586 | Grabs the physical keyboard keys, e.g. the application's launching | 1647 | Grabs the physical keyboard keys, e.g. the application's launching |
1587 | keys. Instead of launching applications when these keys are pressed | 1648 | keys. Instead of launching applications when these keys are pressed |
1588 | the signals emitted are sent to this application instead. Some games | 1649 | the signals emitted are sent to this application instead. Some games |
1589 | programs take over the launch keys in this way to make interaction | 1650 | programs take over the launch keys in this way to make interaction |
1590 | easier. | 1651 | easier. |
1591 | 1652 | ||
1592 | \sa ungrabKeyboard() | 1653 | \sa ungrabKeyboard() |
1593 | */ | 1654 | */ |
1594 | void QPEApplication::grabKeyboard() | 1655 | void QPEApplication::grabKeyboard() |
1595 | { | 1656 | { |
1596 | QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d; | 1657 | QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d; |
1597 | if ( qApp->type() == QApplication::GuiServer ) | 1658 | if ( qApp->type() == QApplication::GuiServer ) |
1598 | d->kbgrabber = 0; | 1659 | d->kbgrabber = 0; |
1599 | else { | 1660 | else { |
1600 | #ifndef QT_NO_COP | 1661 | #ifndef QT_NO_COP |
1601 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); | 1662 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); |
1602 | e << d->appName; | 1663 | e << d->appName; |
1603 | #endif | 1664 | #endif |
1604 | 1665 | ||
1605 | d->kbgrabber = 2; // me | 1666 | d->kbgrabber = 2; // me |
1606 | } | 1667 | } |
1607 | } | 1668 | } |