-rw-r--r-- | library/qpeapplication.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 28fb13a..feba8b6 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1063,202 +1063,208 @@ int QPEApplication::defaultRotation() | |||
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 | } |