-rw-r--r-- | library/qpeapplication.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 1c5ced3..2bd7cbe 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -75,49 +75,48 @@ | |||
75 | #include "resource.h" | 75 | #include "resource.h" |
76 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 76 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
77 | #include "qutfcodec.h" | 77 | #include "qutfcodec.h" |
78 | #endif | 78 | #endif |
79 | #include "config.h" | 79 | #include "config.h" |
80 | #include "network.h" | 80 | #include "network.h" |
81 | #ifdef QWS | 81 | #ifdef QWS |
82 | #include "fontmanager.h" | 82 | #include "fontmanager.h" |
83 | #include "fontdatabase.h" | 83 | #include "fontdatabase.h" |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | #include "alarmserver.h" | 86 | #include "alarmserver.h" |
87 | #include "applnk.h" | 87 | #include "applnk.h" |
88 | #include "qpemenubar.h" | 88 | #include "qpemenubar.h" |
89 | #include "textcodecinterface.h" | 89 | #include "textcodecinterface.h" |
90 | #include "imagecodecinterface.h" | 90 | #include "imagecodecinterface.h" |
91 | #include <qtopia/qpeglobal.h> | 91 | #include <qtopia/qpeglobal.h> |
92 | 92 | ||
93 | #include <unistd.h> | 93 | #include <unistd.h> |
94 | #include <sys/file.h> | 94 | #include <sys/file.h> |
95 | #include <sys/ioctl.h> | 95 | #include <sys/ioctl.h> |
96 | #ifndef QT_NO_SOUND | 96 | #ifndef QT_NO_SOUND |
97 | #include <sys/soundcard.h> | 97 | #include <sys/soundcard.h> |
98 | #endif | 98 | #endif |
99 | #include "qt_override_p.h" | ||
100 | 99 | ||
101 | #include <backend/rohfeedback.h> | 100 | #include <backend/rohfeedback.h> |
102 | 101 | ||
103 | 102 | ||
104 | static bool useBigPixmaps = 0; | 103 | static bool useBigPixmaps = 0; |
105 | 104 | ||
106 | class HackWidget : public QWidget | 105 | class HackWidget : public QWidget |
107 | { | 106 | { |
108 | public: | 107 | public: |
109 | bool needsOk() | 108 | bool needsOk() |
110 | { return (getWState() & WState_Reserved1 ); } | 109 | { return (getWState() & WState_Reserved1 ); } |
111 | 110 | ||
112 | QRect normalGeometry() | 111 | QRect normalGeometry() |
113 | { return topData()->normalGeometry; }; | 112 | { return topData()->normalGeometry; }; |
114 | }; | 113 | }; |
115 | 114 | ||
116 | class QPEApplicationData | 115 | class QPEApplicationData |
117 | { | 116 | { |
118 | public: | 117 | public: |
119 | QPEApplicationData ( ) : | 118 | QPEApplicationData ( ) : |
120 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 119 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
121 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 120 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
122 | keep_running( true ), qcopQok( false ), | 121 | keep_running( true ), qcopQok( false ), |
123 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), | 122 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), |
@@ -1331,130 +1330,91 @@ void QPEApplication::setCurrentMode( int x, int y, int depth ) | |||
1331 | void QPEApplication::reset() { | 1330 | void QPEApplication::reset() { |
1332 | // Reconnect to the screen | 1331 | // Reconnect to the screen |
1333 | qt_screen->disconnect(); | 1332 | qt_screen->disconnect(); |
1334 | qt_screen->connect( QString::null ); | 1333 | qt_screen->connect( QString::null ); |
1335 | 1334 | ||
1336 | // Redraw everything | 1335 | // Redraw everything |
1337 | applyStyle(); | 1336 | applyStyle(); |
1338 | } | 1337 | } |
1339 | 1338 | ||
1340 | #if (QT_VERSION < 238) && defined Q_OS_MACX | 1339 | #if (QT_VERSION < 238) && defined Q_OS_MACX |
1341 | bool qt_left_hand_scrollbars = false; | 1340 | bool qt_left_hand_scrollbars = false; |
1342 | #else | 1341 | #else |
1343 | extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; | 1342 | extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; |
1344 | #endif | 1343 | #endif |
1345 | 1344 | ||
1346 | /*! | 1345 | /*! |
1347 | \internal | 1346 | \internal |
1348 | */ | 1347 | */ |
1349 | void QPEApplication::applyStyle() | 1348 | void QPEApplication::applyStyle() |
1350 | { | 1349 | { |
1351 | Config config( "qpe" ); | 1350 | Config config( "qpe" ); |
1352 | config.setGroup( "Appearance" ); | 1351 | config.setGroup( "Appearance" ); |
1353 | 1352 | ||
1354 | #if QT_VERSION > 233 | 1353 | #if QT_VERSION > 233 |
1355 | #if !defined(OPIE_NO_OVERRIDE_QT) | ||
1356 | // don't block ourselves ... | ||
1357 | Opie::force_appearance = 0; | ||
1358 | |||
1359 | static QString appname = Opie::binaryName ( ); | ||
1360 | |||
1361 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | ||
1362 | int nostyle = 0; | ||
1363 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | ||
1364 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | ||
1365 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | ||
1366 | break; | ||
1367 | } | ||
1368 | } | ||
1369 | #else | ||
1370 | int nostyle = 0; | ||
1371 | #endif | ||
1372 | |||
1373 | // Widget style | 1354 | // Widget style |
1374 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1355 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1375 | 1356 | ||
1376 | // don't set a custom style | ||
1377 | if ( nostyle & Opie::Force_Style ) | ||
1378 | style = "FlatStyle"; | ||
1379 | |||
1380 | internalSetStyle ( style ); | 1357 | internalSetStyle ( style ); |
1381 | 1358 | ||
1382 | // Colors - from /etc/colors/Liquid.scheme | 1359 | // Colors - from /etc/colors/Liquid.scheme |
1383 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1360 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1384 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1361 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1385 | QPalette pal( btncolor, bgcolor ); | 1362 | QPalette pal( btncolor, bgcolor ); |
1386 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1363 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1387 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1364 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1388 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1365 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1389 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1366 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1390 | color = config.readEntry( "Text", "#000000" ); | 1367 | color = config.readEntry( "Text", "#000000" ); |
1391 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1368 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1392 | color = config.readEntry( "ButtonText", "#000000" ); | 1369 | color = config.readEntry( "ButtonText", "#000000" ); |
1393 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1370 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1394 | color = config.readEntry( "Base", "#FFFFFF" ); | 1371 | color = config.readEntry( "Base", "#FFFFFF" ); |
1395 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1372 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1396 | 1373 | ||
1397 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1374 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1398 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1375 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1399 | 1376 | ||
1400 | setPalette( pal, TRUE ); | 1377 | setPalette( pal, TRUE ); |
1401 | 1378 | ||
1402 | 1379 | ||
1403 | // 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 |
1404 | if (&qt_left_hand_scrollbars ) | 1381 | if (&qt_left_hand_scrollbars ) |
1405 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); | 1382 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); |
1406 | 1383 | ||
1407 | // Window Decoration | 1384 | // Window Decoration |
1408 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1385 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1409 | 1386 | ||
1410 | // don't set a custom deco | ||
1411 | if ( nostyle & Opie::Force_Decoration ) | ||
1412 | dec = ""; | ||
1413 | |||
1414 | |||
1415 | if ( dec != d->decorationName ) { | 1387 | if ( dec != d->decorationName ) { |
1416 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1388 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1417 | d->decorationName = dec; | 1389 | d->decorationName = dec; |
1418 | } | 1390 | } |
1419 | 1391 | ||
1420 | // Font | 1392 | // Font |
1421 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1393 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1422 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1394 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1423 | 1395 | ||
1424 | // don't set a custom font | ||
1425 | if ( nostyle & Opie::Force_Font ) { | ||
1426 | ff = "Vera"; | ||
1427 | fs = 10; | ||
1428 | } | ||
1429 | |||
1430 | setFont ( QFont ( ff, fs ), true ); | 1396 | setFont ( QFont ( ff, fs ), true ); |
1431 | |||
1432 | #if !defined(OPIE_NO_OVERRIDE_QT) | ||
1433 | // revert to global blocking policy ... | ||
1434 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | ||
1435 | Opie::force_appearance &= ~nostyle; | ||
1436 | #endif | ||
1437 | #endif | 1397 | #endif |
1438 | } | 1398 | } |
1439 | 1399 | ||
1440 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1400 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1441 | { | 1401 | { |
1442 | #ifdef Q_WS_QWS | 1402 | #ifdef Q_WS_QWS |
1443 | QDataStream stream( data, IO_ReadOnly ); | 1403 | QDataStream stream( data, IO_ReadOnly ); |
1444 | if ( msg == "applyStyle()" ) { | 1404 | if ( msg == "applyStyle()" ) { |
1445 | applyStyle(); | 1405 | applyStyle(); |
1446 | } | 1406 | } |
1447 | else if ( msg == "toggleApplicationMenu()" ) { | 1407 | else if ( msg == "toggleApplicationMenu()" ) { |
1448 | QWidget *active = activeWindow ( ); | 1408 | QWidget *active = activeWindow ( ); |
1449 | 1409 | ||
1450 | if ( active ) { | 1410 | if ( active ) { |
1451 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1411 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1452 | bool oldactive = man-> isActive ( ); | 1412 | bool oldactive = man-> isActive ( ); |
1453 | 1413 | ||
1454 | man-> setActive( !man-> isActive() ); | 1414 | man-> setActive( !man-> isActive() ); |
1455 | 1415 | ||
1456 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1416 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1457 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1417 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1458 | } | 1418 | } |
1459 | } | 1419 | } |
1460 | } | 1420 | } |