summaryrefslogtreecommitdiff
authorzecke <zecke>2004-06-13 19:32:42 (UTC)
committer zecke <zecke>2004-06-13 19:32:42 (UTC)
commit6092529865660fee46ffab29177ca281f6252b2a (patch) (unidiff)
tree45373de9c58a31e3951f745c90aa223f260d47cd
parentf74ad6f0e20cb803321cec629cd8d37abc966571 (diff)
downloadopie-6092529865660fee46ffab29177ca281f6252b2a.zip
opie-6092529865660fee46ffab29177ca281f6252b2a.tar.gz
opie-6092529865660fee46ffab29177ca281f6252b2a.tar.bz2
Set the ScrollBar position right on start.
This works on Qt2.3.8 and Qt2.3.7
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp8
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
@@ -1256,192 +1256,198 @@ int QPEApplication::defaultRotation()
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*/
1268void QPEApplication::setDefaultRotation( int r ) 1268void 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
1290extern void qws_clearLoadedFonts(); 1290extern void qws_clearLoadedFonts();
1291 1291
1292void QPEApplication::setCurrentMode( int x, int y, int depth ) 1292void 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
1311void QPEApplication::reset() { 1311void 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
1321extern bool qt_left_hand_scrollbars __attribute__(( weak ));
1320/*! 1322/*!
1321 \internal 1323 \internal
1322*/ 1324*/
1323void QPEApplication::applyStyle() 1325void 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
1410void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1416void 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()" ) {