-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 | |||
@@ -1220,193 +1220,199 @@ QString QPEApplication::qpeDir() | |||
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 | { |