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