-rw-r--r-- | library/library.pro | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 10 | ||||
-rw-r--r-- | library/qt_override.cpp | 40 |
3 files changed, 37 insertions, 19 deletions
diff --git a/library/library.pro b/library/library.pro index 80a0f62..ab1f451 100644 --- a/library/library.pro +++ b/library/library.pro | |||
@@ -1,151 +1,157 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | #CONFIG += qt warn_on release | 2 | #CONFIG += qt warn_on release |
3 | CONFIG += qt warn_on debug | 3 | CONFIG += qt warn_on debug |
4 | HEADERS= calendar.h \ | 4 | HEADERS= calendar.h \ |
5 | global.h \ | 5 | global.h \ |
6 | resource.h \ | 6 | resource.h \ |
7 | xmlreader.h \ | 7 | xmlreader.h \ |
8 | mimetype.h \ | 8 | mimetype.h \ |
9 | menubutton.h \ | 9 | menubutton.h \ |
10 | network.h \ | 10 | network.h \ |
11 | networkinterface.h \ | 11 | networkinterface.h \ |
12 | filemanager.h \ | 12 | filemanager.h \ |
13 | fontmanager.h \ | 13 | fontmanager.h \ |
14 | qdawg.h \ | 14 | qdawg.h \ |
15 | datebookmonth.h \ | 15 | datebookmonth.h \ |
16 | fileselector.h \ | 16 | fileselector.h \ |
17 | fileselector_p.h \ | 17 | fileselector_p.h \ |
18 | imageedit.h \ | 18 | imageedit.h \ |
19 | qcopenvelope_qws.h \ | 19 | qcopenvelope_qws.h \ |
20 | qpedecoration_qws.h \ | 20 | qpedecoration_qws.h \ |
21 | qpeapplication.h \ | 21 | qpeapplication.h \ |
22 | qpestyle.h \ | 22 | qpestyle.h \ |
23 | qpedialog.h \ | 23 | qpedialog.h \ |
24 | lightstyle.h \ | 24 | lightstyle.h \ |
25 | config.h \ | 25 | config.h \ |
26 | applnk.h \ | 26 | applnk.h \ |
27 | sound.h \ | 27 | sound.h \ |
28 | tzselect.h \ | 28 | tzselect.h \ |
29 | qmath.h \ | 29 | qmath.h \ |
30 | datebookdb.h \ | 30 | datebookdb.h \ |
31 | alarmserver.h \ | 31 | alarmserver.h \ |
32 | process.h \ | 32 | process.h \ |
33 | password.h \ | 33 | password.h \ |
34 | timestring.h \ | 34 | timestring.h \ |
35 | fontfactoryinterface.h \ | 35 | fontfactoryinterface.h \ |
36 | fontdatabase.h \ | 36 | fontdatabase.h \ |
37 | power.h \ | 37 | power.h \ |
38 | storage.h \ | 38 | storage.h \ |
39 | qpemessagebox.h \ | 39 | qpemessagebox.h \ |
40 | timeconversion.h \ | 40 | timeconversion.h \ |
41 | qpedebug.h \ | 41 | qpedebug.h \ |
42 | qpemenubar.h \ | 42 | qpemenubar.h \ |
43 | qpetoolbar.h \ | 43 | qpetoolbar.h \ |
44 | backend/categories.h \ | 44 | backend/categories.h \ |
45 | stringutil.h \ | 45 | stringutil.h \ |
46 | backend/palmtoprecord.h \ | 46 | backend/palmtoprecord.h \ |
47 | backend/task.h \ | 47 | backend/task.h \ |
48 | backend/event.h \ | 48 | backend/event.h \ |
49 | backend/contact.h\ | 49 | backend/contact.h\ |
50 | categorymenu.h \ | 50 | categorymenu.h \ |
51 | categoryedit_p.h \ | 51 | categoryedit_p.h \ |
52 | categoryselect.h \ | 52 | categoryselect.h \ |
53 | categorywidget.h \ | 53 | categorywidget.h \ |
54 | ir.h \ | 54 | ir.h \ |
55 | backend/vobject_p.h \ | 55 | backend/vobject_p.h \ |
56 | findwidget_p.h \ | 56 | findwidget_p.h \ |
57 | finddialog.h \ | 57 | finddialog.h \ |
58 | lnkproperties.h \ | 58 | lnkproperties.h \ |
59 | windowdecorationinterface.h \ | 59 | windowdecorationinterface.h \ |
60 | textcodecinterface.h \ | 60 | textcodecinterface.h \ |
61 | imagecodecinterface.h \ | 61 | imagecodecinterface.h \ |
62 | qt_override_p.h | 62 | qt_override_p.h |
63 | 63 | ||
64 | SOURCES= calendar.cpp \ | 64 | SOURCES= calendar.cpp \ |
65 | global.cpp \ | 65 | global.cpp \ |
66 | xmlreader.cpp \ | 66 | xmlreader.cpp \ |
67 | mimetype.cpp \ | 67 | mimetype.cpp \ |
68 | menubutton.cpp \ | 68 | menubutton.cpp \ |
69 | network.cpp \ | 69 | network.cpp \ |
70 | networkinterface.cpp \ | 70 | networkinterface.cpp \ |
71 | filemanager.cpp \ | 71 | filemanager.cpp \ |
72 | fontmanager.cpp \ | 72 | fontmanager.cpp \ |
73 | qdawg.cpp \ | 73 | qdawg.cpp \ |
74 | datebookmonth.cpp \ | 74 | datebookmonth.cpp \ |
75 | fileselector.cpp \ | 75 | fileselector.cpp \ |
76 | imageedit.cpp \ | 76 | imageedit.cpp \ |
77 | resource.cpp \ | 77 | resource.cpp \ |
78 | qpedecoration_qws.cpp \ | 78 | qpedecoration_qws.cpp \ |
79 | qcopenvelope_qws.cpp \ | 79 | qcopenvelope_qws.cpp \ |
80 | qpeapplication.cpp \ | 80 | qpeapplication.cpp \ |
81 | qpestyle.cpp \ | 81 | qpestyle.cpp \ |
82 | qpedialog.cpp \ | 82 | qpedialog.cpp \ |
83 | lightstyle.cpp \ | 83 | lightstyle.cpp \ |
84 | config.cpp \ | 84 | config.cpp \ |
85 | applnk.cpp \ | 85 | applnk.cpp \ |
86 | sound.cpp \ | 86 | sound.cpp \ |
87 | tzselect.cpp \ | 87 | tzselect.cpp \ |
88 | qmath.c \ | 88 | qmath.c \ |
89 | datebookdb.cpp \ | 89 | datebookdb.cpp \ |
90 | alarmserver.cpp \ | 90 | alarmserver.cpp \ |
91 | password.cpp \ | 91 | password.cpp \ |
92 | process.cpp \ | 92 | process.cpp \ |
93 | process_unix.cpp \ | 93 | process_unix.cpp \ |
94 | timestring.cpp \ | 94 | timestring.cpp \ |
95 | fontdatabase.cpp \ | 95 | fontdatabase.cpp \ |
96 | power.cpp \ | 96 | power.cpp \ |
97 | storage.cpp \ | 97 | storage.cpp \ |
98 | qpemessagebox.cpp \ | 98 | qpemessagebox.cpp \ |
99 | backend/timeconversion.cpp \ | 99 | backend/timeconversion.cpp \ |
100 | qpedebug.cpp \ | 100 | qpedebug.cpp \ |
101 | qpemenubar.cpp \ | 101 | qpemenubar.cpp \ |
102 | qpetoolbar.cpp \ | 102 | qpetoolbar.cpp \ |
103 | backend/categories.cpp \ | 103 | backend/categories.cpp \ |
104 | backend/stringutil.cpp \ | 104 | backend/stringutil.cpp \ |
105 | backend/palmtoprecord.cpp \ | 105 | backend/palmtoprecord.cpp \ |
106 | backend/task.cpp \ | 106 | backend/task.cpp \ |
107 | backend/event.cpp \ | 107 | backend/event.cpp \ |
108 | backend/contact.cpp \ | 108 | backend/contact.cpp \ |
109 | categorymenu.cpp \ | 109 | categorymenu.cpp \ |
110 | categoryedit_p.cpp \ | 110 | categoryedit_p.cpp \ |
111 | categoryselect.cpp \ | 111 | categoryselect.cpp \ |
112 | categorywidget.cpp \ | 112 | categorywidget.cpp \ |
113 | ir.cpp \ | 113 | ir.cpp \ |
114 | backend/vcc_yacc.cpp \ | 114 | backend/vcc_yacc.cpp \ |
115 | backend/vobject.cpp \ | 115 | backend/vobject.cpp \ |
116 | findwidget_p.cpp \ | 116 | findwidget_p.cpp \ |
117 | finddialog.cpp \ | 117 | finddialog.cpp \ |
118 | lnkproperties.cpp \ | 118 | lnkproperties.cpp \ |
119 | qt_override.cpp | 119 | qt_override.cpp |
120 | 120 | ||
121 | |||
122 | |||
121 | # Qt 3 compatibility | 123 | # Qt 3 compatibility |
122 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 124 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
123 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 125 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
124 | INCLUDEPATH += $(OPIEDIR)/include backend | 126 | INCLUDEPATH += $(OPIEDIR)/include backend |
125 | LIBS += -ldl -lcrypt -lm | 127 | LIBS += -ldl -lcrypt -lm |
126 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 128 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui |
127 | TARGET = qpe | 129 | TARGET = qpe |
128 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 130 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
129 | VERSION = 1.5.0.1 | 131 | VERSION = 1.5.0.1 |
130 | 132 | ||
131 | TRANSLATIONS = ../i18n/de/libqpe.ts \ | 133 | TRANSLATIONS = ../i18n/de/libqpe.ts \ |
132 | ../i18n/nl/libqpe.ts \ | 134 | ../i18n/nl/libqpe.ts \ |
133 | ../i18n/xx/libqpe.ts \ | 135 | ../i18n/xx/libqpe.ts \ |
134 | ../i18n/en/libqpe.ts \ | 136 | ../i18n/en/libqpe.ts \ |
135 | ../i18n/es/libqpe.ts \ | 137 | ../i18n/es/libqpe.ts \ |
136 | ../i18n/fr/libqpe.ts \ | 138 | ../i18n/fr/libqpe.ts \ |
137 | ../i18n/hu/libqpe.ts \ | 139 | ../i18n/hu/libqpe.ts \ |
138 | ../i18n/ja/libqpe.ts \ | 140 | ../i18n/ja/libqpe.ts \ |
139 | ../i18n/ko/libqpe.ts \ | 141 | ../i18n/ko/libqpe.ts \ |
140 | ../i18n/no/libqpe.ts \ | 142 | ../i18n/no/libqpe.ts \ |
141 | ../i18n/pl/libqpe.ts \ | 143 | ../i18n/pl/libqpe.ts \ |
142 | ../i18n/pt/libqpe.ts \ | 144 | ../i18n/pt/libqpe.ts \ |
143 | ../i18n/pt_BR/libqpe.ts \ | 145 | ../i18n/pt_BR/libqpe.ts \ |
144 | ../i18n/sl/libqpe.ts \ | 146 | ../i18n/sl/libqpe.ts \ |
145 | ../i18n/zh_CN/libqpe.ts \ | 147 | ../i18n/zh_CN/libqpe.ts \ |
146 | ../i18n/it/libqpe.ts \ | 148 | ../i18n/it/libqpe.ts \ |
147 | ../i18n/zh_TW/libqpe.ts \ | 149 | ../i18n/zh_TW/libqpe.ts \ |
148 | ../i18n/da/libqpe.ts | 150 | ../i18n/da/libqpe.ts |
149 | 151 | ||
150 | 152 | ||
151 | include ( $(OPIEDIR)/include.pro ) | 153 | include ( $(OPIEDIR)/include.pro ) |
154 | |||
155 | contains( CONFIG, no-override ){ | ||
156 | DEFINES += OPIE_NO_OVERRIDE_QT | ||
157 | } | ||
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 28fb13a..feba8b6 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -359,1610 +359,1616 @@ static void setMic( int t = 0, int percent = -1 ) | |||
359 | case 0: { | 359 | case 0: { |
360 | Config cfg( "qpe" ); | 360 | Config cfg( "qpe" ); |
361 | cfg.setGroup( "Volume" ); | 361 | cfg.setGroup( "Volume" ); |
362 | if ( percent < 0 ) | 362 | if ( percent < 0 ) |
363 | percent = cfg.readNumEntry( "Mic", 50 ); | 363 | percent = cfg.readNumEntry( "Mic", 50 ); |
364 | 364 | ||
365 | int fd = 0; | 365 | int fd = 0; |
366 | int mic = micMuted ? 0 : percent; | 366 | int mic = micMuted ? 0 : percent; |
367 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 367 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
368 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 368 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
369 | ::close( fd ); | 369 | ::close( fd ); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | break; | 372 | break; |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | static void setBass( int t = 0, int percent = -1 ) | 377 | static void setBass( int t = 0, int percent = -1 ) |
378 | { | 378 | { |
379 | switch ( t ) { | 379 | switch ( t ) { |
380 | case 0: { | 380 | case 0: { |
381 | Config cfg( "qpe" ); | 381 | Config cfg( "qpe" ); |
382 | cfg.setGroup( "Volume" ); | 382 | cfg.setGroup( "Volume" ); |
383 | if ( percent < 0 ) | 383 | if ( percent < 0 ) |
384 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 384 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
385 | 385 | ||
386 | int fd = 0; | 386 | int fd = 0; |
387 | int bass = percent; | 387 | int bass = percent; |
388 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 388 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
389 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 389 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
390 | ::close( fd ); | 390 | ::close( fd ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | break; | 393 | break; |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | 397 | ||
398 | static void setTreble( int t = 0, int percent = -1 ) | 398 | static void setTreble( int t = 0, int percent = -1 ) |
399 | { | 399 | { |
400 | switch ( t ) { | 400 | switch ( t ) { |
401 | case 0: { | 401 | case 0: { |
402 | Config cfg( "qpe" ); | 402 | Config cfg( "qpe" ); |
403 | cfg.setGroup( "Volume" ); | 403 | cfg.setGroup( "Volume" ); |
404 | if ( percent < 0 ) | 404 | if ( percent < 0 ) |
405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
406 | 406 | ||
407 | int fd = 0; | 407 | int fd = 0; |
408 | int treble = percent; | 408 | int treble = percent; |
409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
411 | ::close( fd ); | 411 | ::close( fd ); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | break; | 414 | break; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | 418 | ||
419 | /*! | 419 | /*! |
420 | \class QPEApplication qpeapplication.h | 420 | \class QPEApplication qpeapplication.h |
421 | \brief The QPEApplication class implements various system services | 421 | \brief The QPEApplication class implements various system services |
422 | that are available to all Qtopia applications. | 422 | that are available to all Qtopia applications. |
423 | 423 | ||
424 | Simply by using QPEApplication instead of QApplication, a standard Qt | 424 | Simply by using QPEApplication instead of QApplication, a standard Qt |
425 | application becomes a Qtopia application. It automatically follows | 425 | application becomes a Qtopia application. It automatically follows |
426 | style changes, quits and raises, and in the | 426 | style changes, quits and raises, and in the |
427 | case of \link docwidget.html document-oriented\endlink applications, | 427 | case of \link docwidget.html document-oriented\endlink applications, |
428 | changes the currently displayed document in response to the environment. | 428 | changes the currently displayed document in response to the environment. |
429 | 429 | ||
430 | To create a \link docwidget.html document-oriented\endlink | 430 | To create a \link docwidget.html document-oriented\endlink |
431 | application use showMainDocumentWidget(); to create a | 431 | application use showMainDocumentWidget(); to create a |
432 | non-document-oriented application use showMainWidget(). The | 432 | non-document-oriented application use showMainWidget(). The |
433 | keepRunning() function indicates whether the application will | 433 | keepRunning() function indicates whether the application will |
434 | continue running after it's processed the last \link qcop.html | 434 | continue running after it's processed the last \link qcop.html |
435 | QCop\endlink message. This can be changed using setKeepRunning(). | 435 | QCop\endlink message. This can be changed using setKeepRunning(). |
436 | 436 | ||
437 | A variety of signals are emitted when certain events occur, for | 437 | A variety of signals are emitted when certain events occur, for |
438 | example, timeChanged(), clockChanged(), weekChanged(), | 438 | example, timeChanged(), clockChanged(), weekChanged(), |
439 | dateFormatChanged() and volumeChanged(). If the application receives | 439 | dateFormatChanged() and volumeChanged(). If the application receives |
440 | a \link qcop.html QCop\endlink message on the application's | 440 | a \link qcop.html QCop\endlink message on the application's |
441 | QPE/Application/\e{appname} channel, the appMessage() signal is | 441 | QPE/Application/\e{appname} channel, the appMessage() signal is |
442 | emitted. There are also flush() and reload() signals, which | 442 | emitted. There are also flush() and reload() signals, which |
443 | are emitted when synching begins and ends respectively - upon these | 443 | are emitted when synching begins and ends respectively - upon these |
444 | signals, the application should save and reload any data | 444 | signals, the application should save and reload any data |
445 | files that are involved in synching. Most of these signals will initially | 445 | files that are involved in synching. Most of these signals will initially |
446 | be received and unfiltered through the appMessage() signal. | 446 | be received and unfiltered through the appMessage() signal. |
447 | 447 | ||
448 | This class also provides a set of useful static functions. The | 448 | This class also provides a set of useful static functions. The |
449 | qpeDir() and documentDir() functions return the respective paths. | 449 | qpeDir() and documentDir() functions return the respective paths. |
450 | The grabKeyboard() and ungrabKeyboard() functions are used to | 450 | The grabKeyboard() and ungrabKeyboard() functions are used to |
451 | control whether the application takes control of the device's | 451 | control whether the application takes control of the device's |
452 | physical buttons (e.g. application launch keys). The stylus' mode of | 452 | physical buttons (e.g. application launch keys). The stylus' mode of |
453 | operation is set with setStylusOperation() and retrieved with | 453 | operation is set with setStylusOperation() and retrieved with |
454 | stylusOperation(). There are also setInputMethodHint() and | 454 | stylusOperation(). There are also setInputMethodHint() and |
455 | inputMethodHint() functions. | 455 | inputMethodHint() functions. |
456 | 456 | ||
457 | \ingroup qtopiaemb | 457 | \ingroup qtopiaemb |
458 | */ | 458 | */ |
459 | 459 | ||
460 | /*! | 460 | /*! |
461 | \fn void QPEApplication::clientMoused() | 461 | \fn void QPEApplication::clientMoused() |
462 | 462 | ||
463 | \internal | 463 | \internal |
464 | */ | 464 | */ |
465 | 465 | ||
466 | /*! | 466 | /*! |
467 | \fn void QPEApplication::timeChanged(); | 467 | \fn void QPEApplication::timeChanged(); |
468 | This signal is emitted when the time changes outside the normal | 468 | This signal is emitted when the time changes outside the normal |
469 | passage of time, i.e. if the time is set backwards or forwards. | 469 | passage of time, i.e. if the time is set backwards or forwards. |
470 | */ | 470 | */ |
471 | 471 | ||
472 | /*! | 472 | /*! |
473 | \fn void QPEApplication::clockChanged( bool ampm ); | 473 | \fn void QPEApplication::clockChanged( bool ampm ); |
474 | 474 | ||
475 | This signal is emitted when the user changes the clock's style. If | 475 | This signal is emitted when the user changes the clock's style. If |
476 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 476 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
477 | they want a 24-hour clock. | 477 | they want a 24-hour clock. |
478 | */ | 478 | */ |
479 | 479 | ||
480 | /*! | 480 | /*! |
481 | \fn void QPEApplication::volumeChanged( bool muted ) | 481 | \fn void QPEApplication::volumeChanged( bool muted ) |
482 | 482 | ||
483 | This signal is emitted whenever the mute state is changed. If \a | 483 | This signal is emitted whenever the mute state is changed. If \a |
484 | muted is TRUE, then sound output has been muted. | 484 | muted is TRUE, then sound output has been muted. |
485 | */ | 485 | */ |
486 | 486 | ||
487 | /*! | 487 | /*! |
488 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 488 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
489 | 489 | ||
490 | This signal is emitted if the week start day is changed. If \a | 490 | This signal is emitted if the week start day is changed. If \a |
491 | startOnMonday is TRUE then the first day of the week is Monday; if | 491 | startOnMonday is TRUE then the first day of the week is Monday; if |
492 | \a startOnMonday is FALSE then the first day of the week is | 492 | \a startOnMonday is FALSE then the first day of the week is |
493 | Sunday. | 493 | Sunday. |
494 | */ | 494 | */ |
495 | 495 | ||
496 | /*! | 496 | /*! |
497 | \fn void QPEApplication::dateFormatChanged(DateFormat) | 497 | \fn void QPEApplication::dateFormatChanged(DateFormat) |
498 | 498 | ||
499 | This signal is emitted whenever the date format is changed. | 499 | This signal is emitted whenever the date format is changed. |
500 | */ | 500 | */ |
501 | 501 | ||
502 | /*! | 502 | /*! |
503 | \fn void QPEApplication::flush() | 503 | \fn void QPEApplication::flush() |
504 | 504 | ||
505 | ### | 505 | ### |
506 | */ | 506 | */ |
507 | 507 | ||
508 | /*! | 508 | /*! |
509 | \fn void QPEApplication::reload() | 509 | \fn void QPEApplication::reload() |
510 | 510 | ||
511 | */ | 511 | */ |
512 | 512 | ||
513 | 513 | ||
514 | 514 | ||
515 | void QPEApplication::processQCopFile() | 515 | void QPEApplication::processQCopFile() |
516 | { | 516 | { |
517 | QString qcopfn("/tmp/qcop-msg-"); | 517 | QString qcopfn("/tmp/qcop-msg-"); |
518 | qcopfn += d->appName; // append command name | 518 | qcopfn += d->appName; // append command name |
519 | 519 | ||
520 | QFile f(qcopfn); | 520 | QFile f(qcopfn); |
521 | if ( f.open(IO_ReadWrite) ) { | 521 | if ( f.open(IO_ReadWrite) ) { |
522 | #ifndef Q_OS_WIN32 | 522 | #ifndef Q_OS_WIN32 |
523 | flock(f.handle(), LOCK_EX); | 523 | flock(f.handle(), LOCK_EX); |
524 | #endif | 524 | #endif |
525 | QDataStream ds(&f); | 525 | QDataStream ds(&f); |
526 | QCString channel, message; | 526 | QCString channel, message; |
527 | QByteArray data; | 527 | QByteArray data; |
528 | while(!ds.atEnd()) { | 528 | while(!ds.atEnd()) { |
529 | ds >> channel >> message >> data; | 529 | ds >> channel >> message >> data; |
530 | d->enqueueQCop(channel,message,data); | 530 | d->enqueueQCop(channel,message,data); |
531 | } | 531 | } |
532 | ::ftruncate(f.handle(), 0); | 532 | ::ftruncate(f.handle(), 0); |
533 | #ifndef Q_OS_WIN32 | 533 | #ifndef Q_OS_WIN32 |
534 | f.flush(); | 534 | f.flush(); |
535 | flock(f.handle(), LOCK_UN); | 535 | flock(f.handle(), LOCK_UN); |
536 | #endif | 536 | #endif |
537 | } | 537 | } |
538 | #endif | 538 | #endif |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | /*! | 542 | /*! |
543 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 543 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
544 | 544 | ||
545 | This signal is emitted when a message is received on this | 545 | This signal is emitted when a message is received on this |
546 | application's QPE/Application/<i>appname</i> \link qcop.html | 546 | application's QPE/Application/<i>appname</i> \link qcop.html |
547 | QCop\endlink channel. | 547 | QCop\endlink channel. |
548 | 548 | ||
549 | The slot to which you connect this signal uses \a msg and \a data | 549 | The slot to which you connect this signal uses \a msg and \a data |
550 | in the following way: | 550 | in the following way: |
551 | 551 | ||
552 | \code | 552 | \code |
553 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 553 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
554 | { | 554 | { |
555 | QDataStream stream( data, IO_ReadOnly ); | 555 | QDataStream stream( data, IO_ReadOnly ); |
556 | if ( msg == "someMessage(int,int,int)" ) { | 556 | if ( msg == "someMessage(int,int,int)" ) { |
557 | int a,b,c; | 557 | int a,b,c; |
558 | stream >> a >> b >> c; | 558 | stream >> a >> b >> c; |
559 | ... | 559 | ... |
560 | } else if ( msg == "otherMessage(QString)" ) { | 560 | } else if ( msg == "otherMessage(QString)" ) { |
561 | ... | 561 | ... |
562 | } | 562 | } |
563 | } | 563 | } |
564 | \endcode | 564 | \endcode |
565 | 565 | ||
566 | \sa qcop.html | 566 | \sa qcop.html |
567 | Note that messages received here may be processed by qpe application | 567 | Note that messages received here may be processed by qpe application |
568 | and emitted as signals, such as flush() and reload(). | 568 | and emitted as signals, such as flush() and reload(). |
569 | */ | 569 | */ |
570 | 570 | ||
571 | /*! | 571 | /*! |
572 | Constructs a QPEApplication just as you would construct | 572 | Constructs a QPEApplication just as you would construct |
573 | a QApplication, passing \a argc, \a argv, and \a t. | 573 | a QApplication, passing \a argc, \a argv, and \a t. |
574 | 574 | ||
575 | For applications, \a t should be the default, GuiClient. Only | 575 | For applications, \a t should be the default, GuiClient. Only |
576 | the Qtopia server passes GuiServer. | 576 | the Qtopia server passes GuiServer. |
577 | */ | 577 | */ |
578 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 578 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
579 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) | 579 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) |
580 | { | 580 | { |
581 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. | 581 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. |
582 | 582 | ||
583 | d = new QPEApplicationData; | 583 | d = new QPEApplicationData; |
584 | d->loadTextCodecs(); | 584 | d->loadTextCodecs(); |
585 | d->loadImageCodecs(); | 585 | d->loadImageCodecs(); |
586 | int dw = desktop() ->width(); | 586 | int dw = desktop() ->width(); |
587 | 587 | ||
588 | if ( dw < 200 ) { | 588 | if ( dw < 200 ) { |
589 | setFont( QFont( "vera", 8 ) ); | 589 | setFont( QFont( "vera", 8 ) ); |
590 | AppLnk::setSmallIconSize( 10 ); | 590 | AppLnk::setSmallIconSize( 10 ); |
591 | AppLnk::setBigIconSize( 28 ); | 591 | AppLnk::setBigIconSize( 28 ); |
592 | } | 592 | } |
593 | #ifndef QT_QWS_SIMPAD | 593 | #ifndef QT_QWS_SIMPAD |
594 | else if ( dw > 600 ) { | 594 | else if ( dw > 600 ) { |
595 | setFont( QFont( "vera", 16 ) ); | 595 | setFont( QFont( "vera", 16 ) ); |
596 | AppLnk::setSmallIconSize( 24 ); | 596 | AppLnk::setSmallIconSize( 24 ); |
597 | AppLnk::setBigIconSize( 48 ); | 597 | AppLnk::setBigIconSize( 48 ); |
598 | } | 598 | } |
599 | #endif | 599 | #endif |
600 | else if ( dw > 200 ) { | 600 | else if ( dw > 200 ) { |
601 | setFont( QFont( "vera", 10 ) ); | 601 | setFont( QFont( "vera", 10 ) ); |
602 | AppLnk::setSmallIconSize( 14 ); | 602 | AppLnk::setSmallIconSize( 14 ); |
603 | AppLnk::setBigIconSize( 32 ); | 603 | AppLnk::setBigIconSize( 32 ); |
604 | } | 604 | } |
605 | 605 | ||
606 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 606 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
607 | 607 | ||
608 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 608 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
609 | 609 | ||
610 | 610 | ||
611 | sysChannel = new QCopChannel( "QPE/System", this ); | 611 | sysChannel = new QCopChannel( "QPE/System", this ); |
612 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 612 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
613 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 613 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
614 | 614 | ||
615 | /* COde now in initapp */ | 615 | /* COde now in initapp */ |
616 | #if 0 | 616 | #if 0 |
617 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 617 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
618 | 618 | ||
619 | QString qcopfn( "/tmp/qcop-msg-" ); | 619 | QString qcopfn( "/tmp/qcop-msg-" ); |
620 | qcopfn += QString( argv[ 0 ] ); // append command name | 620 | qcopfn += QString( argv[ 0 ] ); // append command name |
621 | 621 | ||
622 | QFile f( qcopfn ); | 622 | QFile f( qcopfn ); |
623 | if ( f.open( IO_ReadOnly ) ) { | 623 | if ( f.open( IO_ReadOnly ) ) { |
624 | flock( f.handle(), LOCK_EX ); | 624 | flock( f.handle(), LOCK_EX ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | 628 | ||
629 | QCString channel = QCString( argv[ 0 ] ); | 629 | QCString channel = QCString( argv[ 0 ] ); |
630 | channel.replace( QRegExp( ".*/" ), "" ); | 630 | channel.replace( QRegExp( ".*/" ), "" ); |
631 | d->appName = channel; | 631 | d->appName = channel; |
632 | channel = "QPE/Application/" + channel; | 632 | channel = "QPE/Application/" + channel; |
633 | pidChannel = new QCopChannel( channel, this ); | 633 | pidChannel = new QCopChannel( channel, this ); |
634 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 634 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
635 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 635 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
636 | 636 | ||
637 | if ( f.isOpen() ) { | 637 | if ( f.isOpen() ) { |
638 | d->keep_running = FALSE; | 638 | d->keep_running = FALSE; |
639 | QDataStream ds( &f ); | 639 | QDataStream ds( &f ); |
640 | QCString channel, message; | 640 | QCString channel, message; |
641 | QByteArray data; | 641 | QByteArray data; |
642 | while ( !ds.atEnd() ) { | 642 | while ( !ds.atEnd() ) { |
643 | ds >> channel >> message >> data; | 643 | ds >> channel >> message >> data; |
644 | d->enqueueQCop( channel, message, data ); | 644 | d->enqueueQCop( channel, message, data ); |
645 | } | 645 | } |
646 | 646 | ||
647 | flock( f.handle(), LOCK_UN ); | 647 | flock( f.handle(), LOCK_UN ); |
648 | f.close(); | 648 | f.close(); |
649 | f.remove(); | 649 | f.remove(); |
650 | } | 650 | } |
651 | 651 | ||
652 | for ( int a = 0; a < argc; a++ ) { | 652 | for ( int a = 0; a < argc; a++ ) { |
653 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 653 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
654 | argv[ a ] = argv[ a + 1 ]; | 654 | argv[ a ] = argv[ a + 1 ]; |
655 | a++; | 655 | a++; |
656 | d->preloaded = TRUE; | 656 | d->preloaded = TRUE; |
657 | argc -= 1; | 657 | argc -= 1; |
658 | } | 658 | } |
659 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 659 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
660 | argv[ a ] = argv[ a + 1 ]; | 660 | argv[ a ] = argv[ a + 1 ]; |
661 | a++; | 661 | a++; |
662 | d->preloaded = TRUE; | 662 | d->preloaded = TRUE; |
663 | d->forceshow = TRUE; | 663 | d->forceshow = TRUE; |
664 | argc -= 1; | 664 | argc -= 1; |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | /* overide stored arguments */ | 668 | /* overide stored arguments */ |
669 | setArgs( argc, argv ); | 669 | setArgs( argc, argv ); |
670 | 670 | ||
671 | #endif | 671 | #endif |
672 | #else | 672 | #else |
673 | initApp( argc, argv ); | 673 | initApp( argc, argv ); |
674 | #endif | 674 | #endif |
675 | // qwsSetDecoration( new QPEDecoration() ); | 675 | // qwsSetDecoration( new QPEDecoration() ); |
676 | 676 | ||
677 | #ifndef QT_NO_TRANSLATION | 677 | #ifndef QT_NO_TRANSLATION |
678 | 678 | ||
679 | d->langs = Global::languageList(); | 679 | d->langs = Global::languageList(); |
680 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { | 680 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { |
681 | QString lang = *it; | 681 | QString lang = *it; |
682 | 682 | ||
683 | installTranslation( lang + "/libopie.qm"); | 683 | installTranslation( lang + "/libopie.qm"); |
684 | installTranslation( lang + "/libqpe.qm" ); | 684 | installTranslation( lang + "/libqpe.qm" ); |
685 | installTranslation( lang + "/" + d->appName + ".qm" ); | 685 | installTranslation( lang + "/" + d->appName + ".qm" ); |
686 | 686 | ||
687 | 687 | ||
688 | //###language/font hack; should look it up somewhere | 688 | //###language/font hack; should look it up somewhere |
689 | #ifdef QWS | 689 | #ifdef QWS |
690 | 690 | ||
691 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 691 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
692 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 692 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
693 | setFont( fn ); | 693 | setFont( fn ); |
694 | } | 694 | } |
695 | #endif | 695 | #endif |
696 | } | 696 | } |
697 | #endif | 697 | #endif |
698 | 698 | ||
699 | applyStyle(); | 699 | applyStyle(); |
700 | 700 | ||
701 | if ( type() == GuiServer ) { | 701 | if ( type() == GuiServer ) { |
702 | setVolume(); | 702 | setVolume(); |
703 | } | 703 | } |
704 | 704 | ||
705 | installEventFilter( this ); | 705 | installEventFilter( this ); |
706 | 706 | ||
707 | QPEMenuToolFocusManager::initialize(); | 707 | QPEMenuToolFocusManager::initialize(); |
708 | 708 | ||
709 | #ifdef QT_NO_QWS_CURSOR | 709 | #ifdef QT_NO_QWS_CURSOR |
710 | // if we have no cursor, probably don't want tooltips | 710 | // if we have no cursor, probably don't want tooltips |
711 | QToolTip::setEnabled( FALSE ); | 711 | QToolTip::setEnabled( FALSE ); |
712 | #endif | 712 | #endif |
713 | } | 713 | } |
714 | 714 | ||
715 | 715 | ||
716 | #ifdef QTOPIA_INTERNAL_INITAPP | 716 | #ifdef QTOPIA_INTERNAL_INITAPP |
717 | void QPEApplication::initApp( int argc, char **argv ) | 717 | void QPEApplication::initApp( int argc, char **argv ) |
718 | { | 718 | { |
719 | bool initial = pidChannel; // was set to 0 in the initializer | 719 | bool initial = pidChannel; // was set to 0 in the initializer |
720 | delete pidChannel; | 720 | delete pidChannel; |
721 | d->keep_running = TRUE; | 721 | d->keep_running = TRUE; |
722 | d->preloaded = FALSE; | 722 | d->preloaded = FALSE; |
723 | d->forceshow = FALSE; | 723 | d->forceshow = FALSE; |
724 | 724 | ||
725 | QCString channel = QCString(argv[0]); | 725 | QCString channel = QCString(argv[0]); |
726 | 726 | ||
727 | channel.replace(QRegExp(".*/"),""); | 727 | channel.replace(QRegExp(".*/"),""); |
728 | d->appName = channel; | 728 | d->appName = channel; |
729 | 729 | ||
730 | #if QT_VERSION > 235 | 730 | #if QT_VERSION > 235 |
731 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 | 731 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | channel = "QPE/Application/" + channel; | 734 | channel = "QPE/Application/" + channel; |
735 | pidChannel = new QCopChannel( channel, this); | 735 | pidChannel = new QCopChannel( channel, this); |
736 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 736 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
737 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); | 737 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); |
738 | 738 | ||
739 | if (!initial) { | 739 | if (!initial) { |
740 | processQCopFile(); | 740 | processQCopFile(); |
741 | d->keep_running = d->qcopq.isEmpty(); | 741 | d->keep_running = d->qcopq.isEmpty(); |
742 | } | 742 | } |
743 | 743 | ||
744 | for (int a=0; a<argc; a++) { | 744 | for (int a=0; a<argc; a++) { |
745 | if ( qstrcmp(argv[a],"-preload")==0 ) { | 745 | if ( qstrcmp(argv[a],"-preload")==0 ) { |
746 | argv[a] = argv[a+1]; | 746 | argv[a] = argv[a+1]; |
747 | a++; | 747 | a++; |
748 | d->preloaded = TRUE; | 748 | d->preloaded = TRUE; |
749 | argc-=1; | 749 | argc-=1; |
750 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { | 750 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { |
751 | argv[a] = argv[a+1]; | 751 | argv[a] = argv[a+1]; |
752 | a++; | 752 | a++; |
753 | d->preloaded = TRUE; | 753 | d->preloaded = TRUE; |
754 | d->forceshow = TRUE; | 754 | d->forceshow = TRUE; |
755 | argc-=1; | 755 | argc-=1; |
756 | } | 756 | } |
757 | } | 757 | } |
758 | 758 | ||
759 | /* overide stored arguments */ | 759 | /* overide stored arguments */ |
760 | setArgs(argc, argv); | 760 | setArgs(argc, argv); |
761 | 761 | ||
762 | /* install translation here */ | 762 | /* install translation here */ |
763 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) | 763 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) |
764 | installTranslation( (*it) + "/" + d->appName + ".qm" ); | 764 | installTranslation( (*it) + "/" + d->appName + ".qm" ); |
765 | } | 765 | } |
766 | #endif | 766 | #endif |
767 | 767 | ||
768 | 768 | ||
769 | static QPtrDict<void>* inputMethodDict = 0; | 769 | static QPtrDict<void>* inputMethodDict = 0; |
770 | static void createInputMethodDict() | 770 | static void createInputMethodDict() |
771 | { | 771 | { |
772 | if ( !inputMethodDict ) | 772 | if ( !inputMethodDict ) |
773 | inputMethodDict = new QPtrDict<void>; | 773 | inputMethodDict = new QPtrDict<void>; |
774 | } | 774 | } |
775 | 775 | ||
776 | /*! | 776 | /*! |
777 | Returns the currently set hint to the system as to whether | 777 | Returns the currently set hint to the system as to whether |
778 | widget \a w has any use for text input methods. | 778 | widget \a w has any use for text input methods. |
779 | 779 | ||
780 | 780 | ||
781 | \sa setInputMethodHint() InputMethodHint | 781 | \sa setInputMethodHint() InputMethodHint |
782 | */ | 782 | */ |
783 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 783 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
784 | { | 784 | { |
785 | if ( inputMethodDict && w ) | 785 | if ( inputMethodDict && w ) |
786 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 786 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
787 | return Normal; | 787 | return Normal; |
788 | } | 788 | } |
789 | 789 | ||
790 | /*! | 790 | /*! |
791 | \enum QPEApplication::InputMethodHint | 791 | \enum QPEApplication::InputMethodHint |
792 | 792 | ||
793 | \value Normal the application sometimes needs text input (the default). | 793 | \value Normal the application sometimes needs text input (the default). |
794 | \value AlwaysOff the application never needs text input. | 794 | \value AlwaysOff the application never needs text input. |
795 | \value AlwaysOn the application always needs text input. | 795 | \value AlwaysOn the application always needs text input. |
796 | */ | 796 | */ |
797 | 797 | ||
798 | /*! | 798 | /*! |
799 | Hints to the system that widget \a w has use for text input methods | 799 | Hints to the system that widget \a w has use for text input methods |
800 | as specified by \a mode. | 800 | as specified by \a mode. |
801 | 801 | ||
802 | \sa inputMethodHint() InputMethodHint | 802 | \sa inputMethodHint() InputMethodHint |
803 | */ | 803 | */ |
804 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 804 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
805 | { | 805 | { |
806 | createInputMethodDict(); | 806 | createInputMethodDict(); |
807 | if ( mode == Normal ) { | 807 | if ( mode == Normal ) { |
808 | inputMethodDict->remove | 808 | inputMethodDict->remove |
809 | ( w ); | 809 | ( w ); |
810 | } | 810 | } |
811 | else { | 811 | else { |
812 | inputMethodDict->insert( w, ( void* ) mode ); | 812 | inputMethodDict->insert( w, ( void* ) mode ); |
813 | } | 813 | } |
814 | } | 814 | } |
815 | 815 | ||
816 | class HackDialog : public QDialog | 816 | class HackDialog : public QDialog |
817 | { | 817 | { |
818 | public: | 818 | public: |
819 | void acceptIt() | 819 | void acceptIt() |
820 | { | 820 | { |
821 | accept(); | 821 | accept(); |
822 | } | 822 | } |
823 | void rejectIt() | 823 | void rejectIt() |
824 | { | 824 | { |
825 | reject(); | 825 | reject(); |
826 | } | 826 | } |
827 | }; | 827 | }; |
828 | 828 | ||
829 | 829 | ||
830 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 830 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
831 | { | 831 | { |
832 | // specialised actions for certain widgets. May want to | 832 | // specialised actions for certain widgets. May want to |
833 | // add more stuff here. | 833 | // add more stuff here. |
834 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) | 834 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) |
835 | && activePopupWidget() ->parentWidget() | 835 | && activePopupWidget() ->parentWidget() |
836 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) | 836 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) |
837 | key = Qt::Key_Return; | 837 | key = Qt::Key_Return; |
838 | 838 | ||
839 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) | 839 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) |
840 | key = Qt::Key_Return; | 840 | key = Qt::Key_Return; |
841 | 841 | ||
842 | #ifdef QWS | 842 | #ifdef QWS |
843 | 843 | ||
844 | ke->simpleData.keycode = key; | 844 | ke->simpleData.keycode = key; |
845 | #endif | 845 | #endif |
846 | } | 846 | } |
847 | 847 | ||
848 | class HackWidget : public QWidget | 848 | class HackWidget : public QWidget |
849 | { | 849 | { |
850 | public: | 850 | public: |
851 | bool needsOk() | 851 | bool needsOk() |
852 | { | 852 | { |
853 | return ( getWState() & WState_Reserved1 ); | 853 | return ( getWState() & WState_Reserved1 ); |
854 | } | 854 | } |
855 | }; | 855 | }; |
856 | 856 | ||
857 | /*! | 857 | /*! |
858 | \internal | 858 | \internal |
859 | */ | 859 | */ |
860 | 860 | ||
861 | #ifdef QWS | 861 | #ifdef QWS |
862 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 862 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
863 | { | 863 | { |
864 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 864 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
865 | if ( qApp->type() != QApplication::GuiServer ) { | 865 | if ( qApp->type() != QApplication::GuiServer ) { |
866 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 866 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
867 | e << d->appName; | 867 | e << d->appName; |
868 | } | 868 | } |
869 | d->notbusysent = TRUE; | 869 | d->notbusysent = TRUE; |
870 | } | 870 | } |
871 | if ( type() == GuiServer ) { | 871 | if ( type() == GuiServer ) { |
872 | switch ( e->type ) { | 872 | switch ( e->type ) { |
873 | case QWSEvent::Mouse: | 873 | case QWSEvent::Mouse: |
874 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 874 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
875 | emit clientMoused(); | 875 | emit clientMoused(); |
876 | break; | 876 | break; |
877 | default: | 877 | default: |
878 | break; | 878 | break; |
879 | } | 879 | } |
880 | } | 880 | } |
881 | if ( e->type == QWSEvent::Key ) { | 881 | if ( e->type == QWSEvent::Key ) { |
882 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; | 882 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; |
883 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 883 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
884 | // Use special "OK" key to press "OK" on top level widgets | 884 | // Use special "OK" key to press "OK" on top level widgets |
885 | QWidget * active = activeWindow(); | 885 | QWidget * active = activeWindow(); |
886 | QWidget *popup = 0; | 886 | QWidget *popup = 0; |
887 | if ( active && active->isPopup() ) { | 887 | if ( active && active->isPopup() ) { |
888 | popup = active; | 888 | popup = active; |
889 | active = active->parentWidget(); | 889 | active = active->parentWidget(); |
890 | } | 890 | } |
891 | if ( active && ( int ) active->winId() == ke->simpleData.window && | 891 | if ( active && ( int ) active->winId() == ke->simpleData.window && |
892 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 892 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
893 | if ( ke->simpleData.is_press ) { | 893 | if ( ke->simpleData.is_press ) { |
894 | if ( popup ) | 894 | if ( popup ) |
895 | popup->close(); | 895 | popup->close(); |
896 | if ( active->inherits( "QDialog" ) ) { | 896 | if ( active->inherits( "QDialog" ) ) { |
897 | HackDialog * d = ( HackDialog * ) active; | 897 | HackDialog * d = ( HackDialog * ) active; |
898 | d->acceptIt(); | 898 | d->acceptIt(); |
899 | return TRUE; | 899 | return TRUE; |
900 | } | 900 | } |
901 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 901 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
902 | QSignal s; | 902 | QSignal s; |
903 | s.connect( active, SLOT( accept() ) ); | 903 | s.connect( active, SLOT( accept() ) ); |
904 | s.activate(); | 904 | s.activate(); |
905 | } | 905 | } |
906 | else { | 906 | else { |
907 | // do the same as with the select key: Map to the default action of the widget: | 907 | // do the same as with the select key: Map to the default action of the widget: |
908 | mapToDefaultAction( ke, Qt::Key_Return ); | 908 | mapToDefaultAction( ke, Qt::Key_Return ); |
909 | } | 909 | } |
910 | } | 910 | } |
911 | } | 911 | } |
912 | } | 912 | } |
913 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 913 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
914 | // Use special "select" key to do whatever default action a widget has | 914 | // Use special "select" key to do whatever default action a widget has |
915 | mapToDefaultAction( ke, Qt::Key_Space ); | 915 | mapToDefaultAction( ke, Qt::Key_Space ); |
916 | } | 916 | } |
917 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 917 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
918 | ke->simpleData.is_press ) { | 918 | ke->simpleData.is_press ) { |
919 | // Escape key closes app if focus on toplevel | 919 | // Escape key closes app if focus on toplevel |
920 | QWidget * active = activeWindow(); | 920 | QWidget * active = activeWindow(); |
921 | if ( active && active->testWFlags( WType_TopLevel ) && | 921 | if ( active && active->testWFlags( WType_TopLevel ) && |
922 | ( int ) active->winId() == ke->simpleData.window && | 922 | ( int ) active->winId() == ke->simpleData.window && |
923 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 923 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
924 | if ( active->inherits( "QDialog" ) ) { | 924 | if ( active->inherits( "QDialog" ) ) { |
925 | HackDialog * d = ( HackDialog * ) active; | 925 | HackDialog * d = ( HackDialog * ) active; |
926 | d->rejectIt(); | 926 | d->rejectIt(); |
927 | return TRUE; | 927 | return TRUE; |
928 | } | 928 | } |
929 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | 929 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { |
930 | active->close(); | 930 | active->close(); |
931 | } | 931 | } |
932 | } | 932 | } |
933 | } | 933 | } |
934 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 934 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
935 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 935 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
936 | // but we cannot access libopie function within libqpe :( | 936 | // but we cannot access libopie function within libqpe :( |
937 | 937 | ||
938 | QWidget * active = activeWindow ( ); | 938 | QWidget * active = activeWindow ( ); |
939 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 939 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
940 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 940 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
941 | QChar ch ( ke-> simpleData.unicode ); | 941 | QChar ch ( ke-> simpleData.unicode ); |
942 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 942 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
943 | ke-> simpleData.keycode, | 943 | ke-> simpleData.keycode, |
944 | ch. latin1 ( ), | 944 | ch. latin1 ( ), |
945 | ke-> simpleData.modifiers, | 945 | ke-> simpleData.modifiers, |
946 | QString ( ch ), | 946 | QString ( ch ), |
947 | ke-> simpleData.is_auto_repeat, 1 ); | 947 | ke-> simpleData.is_auto_repeat, 1 ); |
948 | 948 | ||
949 | QObject *which = QWidget::keyboardGrabber ( ); | 949 | QObject *which = QWidget::keyboardGrabber ( ); |
950 | if ( !which ) | 950 | if ( !which ) |
951 | which = QApplication::focusWidget ( ); | 951 | which = QApplication::focusWidget ( ); |
952 | if ( !which ) | 952 | if ( !which ) |
953 | which = QApplication::activeWindow ( ); | 953 | which = QApplication::activeWindow ( ); |
954 | if ( !which ) | 954 | if ( !which ) |
955 | which = qApp; | 955 | which = qApp; |
956 | 956 | ||
957 | QApplication::sendEvent ( which, &qke ); | 957 | QApplication::sendEvent ( which, &qke ); |
958 | } | 958 | } |
959 | else { // we didn't grab the keyboard, so send the event to the launcher | 959 | else { // we didn't grab the keyboard, so send the event to the launcher |
960 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 960 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
961 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 961 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
962 | } | 962 | } |
963 | } | 963 | } |
964 | return true; | 964 | return true; |
965 | } | 965 | } |
966 | } | 966 | } |
967 | if ( e->type == QWSEvent::Focus ) { | 967 | if ( e->type == QWSEvent::Focus ) { |
968 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 968 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
969 | if ( !fe->simpleData.get_focus ) { | 969 | if ( !fe->simpleData.get_focus ) { |
970 | QWidget * active = activeWindow(); | 970 | QWidget * active = activeWindow(); |
971 | while ( active && active->isPopup() ) { | 971 | while ( active && active->isPopup() ) { |
972 | active->close(); | 972 | active->close(); |
973 | active = activeWindow(); | 973 | active = activeWindow(); |
974 | } | 974 | } |
975 | } | 975 | } |
976 | else { | 976 | else { |
977 | // make sure our modal widget is ALWAYS on top | 977 | // make sure our modal widget is ALWAYS on top |
978 | QWidget *topm = activeModalWidget(); | 978 | QWidget *topm = activeModalWidget(); |
979 | if ( topm ) { | 979 | if ( topm ) { |
980 | topm->raise(); | 980 | topm->raise(); |
981 | } | 981 | } |
982 | } | 982 | } |
983 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 983 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
984 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 984 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
985 | if ( m == AlwaysOff ) | 985 | if ( m == AlwaysOff ) |
986 | Global::hideInputMethod(); | 986 | Global::hideInputMethod(); |
987 | if ( m == AlwaysOn ) | 987 | if ( m == AlwaysOn ) |
988 | Global::showInputMethod(); | 988 | Global::showInputMethod(); |
989 | } | 989 | } |
990 | } | 990 | } |
991 | 991 | ||
992 | 992 | ||
993 | return QApplication::qwsEventFilter( e ); | 993 | return QApplication::qwsEventFilter( e ); |
994 | } | 994 | } |
995 | #endif | 995 | #endif |
996 | 996 | ||
997 | /*! | 997 | /*! |
998 | Destroys the QPEApplication. | 998 | Destroys the QPEApplication. |
999 | */ | 999 | */ |
1000 | QPEApplication::~QPEApplication() | 1000 | QPEApplication::~QPEApplication() |
1001 | { | 1001 | { |
1002 | ungrabKeyboard(); | 1002 | ungrabKeyboard(); |
1003 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1003 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1004 | // Need to delete QCopChannels early, since the display will | 1004 | // Need to delete QCopChannels early, since the display will |
1005 | // be gone by the time we get to ~QObject(). | 1005 | // be gone by the time we get to ~QObject(). |
1006 | delete sysChannel; | 1006 | delete sysChannel; |
1007 | delete pidChannel; | 1007 | delete pidChannel; |
1008 | #endif | 1008 | #endif |
1009 | 1009 | ||
1010 | delete d; | 1010 | delete d; |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | /*! | 1013 | /*! |
1014 | Returns <tt>$OPIEDIR/</tt>. | 1014 | Returns <tt>$OPIEDIR/</tt>. |
1015 | */ | 1015 | */ |
1016 | QString QPEApplication::qpeDir() | 1016 | QString QPEApplication::qpeDir() |
1017 | { | 1017 | { |
1018 | const char * base = getenv( "OPIEDIR" ); | 1018 | const char * base = getenv( "OPIEDIR" ); |
1019 | if ( base ) | 1019 | if ( base ) |
1020 | return QString( base ) + "/"; | 1020 | return QString( base ) + "/"; |
1021 | 1021 | ||
1022 | return QString( "../" ); | 1022 | return QString( "../" ); |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | /*! | 1025 | /*! |
1026 | Returns the user's current Document directory. There is a trailing "/". | 1026 | Returns the user's current Document directory. There is a trailing "/". |
1027 | .. well, it does now,, and there's no trailing '/' | 1027 | .. well, it does now,, and there's no trailing '/' |
1028 | */ | 1028 | */ |
1029 | QString QPEApplication::documentDir() | 1029 | QString QPEApplication::documentDir() |
1030 | { | 1030 | { |
1031 | const char* base = getenv( "HOME"); | 1031 | const char* base = getenv( "HOME"); |
1032 | if ( base ) | 1032 | if ( base ) |
1033 | return QString( base ) + "/Documents"; | 1033 | return QString( base ) + "/Documents"; |
1034 | 1034 | ||
1035 | return QString( "../Documents" ); | 1035 | return QString( "../Documents" ); |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | static int deforient = -1; | 1038 | static int deforient = -1; |
1039 | 1039 | ||
1040 | /*! | 1040 | /*! |
1041 | \internal | 1041 | \internal |
1042 | */ | 1042 | */ |
1043 | int QPEApplication::defaultRotation() | 1043 | int QPEApplication::defaultRotation() |
1044 | { | 1044 | { |
1045 | if ( deforient < 0 ) { | 1045 | if ( deforient < 0 ) { |
1046 | QString d = getenv( "QWS_DISPLAY" ); | 1046 | QString d = getenv( "QWS_DISPLAY" ); |
1047 | if ( d.contains( "Rot90" ) ) { | 1047 | if ( d.contains( "Rot90" ) ) { |
1048 | deforient = 90; | 1048 | deforient = 90; |
1049 | } | 1049 | } |
1050 | else if ( d.contains( "Rot180" ) ) { | 1050 | else if ( d.contains( "Rot180" ) ) { |
1051 | deforient = 180; | 1051 | deforient = 180; |
1052 | } | 1052 | } |
1053 | else if ( d.contains( "Rot270" ) ) { | 1053 | else if ( d.contains( "Rot270" ) ) { |
1054 | deforient = 270; | 1054 | deforient = 270; |
1055 | } | 1055 | } |
1056 | else { | 1056 | else { |
1057 | deforient = 0; | 1057 | deforient = 0; |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | return deforient; | 1060 | return deforient; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | /*! | 1063 | /*! |
1064 | \internal | 1064 | \internal |
1065 | */ | 1065 | */ |
1066 | void QPEApplication::setDefaultRotation( int r ) | 1066 | void QPEApplication::setDefaultRotation( int r ) |
1067 | { | 1067 | { |
1068 | if ( qApp->type() == GuiServer ) { | 1068 | if ( qApp->type() == GuiServer ) { |
1069 | deforient = r; | 1069 | deforient = r; |
1070 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1070 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1071 | Config config("qpe"); | 1071 | Config config("qpe"); |
1072 | config.setGroup( "Rotation" ); | 1072 | config.setGroup( "Rotation" ); |
1073 | config.writeEntry( "Rot", r ); | 1073 | config.writeEntry( "Rot", r ); |
1074 | } | 1074 | } |
1075 | else { | 1075 | else { |
1076 | #ifndef QT_NO_COP | 1076 | #ifndef QT_NO_COP |
1077 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1077 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1078 | e << r; | 1078 | e << r; |
1079 | } | 1079 | } |
1080 | #endif | 1080 | #endif |
1081 | 1081 | ||
1082 | } | 1082 | } |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | #include <qgfx_qws.h> | 1085 | #include <qgfx_qws.h> |
1086 | #include <qwindowsystem_qws.h> | 1086 | #include <qwindowsystem_qws.h> |
1087 | #include <qpixmapcache.h> | 1087 | #include <qpixmapcache.h> |
1088 | 1088 | ||
1089 | extern void qws_clearLoadedFonts(); | 1089 | extern void qws_clearLoadedFonts(); |
1090 | 1090 | ||
1091 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1091 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1092 | { | 1092 | { |
1093 | // Reset the caches | 1093 | // Reset the caches |
1094 | qws_clearLoadedFonts(); | 1094 | qws_clearLoadedFonts(); |
1095 | QPixmapCache::clear(); | 1095 | QPixmapCache::clear(); |
1096 | 1096 | ||
1097 | // Change the screen mode | 1097 | // Change the screen mode |
1098 | qt_screen->setMode(x, y, depth); | 1098 | qt_screen->setMode(x, y, depth); |
1099 | 1099 | ||
1100 | if ( qApp->type() == GuiServer ) { | 1100 | if ( qApp->type() == GuiServer ) { |
1101 | // Reconfigure the GuiServer | 1101 | // Reconfigure the GuiServer |
1102 | qwsServer->beginDisplayReconfigure(); | 1102 | qwsServer->beginDisplayReconfigure(); |
1103 | qwsServer->endDisplayReconfigure(); | 1103 | qwsServer->endDisplayReconfigure(); |
1104 | 1104 | ||
1105 | // Get all the running apps to reset | 1105 | // Get all the running apps to reset |
1106 | QCopEnvelope env( "QPE/System", "reset()" ); | 1106 | QCopEnvelope env( "QPE/System", "reset()" ); |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | void QPEApplication::reset() { | 1110 | void QPEApplication::reset() { |
1111 | // Reconnect to the screen | 1111 | // Reconnect to the screen |
1112 | qt_screen->disconnect(); | 1112 | qt_screen->disconnect(); |
1113 | qt_screen->connect( QString::null ); | 1113 | qt_screen->connect( QString::null ); |
1114 | 1114 | ||
1115 | // Redraw everything | 1115 | // Redraw everything |
1116 | applyStyle(); | 1116 | applyStyle(); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | /*! | 1119 | /*! |
1120 | \internal | 1120 | \internal |
1121 | */ | 1121 | */ |
1122 | void QPEApplication::applyStyle() | 1122 | void QPEApplication::applyStyle() |
1123 | { | 1123 | { |
1124 | Config config( "qpe" ); | 1124 | Config config( "qpe" ); |
1125 | config.setGroup( "Appearance" ); | 1125 | config.setGroup( "Appearance" ); |
1126 | 1126 | ||
1127 | #if QT_VERSION > 233 | 1127 | #if QT_VERSION > 233 |
1128 | #if !defined(OPIE_NO_OVERRIDE_QT) | ||
1128 | // don't block ourselves ... | 1129 | // don't block ourselves ... |
1129 | Opie::force_appearance = 0; | 1130 | Opie::force_appearance = 0; |
1130 | 1131 | ||
1131 | static QString appname = Opie::binaryName ( ); | 1132 | static QString appname = Opie::binaryName ( ); |
1132 | 1133 | ||
1133 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1134 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
1134 | int nostyle = 0; | 1135 | int nostyle = 0; |
1135 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 1136 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
1136 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 1137 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
1137 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 1138 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
1138 | break; | 1139 | break; |
1139 | } | 1140 | } |
1140 | } | 1141 | } |
1142 | #else | ||
1143 | int nostyle = 0; | ||
1144 | #endif | ||
1141 | 1145 | ||
1142 | // Widget style | 1146 | // Widget style |
1143 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1147 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1144 | 1148 | ||
1145 | // don't set a custom style | 1149 | // don't set a custom style |
1146 | if ( nostyle & Opie::Force_Style ) | 1150 | if ( nostyle & Opie::Force_Style ) |
1147 | style = "FlatStyle"; | 1151 | style = "FlatStyle"; |
1148 | 1152 | ||
1149 | internalSetStyle ( style ); | 1153 | internalSetStyle ( style ); |
1150 | 1154 | ||
1151 | // Colors - from /etc/colors/Liquid.scheme | 1155 | // Colors - from /etc/colors/Liquid.scheme |
1152 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1156 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1153 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1157 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1154 | QPalette pal( btncolor, bgcolor ); | 1158 | QPalette pal( btncolor, bgcolor ); |
1155 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1159 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1156 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1160 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1157 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1161 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1158 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1162 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1159 | color = config.readEntry( "Text", "#000000" ); | 1163 | color = config.readEntry( "Text", "#000000" ); |
1160 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1164 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1161 | color = config.readEntry( "ButtonText", "#000000" ); | 1165 | color = config.readEntry( "ButtonText", "#000000" ); |
1162 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1166 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1163 | color = config.readEntry( "Base", "#FFFFFF" ); | 1167 | color = config.readEntry( "Base", "#FFFFFF" ); |
1164 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1168 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1165 | 1169 | ||
1166 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1170 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1167 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1171 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1168 | 1172 | ||
1169 | setPalette( pal, TRUE ); | 1173 | setPalette( pal, TRUE ); |
1170 | 1174 | ||
1171 | // Window Decoration | 1175 | // Window Decoration |
1172 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1176 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1173 | 1177 | ||
1174 | // don't set a custom deco | 1178 | // don't set a custom deco |
1175 | if ( nostyle & Opie::Force_Decoration ) | 1179 | if ( nostyle & Opie::Force_Decoration ) |
1176 | dec = ""; | 1180 | dec = ""; |
1177 | 1181 | ||
1178 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1182 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1179 | 1183 | ||
1180 | if ( dec != d->decorationName ) { | 1184 | if ( dec != d->decorationName ) { |
1181 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1185 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1182 | d->decorationName = dec; | 1186 | d->decorationName = dec; |
1183 | } | 1187 | } |
1184 | 1188 | ||
1185 | // Font | 1189 | // Font |
1186 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1190 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1187 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1191 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1188 | 1192 | ||
1189 | // don't set a custom font | 1193 | // don't set a custom font |
1190 | if ( nostyle & Opie::Force_Font ) { | 1194 | if ( nostyle & Opie::Force_Font ) { |
1191 | ff = "Vera"; | 1195 | ff = "Vera"; |
1192 | fs = 10; | 1196 | fs = 10; |
1193 | } | 1197 | } |
1194 | 1198 | ||
1195 | setFont ( QFont ( ff, fs ), true ); | 1199 | setFont ( QFont ( ff, fs ), true ); |
1196 | 1200 | ||
1201 | #if !defined(OPIE_NO_OVERRIDE_QT) | ||
1197 | // revert to global blocking policy ... | 1202 | // revert to global blocking policy ... |
1198 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1203 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1199 | Opie::force_appearance &= ~nostyle; | 1204 | Opie::force_appearance &= ~nostyle; |
1200 | #endif | 1205 | #endif |
1206 | #endif | ||
1201 | } | 1207 | } |
1202 | 1208 | ||
1203 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1209 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1204 | { | 1210 | { |
1205 | #ifdef Q_WS_QWS | 1211 | #ifdef Q_WS_QWS |
1206 | QDataStream stream( data, IO_ReadOnly ); | 1212 | QDataStream stream( data, IO_ReadOnly ); |
1207 | if ( msg == "applyStyle()" ) { | 1213 | if ( msg == "applyStyle()" ) { |
1208 | applyStyle(); | 1214 | applyStyle(); |
1209 | } | 1215 | } |
1210 | else if ( msg == "toggleApplicationMenu()" ) { | 1216 | else if ( msg == "toggleApplicationMenu()" ) { |
1211 | QWidget *active = activeWindow ( ); | 1217 | QWidget *active = activeWindow ( ); |
1212 | 1218 | ||
1213 | if ( active ) { | 1219 | if ( active ) { |
1214 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1220 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1215 | bool oldactive = man-> isActive ( ); | 1221 | bool oldactive = man-> isActive ( ); |
1216 | 1222 | ||
1217 | man-> setActive( !man-> isActive() ); | 1223 | man-> setActive( !man-> isActive() ); |
1218 | 1224 | ||
1219 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1225 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1220 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1226 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1221 | } | 1227 | } |
1222 | } | 1228 | } |
1223 | } | 1229 | } |
1224 | else if ( msg == "setDefaultRotation(int)" ) { | 1230 | else if ( msg == "setDefaultRotation(int)" ) { |
1225 | if ( type() == GuiServer ) { | 1231 | if ( type() == GuiServer ) { |
1226 | int r; | 1232 | int r; |
1227 | stream >> r; | 1233 | stream >> r; |
1228 | setDefaultRotation( r ); | 1234 | setDefaultRotation( r ); |
1229 | } | 1235 | } |
1230 | } | 1236 | } |
1231 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> | 1237 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> |
1232 | if ( type() == GuiServer ) { | 1238 | if ( type() == GuiServer ) { |
1233 | int x, y, depth; | 1239 | int x, y, depth; |
1234 | stream >> x; | 1240 | stream >> x; |
1235 | stream >> y; | 1241 | stream >> y; |
1236 | stream >> depth; | 1242 | stream >> depth; |
1237 | setCurrentMode( x, y, depth ); | 1243 | setCurrentMode( x, y, depth ); |
1238 | } | 1244 | } |
1239 | } | 1245 | } |
1240 | else if ( msg == "reset()" ) { | 1246 | else if ( msg == "reset()" ) { |
1241 | if ( type() != GuiServer ) | 1247 | if ( type() != GuiServer ) |
1242 | reset(); | 1248 | reset(); |
1243 | } | 1249 | } |
1244 | else if ( msg == "setCurrentRotation(int)" ) { | 1250 | else if ( msg == "setCurrentRotation(int)" ) { |
1245 | int r; | 1251 | int r; |
1246 | stream >> r; | 1252 | stream >> r; |
1247 | setCurrentRotation( r ); | 1253 | setCurrentRotation( r ); |
1248 | } | 1254 | } |
1249 | else if ( msg == "shutdown()" ) { | 1255 | else if ( msg == "shutdown()" ) { |
1250 | if ( type() == GuiServer ) | 1256 | if ( type() == GuiServer ) |
1251 | shutdown(); | 1257 | shutdown(); |
1252 | } | 1258 | } |
1253 | else if ( msg == "quit()" ) { | 1259 | else if ( msg == "quit()" ) { |
1254 | if ( type() != GuiServer ) | 1260 | if ( type() != GuiServer ) |
1255 | tryQuit(); | 1261 | tryQuit(); |
1256 | } | 1262 | } |
1257 | else if ( msg == "forceQuit()" ) { | 1263 | else if ( msg == "forceQuit()" ) { |
1258 | if ( type() != GuiServer ) | 1264 | if ( type() != GuiServer ) |
1259 | quit(); | 1265 | quit(); |
1260 | } | 1266 | } |
1261 | else if ( msg == "restart()" ) { | 1267 | else if ( msg == "restart()" ) { |
1262 | if ( type() == GuiServer ) | 1268 | if ( type() == GuiServer ) |
1263 | restart(); | 1269 | restart(); |
1264 | } | 1270 | } |
1265 | else if ( msg == "language(QString)" ) { | 1271 | else if ( msg == "language(QString)" ) { |
1266 | if ( type() == GuiServer ) { | 1272 | if ( type() == GuiServer ) { |
1267 | QString l; | 1273 | QString l; |
1268 | stream >> l; | 1274 | stream >> l; |
1269 | QString cl = getenv( "LANG" ); | 1275 | QString cl = getenv( "LANG" ); |
1270 | if ( cl != l ) { | 1276 | if ( cl != l ) { |
1271 | if ( l.isNull() ) | 1277 | if ( l.isNull() ) |
1272 | unsetenv( "LANG" ); | 1278 | unsetenv( "LANG" ); |
1273 | else | 1279 | else |
1274 | setenv( "LANG", l.latin1(), 1 ); | 1280 | setenv( "LANG", l.latin1(), 1 ); |
1275 | restart(); | 1281 | restart(); |
1276 | } | 1282 | } |
1277 | } | 1283 | } |
1278 | } | 1284 | } |
1279 | else if ( msg == "timeChange(QString)" ) { | 1285 | else if ( msg == "timeChange(QString)" ) { |
1280 | QString t; | 1286 | QString t; |
1281 | stream >> t; | 1287 | stream >> t; |
1282 | if ( t.isNull() ) | 1288 | if ( t.isNull() ) |
1283 | unsetenv( "TZ" ); | 1289 | unsetenv( "TZ" ); |
1284 | else | 1290 | else |
1285 | setenv( "TZ", t.latin1(), 1 ); | 1291 | setenv( "TZ", t.latin1(), 1 ); |
1286 | // emit the signal so everyone else knows... | 1292 | // emit the signal so everyone else knows... |
1287 | emit timeChanged(); | 1293 | emit timeChanged(); |
1288 | } | 1294 | } |
1289 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1295 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1290 | if ( type() == GuiServer ) { | 1296 | if ( type() == GuiServer ) { |
1291 | QDateTime when; | 1297 | QDateTime when; |
1292 | QCString channel, message; | 1298 | QCString channel, message; |
1293 | int data; | 1299 | int data; |
1294 | stream >> when >> channel >> message >> data; | 1300 | stream >> when >> channel >> message >> data; |
1295 | AlarmServer::addAlarm( when, channel, message, data ); | 1301 | AlarmServer::addAlarm( when, channel, message, data ); |
1296 | } | 1302 | } |
1297 | } | 1303 | } |
1298 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1304 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1299 | if ( type() == GuiServer ) { | 1305 | if ( type() == GuiServer ) { |
1300 | QDateTime when; | 1306 | QDateTime when; |
1301 | QCString channel, message; | 1307 | QCString channel, message; |
1302 | int data; | 1308 | int data; |
1303 | stream >> when >> channel >> message >> data; | 1309 | stream >> when >> channel >> message >> data; |
1304 | AlarmServer::deleteAlarm( when, channel, message, data ); | 1310 | AlarmServer::deleteAlarm( when, channel, message, data ); |
1305 | } | 1311 | } |
1306 | } | 1312 | } |
1307 | else if ( msg == "clockChange(bool)" ) { | 1313 | else if ( msg == "clockChange(bool)" ) { |
1308 | int tmp; | 1314 | int tmp; |
1309 | stream >> tmp; | 1315 | stream >> tmp; |
1310 | emit clockChanged( tmp ); | 1316 | emit clockChanged( tmp ); |
1311 | } | 1317 | } |
1312 | else if ( msg == "weekChange(bool)" ) { | 1318 | else if ( msg == "weekChange(bool)" ) { |
1313 | int tmp; | 1319 | int tmp; |
1314 | stream >> tmp; | 1320 | stream >> tmp; |
1315 | emit weekChanged( tmp ); | 1321 | emit weekChanged( tmp ); |
1316 | } | 1322 | } |
1317 | else if ( msg == "setDateFormat(DateFormat)" ) { | 1323 | else if ( msg == "setDateFormat(DateFormat)" ) { |
1318 | DateFormat tmp; | 1324 | DateFormat tmp; |
1319 | stream >> tmp; | 1325 | stream >> tmp; |
1320 | emit dateFormatChanged( tmp ); | 1326 | emit dateFormatChanged( tmp ); |
1321 | } | 1327 | } |
1322 | else if ( msg == "setVolume(int,int)" ) { | 1328 | else if ( msg == "setVolume(int,int)" ) { |
1323 | int t, v; | 1329 | int t, v; |
1324 | stream >> t >> v; | 1330 | stream >> t >> v; |
1325 | setVolume( t, v ); | 1331 | setVolume( t, v ); |
1326 | emit volumeChanged( muted ); | 1332 | emit volumeChanged( muted ); |
1327 | } | 1333 | } |
1328 | else if ( msg == "volumeChange(bool)" ) { | 1334 | else if ( msg == "volumeChange(bool)" ) { |
1329 | stream >> muted; | 1335 | stream >> muted; |
1330 | setVolume(); | 1336 | setVolume(); |
1331 | emit volumeChanged( muted ); | 1337 | emit volumeChanged( muted ); |
1332 | } | 1338 | } |
1333 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1339 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1334 | int t, v; | 1340 | int t, v; |
1335 | stream >> t >> v; | 1341 | stream >> t >> v; |
1336 | setMic( t, v ); | 1342 | setMic( t, v ); |
1337 | emit micChanged( micMuted ); | 1343 | emit micChanged( micMuted ); |
1338 | } | 1344 | } |
1339 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1345 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1340 | stream >> micMuted; | 1346 | stream >> micMuted; |
1341 | setMic(); | 1347 | setMic(); |
1342 | emit micChanged( micMuted ); | 1348 | emit micChanged( micMuted ); |
1343 | } | 1349 | } |
1344 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1350 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1345 | int t, v; | 1351 | int t, v; |
1346 | stream >> t >> v; | 1352 | stream >> t >> v; |
1347 | setBass( t, v ); | 1353 | setBass( t, v ); |
1348 | } | 1354 | } |
1349 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1355 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1350 | setBass(); | 1356 | setBass(); |
1351 | } | 1357 | } |
1352 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1358 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1353 | int t, v; | 1359 | int t, v; |
1354 | stream >> t >> v; | 1360 | stream >> t >> v; |
1355 | setTreble( t, v ); | 1361 | setTreble( t, v ); |
1356 | } | 1362 | } |
1357 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1363 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1358 | setTreble(); | 1364 | setTreble(); |
1359 | } else if ( msg == "getMarkedText()" ) { | 1365 | } else if ( msg == "getMarkedText()" ) { |
1360 | if ( type() == GuiServer ) { | 1366 | if ( type() == GuiServer ) { |
1361 | const ushort unicode = 'C'-'@'; | 1367 | const ushort unicode = 'C'-'@'; |
1362 | const int scan = Key_C; | 1368 | const int scan = Key_C; |
1363 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); | 1369 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); |
1364 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); | 1370 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); |
1365 | } | 1371 | } |
1366 | } else if ( msg == "newChannel(QString)") { | 1372 | } else if ( msg == "newChannel(QString)") { |
1367 | QString myChannel = "QPE/Application/" + d->appName; | 1373 | QString myChannel = "QPE/Application/" + d->appName; |
1368 | QString channel; | 1374 | QString channel; |
1369 | stream >> channel; | 1375 | stream >> channel; |
1370 | if (channel == myChannel) { | 1376 | if (channel == myChannel) { |
1371 | processQCopFile(); | 1377 | processQCopFile(); |
1372 | d->sendQCopQ(); | 1378 | d->sendQCopQ(); |
1373 | } | 1379 | } |
1374 | } | 1380 | } |
1375 | 1381 | ||
1376 | 1382 | ||
1377 | #endif | 1383 | #endif |
1378 | } | 1384 | } |
1379 | 1385 | ||
1380 | 1386 | ||
1381 | 1387 | ||
1382 | 1388 | ||
1383 | 1389 | ||
1384 | /*! | 1390 | /*! |
1385 | \internal | 1391 | \internal |
1386 | */ | 1392 | */ |
1387 | bool QPEApplication::raiseAppropriateWindow() | 1393 | bool QPEApplication::raiseAppropriateWindow() |
1388 | { | 1394 | { |
1389 | bool r=FALSE; | 1395 | bool r=FALSE; |
1390 | 1396 | ||
1391 | // 1. Raise the main widget | 1397 | // 1. Raise the main widget |
1392 | QWidget *top = d->qpe_main_widget; | 1398 | QWidget *top = d->qpe_main_widget; |
1393 | if ( !top ) top = mainWidget(); | 1399 | if ( !top ) top = mainWidget(); |
1394 | 1400 | ||
1395 | if ( top && d->keep_running ) { | 1401 | if ( top && d->keep_running ) { |
1396 | if ( top->isVisible() ) | 1402 | if ( top->isVisible() ) |
1397 | r = TRUE; | 1403 | r = TRUE; |
1398 | else if (d->preloaded) { | 1404 | else if (d->preloaded) { |
1399 | // We are preloaded and not visible.. pretend we just started.. | 1405 | // We are preloaded and not visible.. pretend we just started.. |
1400 | #ifndef QT_NO_COP | 1406 | #ifndef QT_NO_COP |
1401 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1407 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1402 | e << d->appName; | 1408 | e << d->appName; |
1403 | #endif | 1409 | #endif |
1404 | } | 1410 | } |
1405 | 1411 | ||
1406 | d->show_mx(top,d->nomaximize, d->appName); | 1412 | d->show_mx(top,d->nomaximize, d->appName); |
1407 | top->raise(); | 1413 | top->raise(); |
1408 | } | 1414 | } |
1409 | 1415 | ||
1410 | QWidget *topm = activeModalWidget(); | 1416 | QWidget *topm = activeModalWidget(); |
1411 | 1417 | ||
1412 | // 2. Raise any parentless widgets (except top and topm, as they | 1418 | // 2. Raise any parentless widgets (except top and topm, as they |
1413 | // are raised before and after this loop). Order from most | 1419 | // are raised before and after this loop). Order from most |
1414 | // recently raised as deepest to least recently as top, so | 1420 | // recently raised as deepest to least recently as top, so |
1415 | // that repeated calls cycle through widgets. | 1421 | // that repeated calls cycle through widgets. |
1416 | QWidgetList *list = topLevelWidgets(); | 1422 | QWidgetList *list = topLevelWidgets(); |
1417 | if ( list ) { | 1423 | if ( list ) { |
1418 | bool foundlast = FALSE; | 1424 | bool foundlast = FALSE; |
1419 | QWidget* topsub = 0; | 1425 | QWidget* topsub = 0; |
1420 | if ( d->lastraised ) { | 1426 | if ( d->lastraised ) { |
1421 | for (QWidget* w = list->first(); w; w = list->next()) { | 1427 | for (QWidget* w = list->first(); w; w = list->next()) { |
1422 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { | 1428 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { |
1423 | if ( w == d->lastraised ) | 1429 | if ( w == d->lastraised ) |
1424 | foundlast = TRUE; | 1430 | foundlast = TRUE; |
1425 | if ( foundlast ) { | 1431 | if ( foundlast ) { |
1426 | w->raise(); | 1432 | w->raise(); |
1427 | topsub = w; | 1433 | topsub = w; |
1428 | } | 1434 | } |
1429 | } | 1435 | } |
1430 | } | 1436 | } |
1431 | } | 1437 | } |
1432 | for (QWidget* w = list->first(); w; w = list->next()) { | 1438 | for (QWidget* w = list->first(); w; w = list->next()) { |
1433 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { | 1439 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { |
1434 | if ( w == d->lastraised ) | 1440 | if ( w == d->lastraised ) |
1435 | break; | 1441 | break; |
1436 | w->raise(); | 1442 | w->raise(); |
1437 | topsub = w; | 1443 | topsub = w; |
1438 | } | 1444 | } |
1439 | } | 1445 | } |
1440 | d->lastraised = topsub; | 1446 | d->lastraised = topsub; |
1441 | delete list; | 1447 | delete list; |
1442 | } | 1448 | } |
1443 | 1449 | ||
1444 | // 3. Raise the active modal widget. | 1450 | // 3. Raise the active modal widget. |
1445 | if ( topm && topm != top ) { | 1451 | if ( topm && topm != top ) { |
1446 | topm->show(); | 1452 | topm->show(); |
1447 | topm->raise(); | 1453 | topm->raise(); |
1448 | // If we haven't already handled the fastAppShowing message | 1454 | // If we haven't already handled the fastAppShowing message |
1449 | if (!top && d->preloaded) { | 1455 | if (!top && d->preloaded) { |
1450 | #ifndef QT_NO_COP | 1456 | #ifndef QT_NO_COP |
1451 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1457 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1452 | e << d->appName; | 1458 | e << d->appName; |
1453 | #endif | 1459 | #endif |
1454 | } | 1460 | } |
1455 | r = FALSE; | 1461 | r = FALSE; |
1456 | } | 1462 | } |
1457 | 1463 | ||
1458 | return r; | 1464 | return r; |
1459 | } | 1465 | } |
1460 | 1466 | ||
1461 | 1467 | ||
1462 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | 1468 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) |
1463 | { | 1469 | { |
1464 | #ifdef Q_WS_QWS | 1470 | #ifdef Q_WS_QWS |
1465 | 1471 | ||
1466 | if ( msg == "quit()" ) { | 1472 | if ( msg == "quit()" ) { |
1467 | tryQuit(); | 1473 | tryQuit(); |
1468 | } | 1474 | } |
1469 | else if ( msg == "quitIfInvisible()" ) { | 1475 | else if ( msg == "quitIfInvisible()" ) { |
1470 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) | 1476 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) |
1471 | quit(); | 1477 | quit(); |
1472 | } | 1478 | } |
1473 | else if ( msg == "close()" ) { | 1479 | else if ( msg == "close()" ) { |
1474 | hideOrQuit(); | 1480 | hideOrQuit(); |
1475 | } | 1481 | } |
1476 | else if ( msg == "disablePreload()" ) { | 1482 | else if ( msg == "disablePreload()" ) { |
1477 | d->preloaded = FALSE; | 1483 | d->preloaded = FALSE; |
1478 | d->keep_running = TRUE; | 1484 | d->keep_running = TRUE; |
1479 | /* so that quit will quit */ | 1485 | /* so that quit will quit */ |
1480 | } | 1486 | } |
1481 | else if ( msg == "enablePreload()" ) { | 1487 | else if ( msg == "enablePreload()" ) { |
1482 | if (d->qpe_main_widget) | 1488 | if (d->qpe_main_widget) |
1483 | d->preloaded = TRUE; | 1489 | d->preloaded = TRUE; |
1484 | d->keep_running = TRUE; | 1490 | d->keep_running = TRUE; |
1485 | /* so next quit won't quit */ | 1491 | /* so next quit won't quit */ |
1486 | } | 1492 | } |
1487 | else if ( msg == "raise()" ) { | 1493 | else if ( msg == "raise()" ) { |
1488 | d->keep_running = TRUE; | 1494 | d->keep_running = TRUE; |
1489 | d->notbusysent = FALSE; | 1495 | d->notbusysent = FALSE; |
1490 | raiseAppropriateWindow(); | 1496 | raiseAppropriateWindow(); |
1491 | // Tell the system we're still chugging along... | 1497 | // Tell the system we're still chugging along... |
1492 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1498 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1493 | e << d->appName; | 1499 | e << d->appName; |
1494 | } | 1500 | } |
1495 | else if ( msg == "flush()" ) { | 1501 | else if ( msg == "flush()" ) { |
1496 | emit flush(); | 1502 | emit flush(); |
1497 | // we need to tell the desktop | 1503 | // we need to tell the desktop |
1498 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 1504 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
1499 | e << d->appName; | 1505 | e << d->appName; |
1500 | } | 1506 | } |
1501 | else if ( msg == "reload()" ) { | 1507 | else if ( msg == "reload()" ) { |
1502 | emit reload(); | 1508 | emit reload(); |
1503 | } | 1509 | } |
1504 | else if ( msg == "setDocument(QString)" ) { | 1510 | else if ( msg == "setDocument(QString)" ) { |
1505 | d->keep_running = TRUE; | 1511 | d->keep_running = TRUE; |
1506 | QDataStream stream( data, IO_ReadOnly ); | 1512 | QDataStream stream( data, IO_ReadOnly ); |
1507 | QString doc; | 1513 | QString doc; |
1508 | stream >> doc; | 1514 | stream >> doc; |
1509 | QWidget *mw = mainWidget(); | 1515 | QWidget *mw = mainWidget(); |
1510 | if ( !mw ) | 1516 | if ( !mw ) |
1511 | mw = d->qpe_main_widget; | 1517 | mw = d->qpe_main_widget; |
1512 | if ( mw ) | 1518 | if ( mw ) |
1513 | Global::setDocument( mw, doc ); | 1519 | Global::setDocument( mw, doc ); |
1514 | 1520 | ||
1515 | } else if ( msg == "QPEProcessQCop()" ) { | 1521 | } else if ( msg == "QPEProcessQCop()" ) { |
1516 | processQCopFile(); | 1522 | processQCopFile(); |
1517 | d->sendQCopQ(); | 1523 | d->sendQCopQ(); |
1518 | }else | 1524 | }else |
1519 | { | 1525 | { |
1520 | bool p = d->keep_running; | 1526 | bool p = d->keep_running; |
1521 | d->keep_running = FALSE; | 1527 | d->keep_running = FALSE; |
1522 | emit appMessage( msg, data); | 1528 | emit appMessage( msg, data); |
1523 | if ( d->keep_running ) { | 1529 | if ( d->keep_running ) { |
1524 | d->notbusysent = FALSE; | 1530 | d->notbusysent = FALSE; |
1525 | raiseAppropriateWindow(); | 1531 | raiseAppropriateWindow(); |
1526 | if ( !p ) { | 1532 | if ( !p ) { |
1527 | // Tell the system we're still chugging along... | 1533 | // Tell the system we're still chugging along... |
1528 | #ifndef QT_NO_COP | 1534 | #ifndef QT_NO_COP |
1529 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1535 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1530 | e << d->appName; | 1536 | e << d->appName; |
1531 | #endif | 1537 | #endif |
1532 | } | 1538 | } |
1533 | } | 1539 | } |
1534 | if ( p ) | 1540 | if ( p ) |
1535 | d->keep_running = p; | 1541 | d->keep_running = p; |
1536 | } | 1542 | } |
1537 | #endif | 1543 | #endif |
1538 | } | 1544 | } |
1539 | 1545 | ||
1540 | 1546 | ||
1541 | /*! | 1547 | /*! |
1542 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1548 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1543 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1549 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1544 | 1550 | ||
1545 | \sa showMainDocumentWidget() | 1551 | \sa showMainDocumentWidget() |
1546 | */ | 1552 | */ |
1547 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1553 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1548 | { | 1554 | { |
1549 | d->show(mw, nomaximize ); | 1555 | d->show(mw, nomaximize ); |
1550 | } | 1556 | } |
1551 | 1557 | ||
1552 | /*! | 1558 | /*! |
1553 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1559 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1554 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1560 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1555 | 1561 | ||
1556 | This calls designates the application as | 1562 | This calls designates the application as |
1557 | a \link docwidget.html document-oriented\endlink application. | 1563 | a \link docwidget.html document-oriented\endlink application. |
1558 | 1564 | ||
1559 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1565 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1560 | 1566 | ||
1561 | \sa showMainWidget() | 1567 | \sa showMainWidget() |
1562 | */ | 1568 | */ |
1563 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1569 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1564 | { | 1570 | { |
1565 | if ( mw && argc() == 2 ) | 1571 | if ( mw && argc() == 2 ) |
1566 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1572 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1567 | 1573 | ||
1568 | 1574 | ||
1569 | d->show(mw, nomaximize ); | 1575 | d->show(mw, nomaximize ); |
1570 | } | 1576 | } |
1571 | 1577 | ||
1572 | 1578 | ||
1573 | /*! | 1579 | /*! |
1574 | If an application is started via a \link qcop.html QCop\endlink | 1580 | If an application is started via a \link qcop.html QCop\endlink |
1575 | message, the application will process the \link qcop.html | 1581 | message, the application will process the \link qcop.html |
1576 | QCop\endlink message and then quit. If the application calls this | 1582 | QCop\endlink message and then quit. If the application calls this |
1577 | function while processing a \link qcop.html QCop\endlink message, | 1583 | function while processing a \link qcop.html QCop\endlink message, |
1578 | after processing its outstanding \link qcop.html QCop\endlink | 1584 | after processing its outstanding \link qcop.html QCop\endlink |
1579 | messages the application will start 'properly' and show itself. | 1585 | messages the application will start 'properly' and show itself. |
1580 | 1586 | ||
1581 | \sa keepRunning() | 1587 | \sa keepRunning() |
1582 | */ | 1588 | */ |
1583 | void QPEApplication::setKeepRunning() | 1589 | void QPEApplication::setKeepRunning() |
1584 | { | 1590 | { |
1585 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1591 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1586 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1592 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1587 | qpeApp->d->keep_running = TRUE; | 1593 | qpeApp->d->keep_running = TRUE; |
1588 | } | 1594 | } |
1589 | } | 1595 | } |
1590 | 1596 | ||
1591 | /*! | 1597 | /*! |
1592 | Returns TRUE if the application will quit after processing the | 1598 | Returns TRUE if the application will quit after processing the |
1593 | current list of qcop messages; otherwise returns FALSE. | 1599 | current list of qcop messages; otherwise returns FALSE. |
1594 | 1600 | ||
1595 | \sa setKeepRunning() | 1601 | \sa setKeepRunning() |
1596 | */ | 1602 | */ |
1597 | bool QPEApplication::keepRunning() const | 1603 | bool QPEApplication::keepRunning() const |
1598 | { | 1604 | { |
1599 | return d->keep_running; | 1605 | return d->keep_running; |
1600 | } | 1606 | } |
1601 | 1607 | ||
1602 | /*! | 1608 | /*! |
1603 | \internal | 1609 | \internal |
1604 | */ | 1610 | */ |
1605 | void QPEApplication::internalSetStyle( const QString &style ) | 1611 | void QPEApplication::internalSetStyle( const QString &style ) |
1606 | { | 1612 | { |
1607 | #if QT_VERSION >= 300 | 1613 | #if QT_VERSION >= 300 |
1608 | if ( style == "QPE" ) { | 1614 | if ( style == "QPE" ) { |
1609 | setStyle( new QPEStyle ); | 1615 | setStyle( new QPEStyle ); |
1610 | } | 1616 | } |
1611 | else { | 1617 | else { |
1612 | QStyle *s = QStyleFactory::create( style ); | 1618 | QStyle *s = QStyleFactory::create( style ); |
1613 | if ( s ) | 1619 | if ( s ) |
1614 | setStyle( s ); | 1620 | setStyle( s ); |
1615 | } | 1621 | } |
1616 | #else | 1622 | #else |
1617 | if ( style == "Windows" ) { | 1623 | if ( style == "Windows" ) { |
1618 | setStyle( new QWindowsStyle ); | 1624 | setStyle( new QWindowsStyle ); |
1619 | } | 1625 | } |
1620 | else if ( style == "QPE" ) { | 1626 | else if ( style == "QPE" ) { |
1621 | setStyle( new QPEStyle ); | 1627 | setStyle( new QPEStyle ); |
1622 | } | 1628 | } |
1623 | else if ( style == "Light" ) { | 1629 | else if ( style == "Light" ) { |
1624 | setStyle( new LightStyle ); | 1630 | setStyle( new LightStyle ); |
1625 | } | 1631 | } |
1626 | #ifndef QT_NO_STYLE_PLATINUM | 1632 | #ifndef QT_NO_STYLE_PLATINUM |
1627 | else if ( style == "Platinum" ) { | 1633 | else if ( style == "Platinum" ) { |
1628 | setStyle( new QPlatinumStyle ); | 1634 | setStyle( new QPlatinumStyle ); |
1629 | } | 1635 | } |
1630 | #endif | 1636 | #endif |
1631 | #ifndef QT_NO_STYLE_MOTIF | 1637 | #ifndef QT_NO_STYLE_MOTIF |
1632 | else if ( style == "Motif" ) { | 1638 | else if ( style == "Motif" ) { |
1633 | setStyle( new QMotifStyle ); | 1639 | setStyle( new QMotifStyle ); |
1634 | } | 1640 | } |
1635 | #endif | 1641 | #endif |
1636 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1642 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1637 | else if ( style == "MotifPlus" ) { | 1643 | else if ( style == "MotifPlus" ) { |
1638 | setStyle( new QMotifPlusStyle ); | 1644 | setStyle( new QMotifPlusStyle ); |
1639 | } | 1645 | } |
1640 | #endif | 1646 | #endif |
1641 | 1647 | ||
1642 | else { | 1648 | else { |
1643 | QStyle *sty = 0; | 1649 | QStyle *sty = 0; |
1644 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1650 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1645 | 1651 | ||
1646 | if ( style. find ( ".so" ) > 0 ) | 1652 | if ( style. find ( ".so" ) > 0 ) |
1647 | path += style; | 1653 | path += style; |
1648 | else | 1654 | else |
1649 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1655 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1650 | 1656 | ||
1651 | static QLibrary *lastlib = 0; | 1657 | static QLibrary *lastlib = 0; |
1652 | static StyleInterface *lastiface = 0; | 1658 | static StyleInterface *lastiface = 0; |
1653 | 1659 | ||
1654 | QLibrary *lib = new QLibrary ( path ); | 1660 | QLibrary *lib = new QLibrary ( path ); |
1655 | StyleInterface *iface = 0; | 1661 | StyleInterface *iface = 0; |
1656 | 1662 | ||
1657 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1663 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1658 | sty = iface-> style ( ); | 1664 | sty = iface-> style ( ); |
1659 | 1665 | ||
1660 | if ( sty ) { | 1666 | if ( sty ) { |
1661 | setStyle ( sty ); | 1667 | setStyle ( sty ); |
1662 | 1668 | ||
1663 | if ( lastiface ) | 1669 | if ( lastiface ) |
1664 | lastiface-> release ( ); | 1670 | lastiface-> release ( ); |
1665 | lastiface = iface; | 1671 | lastiface = iface; |
1666 | 1672 | ||
1667 | if ( lastlib ) { | 1673 | if ( lastlib ) { |
1668 | lastlib-> unload ( ); | 1674 | lastlib-> unload ( ); |
1669 | delete lastlib; | 1675 | delete lastlib; |
1670 | } | 1676 | } |
1671 | lastlib = lib; | 1677 | lastlib = lib; |
1672 | } | 1678 | } |
1673 | else { | 1679 | else { |
1674 | if ( iface ) | 1680 | if ( iface ) |
1675 | iface-> release ( ); | 1681 | iface-> release ( ); |
1676 | delete lib; | 1682 | delete lib; |
1677 | 1683 | ||
1678 | setStyle ( new LightStyle ( )); | 1684 | setStyle ( new LightStyle ( )); |
1679 | } | 1685 | } |
1680 | } | 1686 | } |
1681 | #endif | 1687 | #endif |
1682 | } | 1688 | } |
1683 | 1689 | ||
1684 | /*! | 1690 | /*! |
1685 | \internal | 1691 | \internal |
1686 | */ | 1692 | */ |
1687 | void QPEApplication::prepareForTermination( bool willrestart ) | 1693 | void QPEApplication::prepareForTermination( bool willrestart ) |
1688 | { | 1694 | { |
1689 | if ( willrestart ) { | 1695 | if ( willrestart ) { |
1690 | // Draw a big wait icon, the image can be altered in later revisions | 1696 | // Draw a big wait icon, the image can be altered in later revisions |
1691 | // QWidget *d = QApplication::desktop(); | 1697 | // QWidget *d = QApplication::desktop(); |
1692 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 1698 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
1693 | QPixmap pix; | 1699 | QPixmap pix; |
1694 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 1700 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
1695 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 1701 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
1696 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1702 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1697 | lblWait->setPixmap( pix ); | 1703 | lblWait->setPixmap( pix ); |
1698 | lblWait->setAlignment( QWidget::AlignCenter ); | 1704 | lblWait->setAlignment( QWidget::AlignCenter ); |
1699 | lblWait->show(); | 1705 | lblWait->show(); |
1700 | lblWait->showMaximized(); | 1706 | lblWait->showMaximized(); |
1701 | } | 1707 | } |
1702 | #ifndef SINGLE_APP | 1708 | #ifndef SINGLE_APP |
1703 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1709 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1704 | } | 1710 | } |
1705 | processEvents(); // ensure the message goes out. | 1711 | processEvents(); // ensure the message goes out. |
1706 | sleep( 1 ); // You have 1 second to comply. | 1712 | sleep( 1 ); // You have 1 second to comply. |
1707 | #endif | 1713 | #endif |
1708 | } | 1714 | } |
1709 | 1715 | ||
1710 | /*! | 1716 | /*! |
1711 | \internal | 1717 | \internal |
1712 | */ | 1718 | */ |
1713 | void QPEApplication::shutdown() | 1719 | void QPEApplication::shutdown() |
1714 | { | 1720 | { |
1715 | // Implement in server's QPEApplication subclass | 1721 | // Implement in server's QPEApplication subclass |
1716 | } | 1722 | } |
1717 | 1723 | ||
1718 | /*! | 1724 | /*! |
1719 | \internal | 1725 | \internal |
1720 | */ | 1726 | */ |
1721 | void QPEApplication::restart() | 1727 | void QPEApplication::restart() |
1722 | { | 1728 | { |
1723 | // Implement in server's QPEApplication subclass | 1729 | // Implement in server's QPEApplication subclass |
1724 | } | 1730 | } |
1725 | 1731 | ||
1726 | static QPtrDict<void>* stylusDict = 0; | 1732 | static QPtrDict<void>* stylusDict = 0; |
1727 | static void createDict() | 1733 | static void createDict() |
1728 | { | 1734 | { |
1729 | if ( !stylusDict ) | 1735 | if ( !stylusDict ) |
1730 | stylusDict = new QPtrDict<void>; | 1736 | stylusDict = new QPtrDict<void>; |
1731 | } | 1737 | } |
1732 | 1738 | ||
1733 | /*! | 1739 | /*! |
1734 | Returns the current StylusMode for widget \a w. | 1740 | Returns the current StylusMode for widget \a w. |
1735 | 1741 | ||
1736 | \sa setStylusOperation() StylusMode | 1742 | \sa setStylusOperation() StylusMode |
1737 | */ | 1743 | */ |
1738 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1744 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1739 | { | 1745 | { |
1740 | if ( stylusDict ) | 1746 | if ( stylusDict ) |
1741 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1747 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
1742 | return LeftOnly; | 1748 | return LeftOnly; |
1743 | } | 1749 | } |
1744 | 1750 | ||
1745 | /*! | 1751 | /*! |
1746 | \enum QPEApplication::StylusMode | 1752 | \enum QPEApplication::StylusMode |
1747 | 1753 | ||
1748 | \value LeftOnly the stylus only generates LeftButton | 1754 | \value LeftOnly the stylus only generates LeftButton |
1749 | events (the default). | 1755 | events (the default). |
1750 | \value RightOnHold the stylus generates RightButton events | 1756 | \value RightOnHold the stylus generates RightButton events |
1751 | if the user uses the press-and-hold gesture. | 1757 | if the user uses the press-and-hold gesture. |
1752 | 1758 | ||
1753 | \sa setStylusOperation() stylusOperation() | 1759 | \sa setStylusOperation() stylusOperation() |
1754 | */ | 1760 | */ |
1755 | 1761 | ||
1756 | /*! | 1762 | /*! |
1757 | Causes widget \a w to receive mouse events according to the stylus | 1763 | Causes widget \a w to receive mouse events according to the stylus |
1758 | \a mode. | 1764 | \a mode. |
1759 | 1765 | ||
1760 | \sa stylusOperation() StylusMode | 1766 | \sa stylusOperation() StylusMode |
1761 | */ | 1767 | */ |
1762 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) | 1768 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) |
1763 | { | 1769 | { |
1764 | createDict(); | 1770 | createDict(); |
1765 | if ( mode == LeftOnly ) { | 1771 | if ( mode == LeftOnly ) { |
1766 | stylusDict->remove | 1772 | stylusDict->remove |
1767 | ( w ); | 1773 | ( w ); |
1768 | w->removeEventFilter( qApp ); | 1774 | w->removeEventFilter( qApp ); |
1769 | } | 1775 | } |
1770 | else { | 1776 | else { |
1771 | stylusDict->insert( w, ( void* ) mode ); | 1777 | stylusDict->insert( w, ( void* ) mode ); |
1772 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 1778 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
1773 | w->installEventFilter( qApp ); | 1779 | w->installEventFilter( qApp ); |
1774 | } | 1780 | } |
1775 | } | 1781 | } |
1776 | 1782 | ||
1777 | 1783 | ||
1778 | /*! | 1784 | /*! |
1779 | \reimp | 1785 | \reimp |
1780 | */ | 1786 | */ |
1781 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | 1787 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) |
1782 | { | 1788 | { |
1783 | if ( !o->isWidgetType() ) | 1789 | if ( !o->isWidgetType() ) |
1784 | return FALSE; | 1790 | return FALSE; |
1785 | 1791 | ||
1786 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 1792 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
1787 | QMouseEvent * me = ( QMouseEvent* ) e; | 1793 | QMouseEvent * me = ( QMouseEvent* ) e; |
1788 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 1794 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
1789 | switch (mode) { | 1795 | switch (mode) { |
1790 | case RightOnHold: | 1796 | case RightOnHold: |
1791 | switch ( me->type() ) { | 1797 | switch ( me->type() ) { |
1792 | case QEvent::MouseButtonPress: | 1798 | case QEvent::MouseButtonPress: |
1793 | if ( me->button() == LeftButton ) { | 1799 | if ( me->button() == LeftButton ) { |
1794 | if (!d->presstimer ) | 1800 | if (!d->presstimer ) |
1795 | d->presstimer = startTimer(500); // #### pref. | 1801 | d->presstimer = startTimer(500); // #### pref. |
1796 | d->presswidget = (QWidget*)o; | 1802 | d->presswidget = (QWidget*)o; |
1797 | d->presspos = me->pos(); | 1803 | d->presspos = me->pos(); |
1798 | d->rightpressed = FALSE; | 1804 | d->rightpressed = FALSE; |
1799 | } | 1805 | } |
1800 | break; | 1806 | break; |
1801 | case QEvent::MouseMove: | 1807 | case QEvent::MouseMove: |
1802 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 1808 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
1803 | killTimer(d->presstimer); | 1809 | killTimer(d->presstimer); |
1804 | d->presstimer = 0; | 1810 | d->presstimer = 0; |
1805 | } | 1811 | } |
1806 | break; | 1812 | break; |
1807 | case QEvent::MouseButtonRelease: | 1813 | case QEvent::MouseButtonRelease: |
1808 | if ( me->button() == LeftButton ) { | 1814 | if ( me->button() == LeftButton ) { |
1809 | if ( d->presstimer ) { | 1815 | if ( d->presstimer ) { |
1810 | killTimer(d->presstimer); | 1816 | killTimer(d->presstimer); |
1811 | d->presstimer = 0; | 1817 | d->presstimer = 0; |
1812 | } | 1818 | } |
1813 | if ( d->rightpressed && d->presswidget ) { | 1819 | if ( d->rightpressed && d->presswidget ) { |
1814 | // Right released | 1820 | // Right released |
1815 | postEvent( d->presswidget, | 1821 | postEvent( d->presswidget, |
1816 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 1822 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
1817 | RightButton, LeftButton + RightButton ) ); | 1823 | RightButton, LeftButton + RightButton ) ); |
1818 | // Left released, off-widget | 1824 | // Left released, off-widget |
1819 | postEvent( d->presswidget, | 1825 | postEvent( d->presswidget, |
1820 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), | 1826 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), |
1821 | LeftButton, LeftButton ) ); | 1827 | LeftButton, LeftButton ) ); |
1822 | postEvent( d->presswidget, | 1828 | postEvent( d->presswidget, |
1823 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), | 1829 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), |
1824 | LeftButton, LeftButton ) ); | 1830 | LeftButton, LeftButton ) ); |
1825 | d->rightpressed = FALSE; | 1831 | d->rightpressed = FALSE; |
1826 | return TRUE; // don't send the real Left release | 1832 | return TRUE; // don't send the real Left release |
1827 | } | 1833 | } |
1828 | } | 1834 | } |
1829 | break; | 1835 | break; |
1830 | default: | 1836 | default: |
1831 | break; | 1837 | break; |
1832 | } | 1838 | } |
1833 | break; | 1839 | break; |
1834 | default: | 1840 | default: |
1835 | ; | 1841 | ; |
1836 | } | 1842 | } |
1837 | } | 1843 | } |
1838 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1844 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1839 | QKeyEvent *ke = (QKeyEvent *)e; | 1845 | QKeyEvent *ke = (QKeyEvent *)e; |
1840 | if ( ke->key() == Key_Enter ) { | 1846 | if ( ke->key() == Key_Enter ) { |
1841 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { | 1847 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { |
1842 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', | 1848 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', |
1843 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); | 1849 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); |
1844 | return TRUE; | 1850 | return TRUE; |
1845 | } | 1851 | } |
1846 | } | 1852 | } |
1847 | } | 1853 | } |
1848 | return FALSE; | 1854 | return FALSE; |
1849 | } | 1855 | } |
1850 | 1856 | ||
1851 | /*! | 1857 | /*! |
1852 | \reimp | 1858 | \reimp |
1853 | */ | 1859 | */ |
1854 | void QPEApplication::timerEvent( QTimerEvent *e ) | 1860 | void QPEApplication::timerEvent( QTimerEvent *e ) |
1855 | { | 1861 | { |
1856 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 1862 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
1857 | // Right pressed | 1863 | // Right pressed |
1858 | postEvent( d->presswidget, | 1864 | postEvent( d->presswidget, |
1859 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 1865 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
1860 | RightButton, LeftButton ) ); | 1866 | RightButton, LeftButton ) ); |
1861 | killTimer( d->presstimer ); | 1867 | killTimer( d->presstimer ); |
1862 | d->presstimer = 0; | 1868 | d->presstimer = 0; |
1863 | d->rightpressed = TRUE; | 1869 | d->rightpressed = TRUE; |
1864 | } | 1870 | } |
1865 | } | 1871 | } |
1866 | 1872 | ||
1867 | void QPEApplication::removeSenderFromStylusDict() | 1873 | void QPEApplication::removeSenderFromStylusDict() |
1868 | { | 1874 | { |
1869 | stylusDict->remove | 1875 | stylusDict->remove |
1870 | ( ( void* ) sender() ); | 1876 | ( ( void* ) sender() ); |
1871 | if ( d->presswidget == sender() ) | 1877 | if ( d->presswidget == sender() ) |
1872 | d->presswidget = 0; | 1878 | d->presswidget = 0; |
1873 | } | 1879 | } |
1874 | 1880 | ||
1875 | /*! | 1881 | /*! |
1876 | \internal | 1882 | \internal |
1877 | */ | 1883 | */ |
1878 | bool QPEApplication::keyboardGrabbed() const | 1884 | bool QPEApplication::keyboardGrabbed() const |
1879 | { | 1885 | { |
1880 | return d->kbgrabbed; | 1886 | return d->kbgrabbed; |
1881 | } | 1887 | } |
1882 | 1888 | ||
1883 | 1889 | ||
1884 | /*! | 1890 | /*! |
1885 | Reverses the effect of grabKeyboard(). This is called automatically | 1891 | Reverses the effect of grabKeyboard(). This is called automatically |
1886 | on program exit. | 1892 | on program exit. |
1887 | */ | 1893 | */ |
1888 | void QPEApplication::ungrabKeyboard() | 1894 | void QPEApplication::ungrabKeyboard() |
1889 | { | 1895 | { |
1890 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; | 1896 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; |
1891 | } | 1897 | } |
1892 | 1898 | ||
1893 | /*! | 1899 | /*! |
1894 | Grabs the physical keyboard keys, e.g. the application's launching | 1900 | Grabs the physical keyboard keys, e.g. the application's launching |
1895 | keys. Instead of launching applications when these keys are pressed | 1901 | keys. Instead of launching applications when these keys are pressed |
1896 | the signals emitted are sent to this application instead. Some games | 1902 | the signals emitted are sent to this application instead. Some games |
1897 | programs take over the launch keys in this way to make interaction | 1903 | programs take over the launch keys in this way to make interaction |
1898 | easier. | 1904 | easier. |
1899 | 1905 | ||
1900 | \sa ungrabKeyboard() | 1906 | \sa ungrabKeyboard() |
1901 | */ | 1907 | */ |
1902 | void QPEApplication::grabKeyboard() | 1908 | void QPEApplication::grabKeyboard() |
1903 | { | 1909 | { |
1904 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; | 1910 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; |
1905 | } | 1911 | } |
1906 | 1912 | ||
1907 | /*! | 1913 | /*! |
1908 | \reimp | 1914 | \reimp |
1909 | */ | 1915 | */ |
1910 | int QPEApplication::exec() | 1916 | int QPEApplication::exec() |
1911 | { | 1917 | { |
1912 | d->qcopQok = true; | 1918 | d->qcopQok = true; |
1913 | #ifndef QT_NO_COP | 1919 | #ifndef QT_NO_COP |
1914 | d->sendQCopQ(); | 1920 | d->sendQCopQ(); |
1915 | if ( !d->keep_running ) | 1921 | if ( !d->keep_running ) |
1916 | processEvents(); // we may have received QCop messages in the meantime. | 1922 | processEvents(); // we may have received QCop messages in the meantime. |
1917 | #endif | 1923 | #endif |
1918 | 1924 | ||
1919 | if ( d->keep_running ) | 1925 | if ( d->keep_running ) |
1920 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) | 1926 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) |
1921 | return QApplication::exec(); | 1927 | return QApplication::exec(); |
1922 | 1928 | ||
1923 | #ifndef QT_NO_COP | 1929 | #ifndef QT_NO_COP |
1924 | 1930 | ||
1925 | { | 1931 | { |
1926 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1932 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1927 | e << d->appName; | 1933 | e << d->appName; |
1928 | } | 1934 | } |
1929 | #endif | 1935 | #endif |
1930 | processEvents(); | 1936 | processEvents(); |
1931 | return 0; | 1937 | return 0; |
1932 | } | 1938 | } |
1933 | 1939 | ||
1934 | /*! | 1940 | /*! |
1935 | \internal | 1941 | \internal |
1936 | External request for application to quit. Quits if possible without | 1942 | External request for application to quit. Quits if possible without |
1937 | loosing state. | 1943 | loosing state. |
1938 | */ | 1944 | */ |
1939 | void QPEApplication::tryQuit() | 1945 | void QPEApplication::tryQuit() |
1940 | { | 1946 | { |
1941 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 1947 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
1942 | return ; // Inside modal loop or konsole. Too hard to save state. | 1948 | return ; // Inside modal loop or konsole. Too hard to save state. |
1943 | #ifndef QT_NO_COP | 1949 | #ifndef QT_NO_COP |
1944 | 1950 | ||
1945 | { | 1951 | { |
1946 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1952 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1947 | e << d->appName; | 1953 | e << d->appName; |
1948 | } | 1954 | } |
1949 | #endif | 1955 | #endif |
1950 | processEvents(); | 1956 | processEvents(); |
1951 | 1957 | ||
1952 | quit(); | 1958 | quit(); |
1953 | } | 1959 | } |
1954 | 1960 | ||
1955 | /*! | 1961 | /*! |
1956 | \internal | 1962 | \internal |
1957 | */ | 1963 | */ |
1958 | void QPEApplication::installTranslation( const QString& baseName ) { | 1964 | void QPEApplication::installTranslation( const QString& baseName ) { |
1959 | QTranslator* trans = new QTranslator(this); | 1965 | QTranslator* trans = new QTranslator(this); |
1960 | QString tfn = qpeDir() + "/i18n/"+baseName; | 1966 | QString tfn = qpeDir() + "/i18n/"+baseName; |
1961 | if ( trans->load( tfn ) ) | 1967 | if ( trans->load( tfn ) ) |
1962 | installTranslator( trans ); | 1968 | installTranslator( trans ); |
1963 | else | 1969 | else |
1964 | delete trans; | 1970 | delete trans; |
1965 | } | 1971 | } |
1966 | 1972 | ||
1967 | /*! | 1973 | /*! |
1968 | \internal | 1974 | \internal |
diff --git a/library/qt_override.cpp b/library/qt_override.cpp index edda874..df5a419 100644 --- a/library/qt_override.cpp +++ b/library/qt_override.cpp | |||
@@ -1,171 +1,177 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qwsdecoration_qws.h> | 3 | #include <qwsdecoration_qws.h> |
4 | #include <qcommonstyle.h> | 4 | #include <qcommonstyle.h> |
5 | #include <qfontdatabase.h> | 5 | #include <qfontdatabase.h> |
6 | 6 | ||
7 | #include <unistd.h> | 7 | #include <unistd.h> |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
10 | #include <limits.h> | 10 | #include <limits.h> |
11 | #include <sys/param.h> // for toolchains with old libc headers | 11 | #include <sys/param.h> // for toolchains with old libc headers |
12 | 12 | ||
13 | #include "qt_override_p.h" | 13 | #include "qt_override_p.h" |
14 | 14 | ||
15 | #if QT_VERSION > 233 | 15 | #if QT_VERSION > 233 |
16 | 16 | ||
17 | struct color_fix_t { | 17 | struct color_fix_t { |
18 | char *m_app; | 18 | char *m_app; |
19 | char *m_class; | 19 | char *m_class; |
20 | char *m_name; | 20 | char *m_name; |
21 | QColorGroup::ColorRole m_set; | 21 | QColorGroup::ColorRole m_set; |
22 | QColorGroup::ColorRole m_get; | 22 | QColorGroup::ColorRole m_get; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | 25 | #ifndef OPIE_NO_OVERRIDE_QT | |
26 | 26 | ||
27 | static const color_fix_t apps_that_need_special_colors [] = { | 27 | static const color_fix_t apps_that_need_special_colors [] = { |
28 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, | 28 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, |
29 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, | 29 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, |
30 | 30 | ||
31 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } | 31 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static const char * const apps_that_need_pointsizes_times_10 [] = { | 34 | static const char * const apps_that_need_pointsizes_times_10 [] = { |
35 | "HancomMobileWord", | 35 | "HancomMobileWord", |
36 | "hancomsheet", | 36 | "hancomsheet", |
37 | "HancomPresenterViewer", | 37 | "HancomPresenterViewer", |
38 | 38 | ||
39 | 0 | 39 | 0 |
40 | }; | 40 | }; |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | int Opie::force_appearance = 0; | 45 | int Opie::force_appearance = 0; |
46 | 46 | ||
47 | 47 | ||
48 | // Return the *real* name of the binary - not just a quick guess | 48 | // Return the *real* name of the binary - not just a quick guess |
49 | // by looking at argv [0] (which could be anything) | 49 | // by looking at argv [0] (which could be anything) |
50 | 50 | ||
51 | static void binaryNameFree ( ) | 51 | static void binaryNameFree ( ) |
52 | { | 52 | { |
53 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here | 53 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here |
54 | } | 54 | } |
55 | 55 | ||
56 | const char *Opie::binaryName ( ) | 56 | const char *Opie::binaryName ( ) |
57 | { | 57 | { |
58 | static const char *appname = 0; | 58 | static const char *appname = 0; |
59 | 59 | ||
60 | if ( !appname ) { | 60 | if ( !appname ) { |
61 | char dst [PATH_MAX + 1]; | 61 | char dst [PATH_MAX + 1]; |
62 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); | 62 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); |
63 | 63 | ||
64 | if ( l <= 0 ) | 64 | if ( l <= 0 ) |
65 | l = 0; | 65 | l = 0; |
66 | 66 | ||
67 | dst [l] = 0; | 67 | dst [l] = 0; |
68 | const char *b = ::strrchr ( dst, '/' ); | 68 | const char *b = ::strrchr ( dst, '/' ); |
69 | appname = ::strdup ( b ? b + 1 : dst ); | 69 | appname = ::strdup ( b ? b + 1 : dst ); |
70 | 70 | ||
71 | ::atexit ( binaryNameFree ); | 71 | ::atexit ( binaryNameFree ); |
72 | } | 72 | } |
73 | return appname; | 73 | return appname; |
74 | } | 74 | } |
75 | 75 | ||
76 | #else | ||
77 | int Opie::force_appearance = 0; | ||
78 | #endif | ||
76 | 79 | ||
77 | // Fix for a toolchain incompatibility (binaries compiled with | 80 | // Fix for a toolchain incompatibility (binaries compiled with |
78 | // old tcs using shared libs compiled with newer tcs) | 81 | // old tcs using shared libs compiled with newer tcs) |
79 | 82 | ||
80 | extern "C" { | 83 | extern "C" { |
81 | 84 | ||
82 | extern void __gmon_start__ ( ) __attribute__(( weak )); | 85 | extern void __gmon_start__ ( ) __attribute__(( weak )); |
83 | 86 | ||
84 | extern void __gmon_start__ ( ) | 87 | extern void __gmon_start__ ( ) |
85 | { | 88 | { |
86 | } | 89 | } |
87 | 90 | ||
88 | } | 91 | } |
89 | 92 | ||
90 | 93 | ||
91 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles | 94 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles |
92 | // that set a background pixmap (it would be easier to fix eraseRect(), but | 95 | // that set a background pixmap (it would be easier to fix eraseRect(), but |
93 | // TT made it an inline ...) | 96 | // TT made it an inline ...) |
94 | 97 | ||
95 | void QPEApplication::polish ( QWidget *w ) | 98 | void QPEApplication::polish ( QWidget *w ) |
96 | { | 99 | { |
100 | #ifndef OPIE_NO_OVERRIDE_QT | ||
97 | //qDebug ( "QPEApplication::polish()" ); | 101 | //qDebug ( "QPEApplication::polish()" ); |
98 | 102 | ||
99 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { | 103 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { |
100 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && | 104 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && |
101 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && | 105 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && |
102 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { | 106 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { |
103 | QPalette pal = w-> palette ( ); | 107 | QPalette pal = w-> palette ( ); |
104 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); | 108 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); |
105 | w-> setPalette ( pal ); | 109 | w-> setPalette ( pal ); |
106 | } | 110 | } |
107 | } | 111 | } |
112 | #endif | ||
108 | QApplication::polish ( w ); | 113 | QApplication::polish ( w ); |
109 | } | 114 | } |
110 | 115 | ||
111 | 116 | ||
117 | #ifndef OPIE_NO_OVERRIDE_QT | ||
112 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes | 118 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes |
113 | // were multiplied by 10 (which was incorrect) | 119 | // were multiplied by 10 (which was incorrect) |
114 | 120 | ||
115 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) | 121 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) |
116 | { | 122 | { |
117 | //qDebug ( "QFontDatabase::pointSizes()" ); | 123 | //qDebug ( "QFontDatabase::pointSizes()" ); |
118 | 124 | ||
119 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); | 125 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); |
120 | 126 | ||
121 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { | 127 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { |
122 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { | 128 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { |
123 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 129 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
124 | *it *= 10; | 130 | *it *= 10; |
125 | } | 131 | } |
126 | } | 132 | } |
127 | return sl; | 133 | return sl; |
128 | } | 134 | } |
129 | 135 | ||
130 | 136 | ||
131 | // Various style/font/color related overrides for weak symbols in Qt/E, | 137 | // Various style/font/color related overrides for weak symbols in Qt/E, |
132 | // which allows us to force the usage of the global Opie appearance. | 138 | // which allows us to force the usage of the global Opie appearance. |
133 | 139 | ||
134 | void QApplication::setStyle ( QStyle *style ) | 140 | void QApplication::setStyle ( QStyle *style ) |
135 | { | 141 | { |
136 | //qDebug ( "QApplication::setStyle()" ); | 142 | //qDebug ( "QApplication::setStyle()" ); |
137 | 143 | ||
138 | if ( Opie::force_appearance & Opie::Force_Style ) | 144 | if ( Opie::force_appearance & Opie::Force_Style ) |
139 | delete style; | 145 | delete style; |
140 | else | 146 | else |
141 | QApplication::setStyle_NonWeak ( style ); | 147 | QApplication::setStyle_NonWeak ( style ); |
142 | } | 148 | } |
143 | 149 | ||
144 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) | 150 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) |
145 | { | 151 | { |
146 | //qDebug ( "QApplication::setPalette()" ); | 152 | //qDebug ( "QApplication::setPalette()" ); |
147 | 153 | ||
148 | if (!( Opie::force_appearance & Opie::Force_Style )) | 154 | if (!( Opie::force_appearance & Opie::Force_Style )) |
149 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); | 155 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); |
150 | } | 156 | } |
151 | 157 | ||
152 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) | 158 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) |
153 | { | 159 | { |
154 | //qDebug ( "QApplication::setFont()" ); | 160 | //qDebug ( "QApplication::setFont()" ); |
155 | 161 | ||
156 | if (!( Opie::force_appearance & Opie::Force_Font )) | 162 | if (!( Opie::force_appearance & Opie::Force_Font )) |
157 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); | 163 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); |
158 | } | 164 | } |
159 | 165 | ||
160 | 166 | ||
161 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) | 167 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) |
162 | { | 168 | { |
163 | //qDebug ( "QApplication::qwsSetDecoration()" ); | 169 | //qDebug ( "QApplication::qwsSetDecoration()" ); |
164 | 170 | ||
165 | if ( Opie::force_appearance & Opie::Force_Decoration ) | 171 | if ( Opie::force_appearance & Opie::Force_Decoration ) |
166 | delete deco; | 172 | delete deco; |
167 | else | 173 | else |
168 | QApplication::qwsSetDecoration_NonWeak ( deco ); | 174 | QApplication::qwsSetDecoration_NonWeak ( deco ); |
169 | } | 175 | } |
170 | 176 | #endif | |
171 | #endif \ No newline at end of file | 177 | #endif |