-rw-r--r-- | library/qpeapplication.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 4bc0c5f..b686e2e 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1124,385 +1124,391 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
1124 | return TRUE; | 1124 | return TRUE; |
1125 | } else /*if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 )*/ { | 1125 | } else /*if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 )*/ { |
1126 | active->close(); | 1126 | active->close(); |
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | } | 1130 | } |
1131 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 1131 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
1132 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 1132 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
1133 | // but we cannot access libopie function within libqpe :( | 1133 | // but we cannot access libopie function within libqpe :( |
1134 | 1134 | ||
1135 | QWidget * active = activeWindow ( ); | 1135 | QWidget * active = activeWindow ( ); |
1136 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 1136 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
1137 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 1137 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
1138 | QChar ch ( ke-> simpleData.unicode ); | 1138 | QChar ch ( ke-> simpleData.unicode ); |
1139 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 1139 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
1140 | ke-> simpleData.keycode, | 1140 | ke-> simpleData.keycode, |
1141 | ch. latin1 ( ), | 1141 | ch. latin1 ( ), |
1142 | ke-> simpleData.modifiers, | 1142 | ke-> simpleData.modifiers, |
1143 | QString ( ch ), | 1143 | QString ( ch ), |
1144 | ke-> simpleData.is_auto_repeat, 1 ); | 1144 | ke-> simpleData.is_auto_repeat, 1 ); |
1145 | 1145 | ||
1146 | QObject *which = QWidget::keyboardGrabber ( ); | 1146 | QObject *which = QWidget::keyboardGrabber ( ); |
1147 | if ( !which ) | 1147 | if ( !which ) |
1148 | which = QApplication::focusWidget ( ); | 1148 | which = QApplication::focusWidget ( ); |
1149 | if ( !which ) | 1149 | if ( !which ) |
1150 | which = QApplication::activeWindow ( ); | 1150 | which = QApplication::activeWindow ( ); |
1151 | if ( !which ) | 1151 | if ( !which ) |
1152 | which = qApp; | 1152 | which = qApp; |
1153 | 1153 | ||
1154 | QApplication::sendEvent ( which, &qke ); | 1154 | QApplication::sendEvent ( which, &qke ); |
1155 | } | 1155 | } |
1156 | else { // we didn't grab the keyboard, so send the event to the launcher | 1156 | else { // we didn't grab the keyboard, so send the event to the launcher |
1157 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 1157 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
1158 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 1158 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
1159 | } | 1159 | } |
1160 | } | 1160 | } |
1161 | return true; | 1161 | return true; |
1162 | } | 1162 | } |
1163 | } | 1163 | } |
1164 | if ( e->type == QWSEvent::Focus ) { | 1164 | if ( e->type == QWSEvent::Focus ) { |
1165 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 1165 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
1166 | if ( !fe->simpleData.get_focus ) { | 1166 | if ( !fe->simpleData.get_focus ) { |
1167 | QWidget * active = activeWindow(); | 1167 | QWidget * active = activeWindow(); |
1168 | while ( active && active->isPopup() ) { | 1168 | while ( active && active->isPopup() ) { |
1169 | active->close(); | 1169 | active->close(); |
1170 | active = activeWindow(); | 1170 | active = activeWindow(); |
1171 | } | 1171 | } |
1172 | } | 1172 | } |
1173 | else { | 1173 | else { |
1174 | // make sure our modal widget is ALWAYS on top | 1174 | // make sure our modal widget is ALWAYS on top |
1175 | QWidget *topm = activeModalWidget(); | 1175 | QWidget *topm = activeModalWidget(); |
1176 | if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { | 1176 | if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { |
1177 | topm->raise(); | 1177 | topm->raise(); |
1178 | } | 1178 | } |
1179 | } | 1179 | } |
1180 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 1180 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
1181 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 1181 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
1182 | if ( m == AlwaysOff ) | 1182 | if ( m == AlwaysOff ) |
1183 | Global::hideInputMethod(); | 1183 | Global::hideInputMethod(); |
1184 | if ( m == AlwaysOn ) | 1184 | if ( m == AlwaysOn ) |
1185 | Global::showInputMethod(); | 1185 | Global::showInputMethod(); |
1186 | } | 1186 | } |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | 1189 | ||
1190 | return QApplication::qwsEventFilter( e ); | 1190 | return QApplication::qwsEventFilter( e ); |
1191 | } | 1191 | } |
1192 | #endif | 1192 | #endif |
1193 | 1193 | ||
1194 | /*! | 1194 | /*! |
1195 | Destroys the QPEApplication. | 1195 | Destroys the QPEApplication. |
1196 | */ | 1196 | */ |
1197 | QPEApplication::~QPEApplication() | 1197 | QPEApplication::~QPEApplication() |
1198 | { | 1198 | { |
1199 | ungrabKeyboard(); | 1199 | ungrabKeyboard(); |
1200 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1200 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1201 | // Need to delete QCopChannels early, since the display will | 1201 | // Need to delete QCopChannels early, since the display will |
1202 | // be gone by the time we get to ~QObject(). | 1202 | // be gone by the time we get to ~QObject(). |
1203 | delete sysChannel; | 1203 | delete sysChannel; |
1204 | delete pidChannel; | 1204 | delete pidChannel; |
1205 | #endif | 1205 | #endif |
1206 | 1206 | ||
1207 | delete d; | 1207 | delete d; |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | /*! | 1210 | /*! |
1211 | Returns <tt>$OPIEDIR/</tt>. | 1211 | Returns <tt>$OPIEDIR/</tt>. |
1212 | */ | 1212 | */ |
1213 | QString QPEApplication::qpeDir() | 1213 | QString QPEApplication::qpeDir() |
1214 | { | 1214 | { |
1215 | const char * base = getenv( "OPIEDIR" ); | 1215 | const char * base = getenv( "OPIEDIR" ); |
1216 | if ( base ) | 1216 | if ( base ) |
1217 | return QString( base ) + "/"; | 1217 | return QString( base ) + "/"; |
1218 | 1218 | ||
1219 | return QString( "../" ); | 1219 | return QString( "../" ); |
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | /*! | 1222 | /*! |
1223 | Returns the user's current Document directory. There is a trailing "/". | 1223 | Returns the user's current Document directory. There is a trailing "/". |
1224 | .. well, it does now,, and there's no trailing '/' | 1224 | .. well, it does now,, and there's no trailing '/' |
1225 | */ | 1225 | */ |
1226 | QString QPEApplication::documentDir() | 1226 | QString QPEApplication::documentDir() |
1227 | { | 1227 | { |
1228 | const char* base = getenv( "HOME"); | 1228 | const char* base = getenv( "HOME"); |
1229 | if ( base ) | 1229 | if ( base ) |
1230 | return QString( base ) + "/Documents"; | 1230 | return QString( base ) + "/Documents"; |
1231 | 1231 | ||
1232 | return QString( "../Documents" ); | 1232 | return QString( "../Documents" ); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | static int deforient = -1; | 1235 | static int deforient = -1; |
1236 | 1236 | ||
1237 | /*! | 1237 | /*! |
1238 | \internal | 1238 | \internal |
1239 | */ | 1239 | */ |
1240 | int QPEApplication::defaultRotation() | 1240 | int QPEApplication::defaultRotation() |
1241 | { | 1241 | { |
1242 | if ( deforient < 0 ) { | 1242 | if ( deforient < 0 ) { |
1243 | QString d = getenv( "QWS_DISPLAY" ); | 1243 | QString d = getenv( "QWS_DISPLAY" ); |
1244 | if ( d.contains( "Rot90" ) ) { | 1244 | if ( d.contains( "Rot90" ) ) { |
1245 | deforient = 90; | 1245 | deforient = 90; |
1246 | } | 1246 | } |
1247 | else if ( d.contains( "Rot180" ) ) { | 1247 | else if ( d.contains( "Rot180" ) ) { |
1248 | deforient = 180; | 1248 | deforient = 180; |
1249 | } | 1249 | } |
1250 | else if ( d.contains( "Rot270" ) ) { | 1250 | else if ( d.contains( "Rot270" ) ) { |
1251 | deforient = 270; | 1251 | deforient = 270; |
1252 | } | 1252 | } |
1253 | else { | 1253 | else { |
1254 | deforient = 0; | 1254 | deforient = 0; |
1255 | } | 1255 | } |
1256 | } | 1256 | } |
1257 | return deforient; | 1257 | return deforient; |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | /*! | 1260 | /*! |
1261 | \internal | 1261 | \internal |
1262 | */ | 1262 | */ |
1263 | void QPEApplication::setDefaultRotation( int r ) | 1263 | void QPEApplication::setDefaultRotation( int r ) |
1264 | { | 1264 | { |
1265 | if ( qApp->type() == GuiServer ) { | 1265 | if ( qApp->type() == GuiServer ) { |
1266 | deforient = r; | 1266 | deforient = r; |
1267 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1267 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1268 | Config config("qpe"); | 1268 | Config config("qpe"); |
1269 | config.setGroup( "Rotation" ); | 1269 | config.setGroup( "Rotation" ); |
1270 | config.writeEntry( "Rot", r ); | 1270 | config.writeEntry( "Rot", r ); |
1271 | } | 1271 | } |
1272 | else { | 1272 | else { |
1273 | #ifndef QT_NO_COP | 1273 | #ifndef QT_NO_COP |
1274 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1274 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1275 | e << r; | 1275 | e << r; |
1276 | } | 1276 | } |
1277 | #endif | 1277 | #endif |
1278 | 1278 | ||
1279 | } | 1279 | } |
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | #include <qgfx_qws.h> | 1282 | #include <qgfx_qws.h> |
1283 | #include <qwindowsystem_qws.h> | 1283 | #include <qwindowsystem_qws.h> |
1284 | 1284 | ||
1285 | extern void qws_clearLoadedFonts(); | 1285 | extern void qws_clearLoadedFonts(); |
1286 | 1286 | ||
1287 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1287 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1288 | { | 1288 | { |
1289 | // Reset the caches | 1289 | // Reset the caches |
1290 | qws_clearLoadedFonts(); | 1290 | qws_clearLoadedFonts(); |
1291 | QPixmapCache::clear(); | 1291 | QPixmapCache::clear(); |
1292 | 1292 | ||
1293 | // Change the screen mode | 1293 | // Change the screen mode |
1294 | qt_screen->setMode(x, y, depth); | 1294 | qt_screen->setMode(x, y, depth); |
1295 | 1295 | ||
1296 | if ( qApp->type() == GuiServer ) { | 1296 | if ( qApp->type() == GuiServer ) { |
1297 | // Reconfigure the GuiServer | 1297 | // Reconfigure the GuiServer |
1298 | qwsServer->beginDisplayReconfigure(); | 1298 | qwsServer->beginDisplayReconfigure(); |
1299 | qwsServer->endDisplayReconfigure(); | 1299 | qwsServer->endDisplayReconfigure(); |
1300 | 1300 | ||
1301 | // Get all the running apps to reset | 1301 | // Get all the running apps to reset |
1302 | QCopEnvelope env( "QPE/System", "reset()" ); | 1302 | QCopEnvelope env( "QPE/System", "reset()" ); |
1303 | } | 1303 | } |
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | void QPEApplication::reset() { | 1306 | void QPEApplication::reset() { |
1307 | // Reconnect to the screen | 1307 | // Reconnect to the screen |
1308 | qt_screen->disconnect(); | 1308 | qt_screen->disconnect(); |
1309 | qt_screen->connect( QString::null ); | 1309 | qt_screen->connect( QString::null ); |
1310 | 1310 | ||
1311 | // Redraw everything | 1311 | // Redraw everything |
1312 | applyStyle(); | 1312 | applyStyle(); |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | 1315 | ||
1316 | extern bool qt_left_hand_scrollbars __attribute__(( weak )); | 1316 | #ifdef Q_OS_MACX |
1317 | #define WEAK_SYMBOL __attribute__((weak_import)) | ||
1318 | #else | ||
1319 | #define WEAK_SYMBOL __attribute__((weak)) | ||
1320 | #endif | ||
1321 | |||
1322 | extern bool qt_left_hand_scrollbars WEAK_SYMBOL; | ||
1317 | /*! | 1323 | /*! |
1318 | \internal | 1324 | \internal |
1319 | */ | 1325 | */ |
1320 | void QPEApplication::applyStyle() | 1326 | void QPEApplication::applyStyle() |
1321 | { | 1327 | { |
1322 | Config config( "qpe" ); | 1328 | Config config( "qpe" ); |
1323 | config.setGroup( "Appearance" ); | 1329 | config.setGroup( "Appearance" ); |
1324 | 1330 | ||
1325 | #if QT_VERSION > 233 | 1331 | #if QT_VERSION > 233 |
1326 | #if !defined(OPIE_NO_OVERRIDE_QT) | 1332 | #if !defined(OPIE_NO_OVERRIDE_QT) |
1327 | // don't block ourselves ... | 1333 | // don't block ourselves ... |
1328 | Opie::force_appearance = 0; | 1334 | Opie::force_appearance = 0; |
1329 | 1335 | ||
1330 | static QString appname = Opie::binaryName ( ); | 1336 | static QString appname = Opie::binaryName ( ); |
1331 | 1337 | ||
1332 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1338 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
1333 | int nostyle = 0; | 1339 | int nostyle = 0; |
1334 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 1340 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
1335 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 1341 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
1336 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 1342 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
1337 | break; | 1343 | break; |
1338 | } | 1344 | } |
1339 | } | 1345 | } |
1340 | #else | 1346 | #else |
1341 | int nostyle = 0; | 1347 | int nostyle = 0; |
1342 | #endif | 1348 | #endif |
1343 | 1349 | ||
1344 | // Widget style | 1350 | // Widget style |
1345 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1351 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1346 | 1352 | ||
1347 | // don't set a custom style | 1353 | // don't set a custom style |
1348 | if ( nostyle & Opie::Force_Style ) | 1354 | if ( nostyle & Opie::Force_Style ) |
1349 | style = "FlatStyle"; | 1355 | style = "FlatStyle"; |
1350 | 1356 | ||
1351 | internalSetStyle ( style ); | 1357 | internalSetStyle ( style ); |
1352 | 1358 | ||
1353 | // Colors - from /etc/colors/Liquid.scheme | 1359 | // Colors - from /etc/colors/Liquid.scheme |
1354 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1360 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1355 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1361 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1356 | QPalette pal( btncolor, bgcolor ); | 1362 | QPalette pal( btncolor, bgcolor ); |
1357 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1363 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1358 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1364 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1359 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1365 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1360 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1366 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1361 | color = config.readEntry( "Text", "#000000" ); | 1367 | color = config.readEntry( "Text", "#000000" ); |
1362 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1368 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1363 | color = config.readEntry( "ButtonText", "#000000" ); | 1369 | color = config.readEntry( "ButtonText", "#000000" ); |
1364 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1370 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1365 | color = config.readEntry( "Base", "#FFFFFF" ); | 1371 | color = config.readEntry( "Base", "#FFFFFF" ); |
1366 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1372 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1367 | 1373 | ||
1368 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1374 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1369 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1375 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1370 | 1376 | ||
1371 | setPalette( pal, TRUE ); | 1377 | setPalette( pal, TRUE ); |
1372 | 1378 | ||
1373 | 1379 | ||
1374 | // Set the ScrollBar on the 'right' side but only if the weak symbol is present | 1380 | // Set the ScrollBar on the 'right' side but only if the weak symbol is present |
1375 | if (&qt_left_hand_scrollbars ) | 1381 | if (&qt_left_hand_scrollbars ) |
1376 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); | 1382 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); |
1377 | 1383 | ||
1378 | // Window Decoration | 1384 | // Window Decoration |
1379 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1385 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1380 | 1386 | ||
1381 | // don't set a custom deco | 1387 | // don't set a custom deco |
1382 | if ( nostyle & Opie::Force_Decoration ) | 1388 | if ( nostyle & Opie::Force_Decoration ) |
1383 | dec = ""; | 1389 | dec = ""; |
1384 | 1390 | ||
1385 | 1391 | ||
1386 | if ( dec != d->decorationName ) { | 1392 | if ( dec != d->decorationName ) { |
1387 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1393 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1388 | d->decorationName = dec; | 1394 | d->decorationName = dec; |
1389 | } | 1395 | } |
1390 | 1396 | ||
1391 | // Font | 1397 | // Font |
1392 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1398 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1393 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1399 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1394 | 1400 | ||
1395 | // don't set a custom font | 1401 | // don't set a custom font |
1396 | if ( nostyle & Opie::Force_Font ) { | 1402 | if ( nostyle & Opie::Force_Font ) { |
1397 | ff = "Vera"; | 1403 | ff = "Vera"; |
1398 | fs = 10; | 1404 | fs = 10; |
1399 | } | 1405 | } |
1400 | 1406 | ||
1401 | setFont ( QFont ( ff, fs ), true ); | 1407 | setFont ( QFont ( ff, fs ), true ); |
1402 | 1408 | ||
1403 | #if !defined(OPIE_NO_OVERRIDE_QT) | 1409 | #if !defined(OPIE_NO_OVERRIDE_QT) |
1404 | // revert to global blocking policy ... | 1410 | // revert to global blocking policy ... |
1405 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1411 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1406 | Opie::force_appearance &= ~nostyle; | 1412 | Opie::force_appearance &= ~nostyle; |
1407 | #endif | 1413 | #endif |
1408 | #endif | 1414 | #endif |
1409 | } | 1415 | } |
1410 | 1416 | ||
1411 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1417 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1412 | { | 1418 | { |
1413 | #ifdef Q_WS_QWS | 1419 | #ifdef Q_WS_QWS |
1414 | QDataStream stream( data, IO_ReadOnly ); | 1420 | QDataStream stream( data, IO_ReadOnly ); |
1415 | if ( msg == "applyStyle()" ) { | 1421 | if ( msg == "applyStyle()" ) { |
1416 | applyStyle(); | 1422 | applyStyle(); |
1417 | } | 1423 | } |
1418 | else if ( msg == "toggleApplicationMenu()" ) { | 1424 | else if ( msg == "toggleApplicationMenu()" ) { |
1419 | QWidget *active = activeWindow ( ); | 1425 | QWidget *active = activeWindow ( ); |
1420 | 1426 | ||
1421 | if ( active ) { | 1427 | if ( active ) { |
1422 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1428 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1423 | bool oldactive = man-> isActive ( ); | 1429 | bool oldactive = man-> isActive ( ); |
1424 | 1430 | ||
1425 | man-> setActive( !man-> isActive() ); | 1431 | man-> setActive( !man-> isActive() ); |
1426 | 1432 | ||
1427 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1433 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1428 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1434 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1429 | } | 1435 | } |
1430 | } | 1436 | } |
1431 | } | 1437 | } |
1432 | else if ( msg == "setDefaultRotation(int)" ) { | 1438 | else if ( msg == "setDefaultRotation(int)" ) { |
1433 | if ( type() == GuiServer ) { | 1439 | if ( type() == GuiServer ) { |
1434 | int r; | 1440 | int r; |
1435 | stream >> r; | 1441 | stream >> r; |
1436 | setDefaultRotation( r ); | 1442 | setDefaultRotation( r ); |
1437 | } | 1443 | } |
1438 | } | 1444 | } |
1439 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> | 1445 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> |
1440 | if ( type() == GuiServer ) { | 1446 | if ( type() == GuiServer ) { |
1441 | int x, y, depth; | 1447 | int x, y, depth; |
1442 | stream >> x; | 1448 | stream >> x; |
1443 | stream >> y; | 1449 | stream >> y; |
1444 | stream >> depth; | 1450 | stream >> depth; |
1445 | setCurrentMode( x, y, depth ); | 1451 | setCurrentMode( x, y, depth ); |
1446 | } | 1452 | } |
1447 | } | 1453 | } |
1448 | else if ( msg == "reset()" ) { | 1454 | else if ( msg == "reset()" ) { |
1449 | if ( type() != GuiServer ) | 1455 | if ( type() != GuiServer ) |
1450 | reset(); | 1456 | reset(); |
1451 | } | 1457 | } |
1452 | else if ( msg == "setCurrentRotation(int)" ) { | 1458 | else if ( msg == "setCurrentRotation(int)" ) { |
1453 | int r; | 1459 | int r; |
1454 | stream >> r; | 1460 | stream >> r; |
1455 | setCurrentRotation( r ); | 1461 | setCurrentRotation( r ); |
1456 | } | 1462 | } |
1457 | else if ( msg == "shutdown()" ) { | 1463 | else if ( msg == "shutdown()" ) { |
1458 | if ( type() == GuiServer ) | 1464 | if ( type() == GuiServer ) |
1459 | shutdown(); | 1465 | shutdown(); |
1460 | } | 1466 | } |
1461 | else if ( msg == "quit()" ) { | 1467 | else if ( msg == "quit()" ) { |
1462 | if ( type() != GuiServer ) | 1468 | if ( type() != GuiServer ) |
1463 | tryQuit(); | 1469 | tryQuit(); |
1464 | } | 1470 | } |
1465 | else if ( msg == "forceQuit()" ) { | 1471 | else if ( msg == "forceQuit()" ) { |
1466 | if ( type() != GuiServer ) | 1472 | if ( type() != GuiServer ) |
1467 | quit(); | 1473 | quit(); |
1468 | } | 1474 | } |
1469 | else if ( msg == "restart()" ) { | 1475 | else if ( msg == "restart()" ) { |
1470 | if ( type() == GuiServer ) | 1476 | if ( type() == GuiServer ) |
1471 | restart(); | 1477 | restart(); |
1472 | } | 1478 | } |
1473 | else if ( msg == "language(QString)" ) { | 1479 | else if ( msg == "language(QString)" ) { |
1474 | if ( type() == GuiServer ) { | 1480 | if ( type() == GuiServer ) { |
1475 | QString l; | 1481 | QString l; |
1476 | stream >> l; | 1482 | stream >> l; |
1477 | QString cl = getenv( "LANG" ); | 1483 | QString cl = getenv( "LANG" ); |
1478 | if ( cl != l ) { | 1484 | if ( cl != l ) { |
1479 | if ( l.isNull() ) | 1485 | if ( l.isNull() ) |
1480 | unsetenv( "LANG" ); | 1486 | unsetenv( "LANG" ); |
1481 | else | 1487 | else |
1482 | setenv( "LANG", l.latin1(), 1 ); | 1488 | setenv( "LANG", l.latin1(), 1 ); |
1483 | restart(); | 1489 | restart(); |
1484 | } | 1490 | } |
1485 | } | 1491 | } |
1486 | } | 1492 | } |
1487 | else if ( msg == "timeChange(QString)" ) { | 1493 | else if ( msg == "timeChange(QString)" ) { |
1488 | QString t; | 1494 | QString t; |
1489 | stream >> t; | 1495 | stream >> t; |
1490 | if ( t.isNull() ) | 1496 | if ( t.isNull() ) |
1491 | unsetenv( "TZ" ); | 1497 | unsetenv( "TZ" ); |
1492 | else | 1498 | else |
1493 | setenv( "TZ", t.latin1(), 1 ); | 1499 | setenv( "TZ", t.latin1(), 1 ); |
1494 | // emit the signal so everyone else knows... | 1500 | // emit the signal so everyone else knows... |
1495 | emit timeChanged(); | 1501 | emit timeChanged(); |
1496 | } | 1502 | } |
1497 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1503 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1498 | if ( type() == GuiServer ) { | 1504 | if ( type() == GuiServer ) { |
1499 | QDateTime when; | 1505 | QDateTime when; |
1500 | QCString channel, message; | 1506 | QCString channel, message; |
1501 | int data; | 1507 | int data; |
1502 | stream >> when >> channel >> message >> data; | 1508 | stream >> when >> channel >> message >> data; |
1503 | AlarmServer::addAlarm( when, channel, message, data ); | 1509 | AlarmServer::addAlarm( when, channel, message, data ); |
1504 | } | 1510 | } |
1505 | } | 1511 | } |
1506 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1512 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1507 | if ( type() == GuiServer ) { | 1513 | if ( type() == GuiServer ) { |
1508 | QDateTime when; | 1514 | QDateTime when; |