author | zecke <zecke> | 2003-10-04 08:59:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-10-04 08:59:51 (UTC) |
commit | dc9510f788212a6be063349461540e4bea690f51 (patch) (unidiff) | |
tree | b8728fdc12c1580287f16f3828180beac5d55c13 /library | |
parent | 23f729eb7487ad189591c3b0c9af9d3afecd3b91 (diff) | |
download | opie-dc9510f788212a6be063349461540e4bea690f51.zip opie-dc9510f788212a6be063349461540e4bea690f51.tar.gz opie-dc9510f788212a6be063349461540e4bea690f51.tar.bz2 |
Allow Opie beeing build with a Plain version of Qt without weak symbols
-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 | |||
@@ -743,842 +743,848 @@ void QPEApplication::initApp( int argc, char **argv ) | |||
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 | { |
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 |