-rw-r--r-- | library/qpeapplication.cpp | 2 | ||||
-rw-r--r-- | library/qpeapplication.h | 11 | ||||
-rw-r--r-- | library/qt_override.cpp | 3 | ||||
-rw-r--r-- | library/qt_override_p.h | 10 |
4 files changed, 19 insertions, 7 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index f4db1ab..19adb00 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -940,48 +940,49 @@ void QPEApplication::setDefaultRotation( int r ) | |||
940 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 940 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
941 | Config config("qpe"); | 941 | Config config("qpe"); |
942 | config.setGroup( "Rotation" ); | 942 | config.setGroup( "Rotation" ); |
943 | config.writeEntry( "Rot", r ); | 943 | config.writeEntry( "Rot", r ); |
944 | } | 944 | } |
945 | else { | 945 | else { |
946 | #ifndef QT_NO_COP | 946 | #ifndef QT_NO_COP |
947 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 947 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
948 | e << r; | 948 | e << r; |
949 | } | 949 | } |
950 | #endif | 950 | #endif |
951 | 951 | ||
952 | } | 952 | } |
953 | } | 953 | } |
954 | 954 | ||
955 | 955 | ||
956 | /*! | 956 | /*! |
957 | \internal | 957 | \internal |
958 | */ | 958 | */ |
959 | void QPEApplication::applyStyle() | 959 | void QPEApplication::applyStyle() |
960 | { | 960 | { |
961 | Config config( "qpe" ); | 961 | Config config( "qpe" ); |
962 | config.setGroup( "Appearance" ); | 962 | config.setGroup( "Appearance" ); |
963 | 963 | ||
964 | #if QT_VERSION > 233 | ||
964 | // don't block ourselves ... | 965 | // don't block ourselves ... |
965 | Opie::force_appearance = 0; | 966 | Opie::force_appearance = 0; |
966 | 967 | ||
967 | static QString appname = Opie::binaryName ( ); | 968 | static QString appname = Opie::binaryName ( ); |
968 | 969 | ||
969 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 970 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
970 | int nostyle = 0; | 971 | int nostyle = 0; |
971 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 972 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
972 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 973 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
973 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 974 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
974 | break; | 975 | break; |
975 | } | 976 | } |
976 | } | 977 | } |
977 | 978 | ||
978 | // Widget style | 979 | // Widget style |
979 | QString style = config.readEntry( "Style", "Light" ); | 980 | QString style = config.readEntry( "Style", "Light" ); |
980 | 981 | ||
981 | // don't set a custom style | 982 | // don't set a custom style |
982 | if ( nostyle & Opie::Force_Style ) | 983 | if ( nostyle & Opie::Force_Style ) |
983 | style = "Light"; | 984 | style = "Light"; |
984 | 985 | ||
985 | internalSetStyle ( style ); | 986 | internalSetStyle ( style ); |
986 | 987 | ||
987 | // Colors | 988 | // Colors |
@@ -1012,48 +1013,49 @@ void QPEApplication::applyStyle() | |||
1012 | dec = ""; | 1013 | dec = ""; |
1013 | 1014 | ||
1014 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1015 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1015 | 1016 | ||
1016 | if ( dec != d->decorationName ) { | 1017 | if ( dec != d->decorationName ) { |
1017 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1018 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1018 | d->decorationName = dec; | 1019 | d->decorationName = dec; |
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | // Font | 1022 | // Font |
1022 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1023 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1023 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1024 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1024 | 1025 | ||
1025 | // don't set a custom font | 1026 | // don't set a custom font |
1026 | if ( nostyle & Opie::Force_Font ) { | 1027 | if ( nostyle & Opie::Force_Font ) { |
1027 | ff = "Vera"; | 1028 | ff = "Vera"; |
1028 | fs = 10; | 1029 | fs = 10; |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | setFont ( QFont ( ff, fs ), true ); | 1032 | setFont ( QFont ( ff, fs ), true ); |
1032 | 1033 | ||
1033 | // revert to global blocking policy ... | 1034 | // revert to global blocking policy ... |
1034 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1035 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1035 | Opie::force_appearance &= ~nostyle; | 1036 | Opie::force_appearance &= ~nostyle; |
1037 | #endif | ||
1036 | } | 1038 | } |
1037 | 1039 | ||
1038 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1040 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1039 | { | 1041 | { |
1040 | #ifdef Q_WS_QWS | 1042 | #ifdef Q_WS_QWS |
1041 | QDataStream stream( data, IO_ReadOnly ); | 1043 | QDataStream stream( data, IO_ReadOnly ); |
1042 | if ( msg == "applyStyle()" ) { | 1044 | if ( msg == "applyStyle()" ) { |
1043 | applyStyle(); | 1045 | applyStyle(); |
1044 | } | 1046 | } |
1045 | else if ( msg == "toggleApplicationMenu()" ) { | 1047 | else if ( msg == "toggleApplicationMenu()" ) { |
1046 | QWidget *active = activeWindow ( ); | 1048 | QWidget *active = activeWindow ( ); |
1047 | 1049 | ||
1048 | if ( active ) { | 1050 | if ( active ) { |
1049 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1051 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1050 | bool oldactive = man-> isActive ( ); | 1052 | bool oldactive = man-> isActive ( ); |
1051 | 1053 | ||
1052 | man-> setActive( !man-> isActive() ); | 1054 | man-> setActive( !man-> isActive() ); |
1053 | 1055 | ||
1054 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1056 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1055 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1057 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1056 | } | 1058 | } |
1057 | } | 1059 | } |
1058 | } | 1060 | } |
1059 | else if ( msg == "setDefaultRotation(int)" ) { | 1061 | else if ( msg == "setDefaultRotation(int)" ) { |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index e35c008..65a6d33 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -97,51 +97,51 @@ signals: | |||
97 | void micChanged( bool muted ); | 97 | void micChanged( bool muted ); |
98 | void volumeChanged( bool muted ); | 98 | void volumeChanged( bool muted ); |
99 | void appMessage( const QCString& msg, const QByteArray& data); | 99 | void appMessage( const QCString& msg, const QByteArray& data); |
100 | void weekChanged( bool startOnMonday ); | 100 | void weekChanged( bool startOnMonday ); |
101 | void dateFormatChanged( DateFormat ); | 101 | void dateFormatChanged( DateFormat ); |
102 | void flush(); | 102 | void flush(); |
103 | void reload(); | 103 | void reload(); |
104 | 104 | ||
105 | private slots: | 105 | private slots: |
106 | void systemMessage( const QCString &msg, const QByteArray &data ); | 106 | void systemMessage( const QCString &msg, const QByteArray &data ); |
107 | void pidMessage( const QCString &msg, const QByteArray &data ); | 107 | void pidMessage( const QCString &msg, const QByteArray &data ); |
108 | void removeSenderFromStylusDict(); | 108 | void removeSenderFromStylusDict(); |
109 | void hideOrQuit(); | 109 | void hideOrQuit(); |
110 | 110 | ||
111 | protected: | 111 | protected: |
112 | bool qwsEventFilter( QWSEvent * ); | 112 | bool qwsEventFilter( QWSEvent * ); |
113 | void internalSetStyle( const QString &style ); | 113 | void internalSetStyle( const QString &style ); |
114 | void prepareForTermination(bool willrestart); | 114 | void prepareForTermination(bool willrestart); |
115 | virtual void restart(); | 115 | virtual void restart(); |
116 | virtual void shutdown(); | 116 | virtual void shutdown(); |
117 | bool eventFilter( QObject *, QEvent * ); | 117 | bool eventFilter( QObject *, QEvent * ); |
118 | void timerEvent( QTimerEvent * ); | 118 | void timerEvent( QTimerEvent * ); |
119 | bool raiseAppropriateWindow(); | 119 | bool raiseAppropriateWindow(); |
120 | virtual void tryQuit(); | 120 | virtual void tryQuit(); |
121 | 121 | #if QT_VERSION > 233 | |
122 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | 122 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) |
123 | 123 | #endif | |
124 | private: | 124 | private: |
125 | #ifndef QT_NO_TRANSLATION | 125 | #ifndef QT_NO_TRANSLATION |
126 | void installTranslation( const QString& baseName ); | 126 | void installTranslation( const QString& baseName ); |
127 | #endif | 127 | #endif |
128 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 128 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
129 | 129 | ||
130 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 130 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
131 | QCopChannel *sysChannel; | 131 | QCopChannel *sysChannel; |
132 | QCopChannel *pidChannel; | 132 | QCopChannel *pidChannel; |
133 | #endif | 133 | #endif |
134 | QPEApplicationData *d; | 134 | QPEApplicationData *d; |
135 | 135 | ||
136 | bool reserved_sh; | 136 | bool reserved_sh; |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | }; | 140 | }; |
141 | 141 | ||
142 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | 142 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) |
143 | { | 143 | { |
144 | QSize sh = d->sizeHint(); | 144 | QSize sh = d->sizeHint(); |
145 | int w = QMAX(sh.width(),d->width()); | 145 | int w = QMAX(sh.width(),d->width()); |
146 | int h = QMAX(sh.height(),d->height()); | 146 | int h = QMAX(sh.height(),d->height()); |
147 | if ( !nomax | 147 | if ( !nomax |
@@ -162,32 +162,37 @@ inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | |||
162 | } | 162 | } |
163 | 163 | ||
164 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 164 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
165 | 165 | ||
166 | inline int TransToDeg ( Transformation t ) | 166 | inline int TransToDeg ( Transformation t ) |
167 | { | 167 | { |
168 | int d = static_cast<int>( t ); | 168 | int d = static_cast<int>( t ); |
169 | return d * 90; | 169 | return d * 90; |
170 | } | 170 | } |
171 | 171 | ||
172 | inline Transformation DegToTrans ( int d ) | 172 | inline Transformation DegToTrans ( int d ) |
173 | { | 173 | { |
174 | Transformation t = static_cast<Transformation>( d / 90 ); | 174 | Transformation t = static_cast<Transformation>( d / 90 ); |
175 | return t; | 175 | return t; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * Set current rotation of Opie, and rotation for newly started apps. | 179 | * Set current rotation of Opie, and rotation for newly started apps. |
180 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, | 180 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, |
181 | * and 2) does not set deforient or save orientation to qpe.conf. | 181 | * and 2) does not set deforient or save orientation to qpe.conf. |
182 | */ | 182 | */ |
183 | 183 | ||
184 | inline void QPEApplication::setCurrentRotation( int r ) | 184 | inline void QPEApplication::setCurrentRotation( int r ) |
185 | { | 185 | { |
186 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots | ||
187 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() | ||
188 | #if QT_VERSION > 233 | ||
186 | Transformation e = DegToTrans( r ); | 189 | Transformation e = DegToTrans( r ); |
187 | |||
188 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 190 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
189 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 191 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
192 | #else | ||
193 | setDefaultRotation( r ); | ||
194 | #endif | ||
190 | } | 195 | } |
191 | 196 | ||
192 | 197 | ||
193 | #endif | 198 | #endif |
diff --git a/library/qt_override.cpp b/library/qt_override.cpp index 02c48a0..edda874 100644 --- a/library/qt_override.cpp +++ b/library/qt_override.cpp | |||
@@ -1,39 +1,39 @@ | |||
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 | 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 | ||
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 |
@@ -147,24 +147,25 @@ void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const c | |||
147 | 147 | ||
148 | if (!( Opie::force_appearance & Opie::Force_Style )) | 148 | if (!( Opie::force_appearance & Opie::Force_Style )) |
149 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); | 149 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); |
150 | } | 150 | } |
151 | 151 | ||
152 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) | 152 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) |
153 | { | 153 | { |
154 | //qDebug ( "QApplication::setFont()" ); | 154 | //qDebug ( "QApplication::setFont()" ); |
155 | 155 | ||
156 | if (!( Opie::force_appearance & Opie::Force_Font )) | 156 | if (!( Opie::force_appearance & Opie::Force_Font )) |
157 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); | 157 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) | 161 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) |
162 | { | 162 | { |
163 | //qDebug ( "QApplication::qwsSetDecoration()" ); | 163 | //qDebug ( "QApplication::qwsSetDecoration()" ); |
164 | 164 | ||
165 | if ( Opie::force_appearance & Opie::Force_Decoration ) | 165 | if ( Opie::force_appearance & Opie::Force_Decoration ) |
166 | delete deco; | 166 | delete deco; |
167 | else | 167 | else |
168 | QApplication::qwsSetDecoration_NonWeak ( deco ); | 168 | QApplication::qwsSetDecoration_NonWeak ( deco ); |
169 | } | 169 | } |
170 | 170 | ||
171 | #endif \ No newline at end of file | ||
diff --git a/library/qt_override_p.h b/library/qt_override_p.h index d11917c..cb05d15 100644 --- a/library/qt_override_p.h +++ b/library/qt_override_p.h | |||
@@ -1,21 +1,25 @@ | |||
1 | #ifndef __QT_OVERRIDE_H__ | 1 | #ifndef __QT_OVERRIDE_H__ |
2 | #define __QT_OVERRIDE_H__ | 2 | #define __QT_OVERRIDE_H__ |
3 | 3 | ||
4 | #if QT_VERSION > 233 | ||
5 | |||
4 | namespace Opie { | 6 | namespace Opie { |
5 | 7 | ||
6 | enum ForceAppearance { | 8 | enum ForceAppearance { |
7 | Force_Style = 0x01, | 9 | Force_Style = 0x01, |
8 | Force_Font = 0x02, | 10 | Force_Font = 0x02, |
9 | Force_Decoration = 0x04, | 11 | Force_Decoration = 0x04, |
10 | 12 | ||
11 | Force_All = 0xff, | 13 | Force_All = 0xff, |
12 | Force_None = 0x00, | 14 | Force_None = 0x00, |
13 | }; | 15 | }; |
14 | 16 | ||
15 | extern const char *binaryName ( ); | 17 | extern const char *binaryName ( ); |
16 | 18 | ||
17 | extern int force_appearance; | 19 | extern int force_appearance; |
18 | 20 | ||
19 | } | 21 | } |
20 | 22 | ||
23 | #endif // (QT_VERSION >233) | ||
24 | |||
21 | #endif | 25 | #endif |