summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index ca90427..e1edd4c 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1184,1172 +1184,1163 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
1184 else { // we didn't grab the keyboard, so send the event to the launcher 1184 else { // we didn't grab the keyboard, so send the event to the launcher
1185 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); 1185 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" );
1186 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); 1186 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
1187 } 1187 }
1188 } 1188 }
1189 return true; 1189 return true;
1190 } 1190 }
1191 } 1191 }
1192 if ( e->type == QWSEvent::Focus ) { 1192 if ( e->type == QWSEvent::Focus ) {
1193 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 1193 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
1194 if ( !fe->simpleData.get_focus ) { 1194 if ( !fe->simpleData.get_focus ) {
1195 QWidget * active = activeWindow(); 1195 QWidget * active = activeWindow();
1196 while ( active && active->isPopup() ) { 1196 while ( active && active->isPopup() ) {
1197 active->close(); 1197 active->close();
1198 active = activeWindow(); 1198 active = activeWindow();
1199 } 1199 }
1200 } 1200 }
1201 else { 1201 else {
1202 // make sure our modal widget is ALWAYS on top 1202 // make sure our modal widget is ALWAYS on top
1203 QWidget *topm = activeModalWidget(); 1203 QWidget *topm = activeModalWidget();
1204 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { 1204 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
1205 topm->raise(); 1205 topm->raise();
1206 } 1206 }
1207 } 1207 }
1208 if ( fe->simpleData.get_focus && inputMethodDict ) { 1208 if ( fe->simpleData.get_focus && inputMethodDict ) {
1209 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1209 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
1210 if ( m == AlwaysOff ) 1210 if ( m == AlwaysOff )
1211 Global::hideInputMethod(); 1211 Global::hideInputMethod();
1212 if ( m == AlwaysOn ) 1212 if ( m == AlwaysOn )
1213 Global::showInputMethod(); 1213 Global::showInputMethod();
1214 } 1214 }
1215 } 1215 }
1216 1216
1217 1217
1218 return QApplication::qwsEventFilter( e ); 1218 return QApplication::qwsEventFilter( e );
1219} 1219}
1220#endif 1220#endif
1221 1221
1222/*! 1222/*!
1223 Destroys the QPEApplication. 1223 Destroys the QPEApplication.
1224*/ 1224*/
1225QPEApplication::~QPEApplication() 1225QPEApplication::~QPEApplication()
1226{ 1226{
1227 ungrabKeyboard(); 1227 ungrabKeyboard();
1228#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1228#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1229 // Need to delete QCopChannels early, since the display will 1229 // Need to delete QCopChannels early, since the display will
1230 // be gone by the time we get to ~QObject(). 1230 // be gone by the time we get to ~QObject().
1231 delete sysChannel; 1231 delete sysChannel;
1232 delete pidChannel; 1232 delete pidChannel;
1233#endif 1233#endif
1234 1234
1235#ifdef OPIE_WITHROHFEEDBACK 1235#ifdef OPIE_WITHROHFEEDBACK
1236 if( d->RoH ) 1236 if( d->RoH )
1237 delete d->RoH; 1237 delete d->RoH;
1238#endif 1238#endif
1239 delete d; 1239 delete d;
1240} 1240}
1241 1241
1242/*! 1242/*!
1243 Returns <tt>$OPIEDIR/</tt>. 1243 Returns <tt>$OPIEDIR/</tt>.
1244*/ 1244*/
1245QString QPEApplication::qpeDir() 1245QString QPEApplication::qpeDir()
1246{ 1246{
1247 const char * base = getenv( "OPIEDIR" ); 1247 const char * base = getenv( "OPIEDIR" );
1248 if ( base ) 1248 if ( base )
1249 return QString( base ) + "/"; 1249 return QString( base ) + "/";
1250 1250
1251 return QString( "../" ); 1251 return QString( "../" );
1252} 1252}
1253 1253
1254/*! 1254/*!
1255 Returns the user's current Document directory. There is a trailing "/". 1255 Returns the user's current Document directory. There is a trailing "/".
1256 .. well, it does now,, and there's no trailing '/' 1256 .. well, it does now,, and there's no trailing '/'
1257*/ 1257*/
1258QString QPEApplication::documentDir() 1258QString QPEApplication::documentDir()
1259{ 1259{
1260 const char* base = getenv( "HOME"); 1260 const char* base = getenv( "HOME");
1261 if ( base ) 1261 if ( base )
1262 return QString( base ) + "/Documents"; 1262 return QString( base ) + "/Documents";
1263 1263
1264 return QString( "../Documents" ); 1264 return QString( "../Documents" );
1265} 1265}
1266 1266
1267static int deforient = -1; 1267static int deforient = -1;
1268 1268
1269/*! 1269/*!
1270 \internal 1270 \internal
1271*/ 1271*/
1272int QPEApplication::defaultRotation() 1272int QPEApplication::defaultRotation()
1273{ 1273{
1274 if ( deforient < 0 ) { 1274 if ( deforient < 0 ) {
1275 QString d = getenv( "QWS_DISPLAY" ); 1275 QString d = getenv( "QWS_DISPLAY" );
1276 if ( d.contains( "Rot90" ) ) { 1276 if ( d.contains( "Rot90" ) ) {
1277 deforient = 90; 1277 deforient = 90;
1278 } 1278 }
1279 else if ( d.contains( "Rot180" ) ) { 1279 else if ( d.contains( "Rot180" ) ) {
1280 deforient = 180; 1280 deforient = 180;
1281 } 1281 }
1282 else if ( d.contains( "Rot270" ) ) { 1282 else if ( d.contains( "Rot270" ) ) {
1283 deforient = 270; 1283 deforient = 270;
1284 } 1284 }
1285 else { 1285 else {
1286 deforient = 0; 1286 deforient = 0;
1287 } 1287 }
1288 } 1288 }
1289 return deforient; 1289 return deforient;
1290} 1290}
1291 1291
1292/*! 1292/*!
1293 \internal 1293 \internal
1294*/ 1294*/
1295void QPEApplication::setDefaultRotation( int r ) 1295void QPEApplication::setDefaultRotation( int r )
1296{ 1296{
1297 if ( qApp->type() == GuiServer ) { 1297 if ( qApp->type() == GuiServer ) {
1298 deforient = r; 1298 deforient = r;
1299 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1299 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1300 Config config("qpe"); 1300 Config config("qpe");
1301 config.setGroup( "Rotation" ); 1301 config.setGroup( "Rotation" );
1302 config.writeEntry( "Rot", r ); 1302 config.writeEntry( "Rot", r );
1303 } 1303 }
1304 else { 1304 else {
1305#ifndef QT_NO_COP 1305#ifndef QT_NO_COP
1306 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1306 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1307 e << r; 1307 e << r;
1308 } 1308 }
1309#endif 1309#endif
1310 1310
1311 } 1311 }
1312} 1312}
1313 1313
1314#include <qgfx_qws.h> 1314#include <qgfx_qws.h>
1315#include <qwindowsystem_qws.h> 1315#include <qwindowsystem_qws.h>
1316 1316
1317#if QT_VERSION > 236 1317#if QT_VERSION > 236
1318extern void qws_clearLoadedFonts(); 1318extern void qws_clearLoadedFonts();
1319#endif 1319#endif
1320 1320
1321void QPEApplication::setCurrentMode( int x, int y, int depth ) 1321void QPEApplication::setCurrentMode( int x, int y, int depth )
1322{ 1322{
1323 // Reset the caches 1323 // Reset the caches
1324#if QT_VERSION > 236 1324#if QT_VERSION > 236
1325 qws_clearLoadedFonts(); 1325 qws_clearLoadedFonts();
1326#endif 1326#endif
1327 QPixmapCache::clear(); 1327 QPixmapCache::clear();
1328 1328
1329 // Change the screen mode 1329 // Change the screen mode
1330 qt_screen->setMode(x, y, depth); 1330 qt_screen->setMode(x, y, depth);
1331 1331
1332 if ( qApp->type() == GuiServer ) { 1332 if ( qApp->type() == GuiServer ) {
1333#if QT_VERSION > 236 1333#if QT_VERSION > 236
1334 // Reconfigure the GuiServer 1334 // Reconfigure the GuiServer
1335 qwsServer->beginDisplayReconfigure(); 1335 qwsServer->beginDisplayReconfigure();
1336 qwsServer->endDisplayReconfigure(); 1336 qwsServer->endDisplayReconfigure();
1337#endif 1337#endif
1338 // Get all the running apps to reset 1338 // Get all the running apps to reset
1339 QCopEnvelope env( "QPE/System", "reset()" ); 1339 QCopEnvelope env( "QPE/System", "reset()" );
1340 } 1340 }
1341} 1341}
1342 1342
1343void QPEApplication::reset() { 1343void QPEApplication::reset() {
1344 // Reconnect to the screen 1344 // Reconnect to the screen
1345 qt_screen->disconnect(); 1345 qt_screen->disconnect();
1346 qt_screen->connect( QString::null ); 1346 qt_screen->connect( QString::null );
1347 1347
1348 // Redraw everything 1348 // Redraw everything
1349 applyStyle(); 1349 applyStyle();
1350} 1350}
1351 1351
1352#if (QT_VERSION < 238) && defined Q_OS_MACX 1352#if (QT_VERSION < 238) && defined Q_OS_MACX
1353bool qt_left_hand_scrollbars = false; 1353bool qt_left_hand_scrollbars = false;
1354#else 1354#else
1355#ifdef Q_OS_MACX 1355#ifdef Q_OS_MACX
1356#define WEAK_SYMBOL __attribute__((weak_import)) 1356#define WEAK_SYMBOL __attribute__((weak_import))
1357#else 1357#else
1358#define WEAK_SYMBOL __attribute__((weak)) 1358#define WEAK_SYMBOL __attribute__((weak))
1359#endif 1359#endif
1360extern bool qt_left_hand_scrollbars WEAK_SYMBOL; 1360extern bool qt_left_hand_scrollbars WEAK_SYMBOL;
1361#endif 1361#endif
1362 1362
1363/*! 1363/*!
1364 \internal 1364 \internal
1365*/ 1365*/
1366void QPEApplication::applyStyle() 1366void QPEApplication::applyStyle()
1367{ 1367{
1368 Config config( "qpe" ); 1368 Config config( "qpe" );
1369 config.setGroup( "Appearance" ); 1369 config.setGroup( "Appearance" );
1370 1370
1371#if QT_VERSION > 233 1371#if QT_VERSION > 233
1372#if !defined(OPIE_NO_OVERRIDE_QT) 1372#if !defined(OPIE_NO_OVERRIDE_QT)
1373 // don't block ourselves ... 1373 // don't block ourselves ...
1374 Opie::force_appearance = 0; 1374 Opie::force_appearance = 0;
1375 1375
1376 static QString appname = Opie::binaryName ( ); 1376 static QString appname = Opie::binaryName ( );
1377 1377
1378 QStringList ex = config. readListEntry ( "NoStyle", ';' ); 1378 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1379 int nostyle = 0; 1379 int nostyle = 0;
1380 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { 1380 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1381 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { 1381 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1382 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); 1382 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1383 break; 1383 break;
1384 } 1384 }
1385 } 1385 }
1386#else 1386#else
1387 int nostyle = 0; 1387 int nostyle = 0;
1388#endif 1388#endif
1389 1389
1390 // Widget style 1390 // Widget style
1391 QString style = config.readEntry( "Style", "FlatStyle" ); 1391 QString style = config.readEntry( "Style", "FlatStyle" );
1392 1392
1393 // don't set a custom style 1393 // don't set a custom style
1394 if ( nostyle & Opie::Force_Style ) 1394 if ( nostyle & Opie::Force_Style )
1395 style = "FlatStyle"; 1395 style = "FlatStyle";
1396 1396
1397 internalSetStyle ( style ); 1397 internalSetStyle ( style );
1398 1398
1399 // Colors - from /etc/colors/Liquid.scheme 1399 // Colors - from /etc/colors/Liquid.scheme
1400 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1400 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1401 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1401 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1402 QPalette pal( btncolor, bgcolor ); 1402 QPalette pal( btncolor, bgcolor );
1403 QString color = config.readEntry( "Highlight", "#73adef" ); 1403 QString color = config.readEntry( "Highlight", "#73adef" );
1404 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1404 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1405 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1405 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1406 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1406 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1407 color = config.readEntry( "Text", "#000000" ); 1407 color = config.readEntry( "Text", "#000000" );
1408 pal.setColor( QColorGroup::Text, QColor( color ) ); 1408 pal.setColor( QColorGroup::Text, QColor( color ) );
1409 color = config.readEntry( "ButtonText", "#000000" ); 1409 color = config.readEntry( "ButtonText", "#000000" );
1410 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1410 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1411 color = config.readEntry( "Base", "#FFFFFF" ); 1411 color = config.readEntry( "Base", "#FFFFFF" );
1412 pal.setColor( QColorGroup::Base, QColor( color ) ); 1412 pal.setColor( QColorGroup::Base, QColor( color ) );
1413 1413
1414 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1414 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1415 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1415 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1416 1416
1417 setPalette( pal, TRUE ); 1417 setPalette( pal, TRUE );
1418 1418
1419 1419
1420 // Set the ScrollBar on the 'right' side but only if the weak symbol is present 1420 // Set the ScrollBar on the 'right' side but only if the weak symbol is present
1421 if (&qt_left_hand_scrollbars ) 1421 if (&qt_left_hand_scrollbars )
1422 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); 1422 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false );
1423 1423
1424 // Window Decoration 1424 // Window Decoration
1425 QString dec = config.readEntry( "Decoration", "Flat" ); 1425 QString dec = config.readEntry( "Decoration", "Flat" );
1426 1426
1427 // don't set a custom deco 1427 // don't set a custom deco
1428 if ( nostyle & Opie::Force_Decoration ) 1428 if ( nostyle & Opie::Force_Decoration )
1429 dec = ""; 1429 dec = "";
1430 1430
1431 1431
1432 if ( dec != d->decorationName ) { 1432 if ( dec != d->decorationName ) {
1433 qwsSetDecoration( new QPEDecoration( dec ) ); 1433 qwsSetDecoration( new QPEDecoration( dec ) );
1434 d->decorationName = dec; 1434 d->decorationName = dec;
1435 } 1435 }
1436 1436
1437 // Font 1437 // Font
1438 QString ff = config.readEntry( "FontFamily", font().family() ); 1438 QString ff = config.readEntry( "FontFamily", font().family() );
1439 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 1439 int fs = config.readNumEntry( "FontSize", font().pointSize() );
1440 1440
1441 // don't set a custom font 1441 // don't set a custom font
1442 if ( nostyle & Opie::Force_Font ) { 1442 if ( nostyle & Opie::Force_Font ) {
1443 ff = "Vera"; 1443 ff = "Vera";
1444 fs = 10; 1444 fs = 10;
1445 } 1445 }
1446 1446
1447 setFont ( QFont ( ff, fs ), true ); 1447 setFont ( QFont ( ff, fs ), true );
1448 1448
1449#if !defined(OPIE_NO_OVERRIDE_QT) 1449#if !defined(OPIE_NO_OVERRIDE_QT)
1450 // revert to global blocking policy ... 1450 // revert to global blocking policy ...
1451 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; 1451 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
1452 Opie::force_appearance &= ~nostyle; 1452 Opie::force_appearance &= ~nostyle;
1453#endif 1453#endif
1454#endif 1454#endif
1455} 1455}
1456 1456
1457void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1457void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
1458{ 1458{
1459#ifdef Q_WS_QWS 1459#ifdef Q_WS_QWS
1460 QDataStream stream( data, IO_ReadOnly ); 1460 QDataStream stream( data, IO_ReadOnly );
1461 if ( msg == "applyStyle()" ) { 1461 if ( msg == "applyStyle()" ) {
1462 applyStyle(); 1462 applyStyle();
1463 } 1463 }
1464 else if ( msg == "toggleApplicationMenu()" ) { 1464 else if ( msg == "toggleApplicationMenu()" ) {
1465 QWidget *active = activeWindow ( ); 1465 QWidget *active = activeWindow ( );
1466 1466
1467 if ( active ) { 1467 if ( active ) {
1468 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); 1468 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
1469 bool oldactive = man-> isActive ( ); 1469 bool oldactive = man-> isActive ( );
1470 1470
1471 man-> setActive( !man-> isActive() ); 1471 man-> setActive( !man-> isActive() );
1472 1472
1473 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu 1473 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
1474 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); 1474 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
1475 } 1475 }
1476 } 1476 }
1477 } 1477 }
1478 else if ( msg == "setDefaultRotation(int)" ) { 1478 else if ( msg == "setDefaultRotation(int)" ) {
1479 if ( type() == GuiServer ) { 1479 if ( type() == GuiServer ) {
1480 int r; 1480 int r;
1481 stream >> r; 1481 stream >> r;
1482 setDefaultRotation( r ); 1482 setDefaultRotation( r );
1483 } 1483 }
1484 } 1484 }
1485 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> 1485 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
1486 if ( type() == GuiServer ) { 1486 if ( type() == GuiServer ) {
1487 int x, y, depth; 1487 int x, y, depth;
1488 stream >> x; 1488 stream >> x;
1489 stream >> y; 1489 stream >> y;
1490 stream >> depth; 1490 stream >> depth;
1491 setCurrentMode( x, y, depth ); 1491 setCurrentMode( x, y, depth );
1492 } 1492 }
1493 } 1493 }
1494 else if ( msg == "reset()" ) { 1494 else if ( msg == "reset()" ) {
1495 if ( type() != GuiServer ) 1495 if ( type() != GuiServer )
1496 reset(); 1496 reset();
1497 } 1497 }
1498 else if ( msg == "setCurrentRotation(int)" ) { 1498 else if ( msg == "setCurrentRotation(int)" ) {
1499 int r; 1499 int r;
1500 stream >> r; 1500 stream >> r;
1501 setCurrentRotation( r ); 1501 setCurrentRotation( r );
1502 } 1502 }
1503 else if ( msg == "shutdown()" ) { 1503 else if ( msg == "shutdown()" ) {
1504 if ( type() == GuiServer ) 1504 if ( type() == GuiServer )
1505 shutdown(); 1505 shutdown();
1506 } 1506 }
1507 else if ( msg == "quit()" ) { 1507 else if ( msg == "quit()" ) {
1508 if ( type() != GuiServer ) 1508 if ( type() != GuiServer )
1509 tryQuit(); 1509 tryQuit();
1510 } 1510 }
1511 else if ( msg == "forceQuit()" ) { 1511 else if ( msg == "forceQuit()" ) {
1512 if ( type() != GuiServer ) 1512 if ( type() != GuiServer )
1513 quit(); 1513 quit();
1514 } 1514 }
1515 else if ( msg == "restart()" ) { 1515 else if ( msg == "restart()" ) {
1516 if ( type() == GuiServer ) 1516 if ( type() == GuiServer )
1517 restart(); 1517 restart();
1518 } 1518 }
1519 else if ( msg == "language(QString)" ) { 1519 else if ( msg == "language(QString)" ) {
1520 if ( type() == GuiServer ) { 1520 if ( type() == GuiServer ) {
1521 QString l; 1521 QString l;
1522 stream >> l; 1522 stream >> l;
1523 QString cl = getenv( "LANG" ); 1523 QString cl = getenv( "LANG" );
1524 if ( cl != l ) { 1524 if ( cl != l ) {
1525 if ( l.isNull() ) 1525 if ( l.isNull() )
1526 unsetenv( "LANG" ); 1526 unsetenv( "LANG" );
1527 else 1527 else
1528 setenv( "LANG", l.latin1(), 1 ); 1528 setenv( "LANG", l.latin1(), 1 );
1529 restart(); 1529 restart();
1530 } 1530 }
1531 } 1531 }
1532 } 1532 }
1533 else if ( msg == "timeChange(QString)" ) { 1533 else if ( msg == "timeChange(QString)" ) {
1534 QString t; 1534 QString t;
1535 stream >> t; 1535 stream >> t;
1536 if ( t.isNull() ) 1536 if ( t.isNull() )
1537 unsetenv( "TZ" ); 1537 unsetenv( "TZ" );
1538 else 1538 else
1539 setenv( "TZ", t.latin1(), 1 ); 1539 setenv( "TZ", t.latin1(), 1 );
1540 // emit the signal so everyone else knows... 1540 // emit the signal so everyone else knows...
1541 emit timeChanged(); 1541 emit timeChanged();
1542 } 1542 }
1543 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { 1543 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
1544 if ( type() == GuiServer ) { 1544 if ( type() == GuiServer ) {
1545 QDateTime when; 1545 QDateTime when;
1546 QCString channel, message; 1546 QCString channel, message;
1547 int data; 1547 int data;
1548 stream >> when >> channel >> message >> data; 1548 stream >> when >> channel >> message >> data;
1549 AlarmServer::addAlarm( when, channel, message, data ); 1549 AlarmServer::addAlarm( when, channel, message, data );
1550 } 1550 }
1551 } 1551 }
1552 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { 1552 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
1553 if ( type() == GuiServer ) { 1553 if ( type() == GuiServer ) {
1554 QDateTime when; 1554 QDateTime when;
1555 QCString channel, message; 1555 QCString channel, message;
1556 int data; 1556 int data;
1557 stream >> when >> channel >> message >> data; 1557 stream >> when >> channel >> message >> data;
1558 AlarmServer::deleteAlarm( when, channel, message, data ); 1558 AlarmServer::deleteAlarm( when, channel, message, data );
1559 } 1559 }
1560 } 1560 }
1561 else if ( msg == "clockChange(bool)" ) { 1561 else if ( msg == "clockChange(bool)" ) {
1562 int tmp; 1562 int tmp;
1563 stream >> tmp; 1563 stream >> tmp;
1564 emit clockChanged( tmp ); 1564 emit clockChanged( tmp );
1565 } 1565 }
1566 else if ( msg == "weekChange(bool)" ) { 1566 else if ( msg == "weekChange(bool)" ) {
1567 int tmp; 1567 int tmp;
1568 stream >> tmp; 1568 stream >> tmp;
1569 emit weekChanged( tmp ); 1569 emit weekChanged( tmp );
1570 } 1570 }
1571 else if ( msg == "setDateFormat(DateFormat)" ) { 1571 else if ( msg == "setDateFormat(DateFormat)" ) {
1572 DateFormat tmp; 1572 DateFormat tmp;
1573 stream >> tmp; 1573 stream >> tmp;
1574 emit dateFormatChanged( tmp ); 1574 emit dateFormatChanged( tmp );
1575 } 1575 }
1576 else if ( msg == "setVolume(int,int)" ) { 1576 else if ( msg == "setVolume(int,int)" ) {
1577 int t, v; 1577 int t, v;
1578 stream >> t >> v; 1578 stream >> t >> v;
1579 setVolume( t, v ); 1579 setVolume( t, v );
1580 emit volumeChanged( muted ); 1580 emit volumeChanged( muted );
1581 } 1581 }
1582 else if ( msg == "volumeChange(bool)" ) { 1582 else if ( msg == "volumeChange(bool)" ) {
1583 stream >> muted; 1583 stream >> muted;
1584 setVolume(); 1584 setVolume();
1585 emit volumeChanged( muted ); 1585 emit volumeChanged( muted );
1586 } 1586 }
1587 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1587 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1588 int t, v; 1588 int t, v;
1589 stream >> t >> v; 1589 stream >> t >> v;
1590 setMic( t, v ); 1590 setMic( t, v );
1591 emit micChanged( micMuted ); 1591 emit micChanged( micMuted );
1592 } 1592 }
1593 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1593 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1594 stream >> micMuted; 1594 stream >> micMuted;
1595 setMic(); 1595 setMic();
1596 emit micChanged( micMuted ); 1596 emit micChanged( micMuted );
1597 } 1597 }
1598 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1598 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1599 int t, v; 1599 int t, v;
1600 stream >> t >> v; 1600 stream >> t >> v;
1601 setBass( t, v ); 1601 setBass( t, v );
1602 } 1602 }
1603 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1603 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1604 setBass(); 1604 setBass();
1605 } 1605 }
1606 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1606 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1607 int t, v; 1607 int t, v;
1608 stream >> t >> v; 1608 stream >> t >> v;
1609 setTreble( t, v ); 1609 setTreble( t, v );
1610 } 1610 }
1611 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1611 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1612 setTreble(); 1612 setTreble();
1613 } else if ( msg == "getMarkedText()" ) { 1613 } else if ( msg == "getMarkedText()" ) {
1614 if ( type() == GuiServer ) { 1614 if ( type() == GuiServer ) {
1615 const ushort unicode = 'C'-'@'; 1615 const ushort unicode = 'C'-'@';
1616 const int scan = Key_C; 1616 const int scan = Key_C;
1617 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); 1617 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
1618 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); 1618 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
1619 } 1619 }
1620 } else if ( msg == "newChannel(QString)") { 1620 } else if ( msg == "newChannel(QString)") {
1621 QString myChannel = "QPE/Application/" + d->appName; 1621 QString myChannel = "QPE/Application/" + d->appName;
1622 QString channel; 1622 QString channel;
1623 stream >> channel; 1623 stream >> channel;
1624 if (channel == myChannel) { 1624 if (channel == myChannel) {
1625 processQCopFile(); 1625 processQCopFile();
1626 d->sendQCopQ(); 1626 d->sendQCopQ();
1627 } 1627 }
1628 } 1628 }
1629 1629
1630 1630
1631#endif 1631#endif
1632} 1632}
1633 1633
1634 1634
1635 1635
1636 1636
1637 1637
1638/*! 1638/*!
1639 \internal 1639 \internal
1640*/ 1640*/
1641bool QPEApplication::raiseAppropriateWindow() 1641bool QPEApplication::raiseAppropriateWindow()
1642{ 1642{
1643 bool r=FALSE; 1643 bool r=FALSE;
1644 1644
1645 // 1. Raise the main widget 1645 // 1. Raise the main widget
1646 QWidget *top = d->qpe_main_widget; 1646 QWidget *top = d->qpe_main_widget;
1647 if ( !top ) top = mainWidget(); 1647 if ( !top ) top = mainWidget();
1648 1648
1649 if ( top && d->keep_running ) { 1649 if ( top && d->keep_running ) {
1650 if ( top->isVisible() ) 1650 if ( top->isVisible() )
1651 r = TRUE; 1651 r = TRUE;
1652 else if (d->preloaded) { 1652 else if (d->preloaded) {
1653 // We are preloaded and not visible.. pretend we just started.. 1653 // We are preloaded and not visible.. pretend we just started..
1654#ifndef QT_NO_COP 1654#ifndef QT_NO_COP
1655 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1655 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1656 e << d->appName; 1656 e << d->appName;
1657#endif 1657#endif
1658 } 1658 }
1659 1659
1660 d->show_mx(top,d->nomaximize, d->appName); 1660 d->show_mx(top,d->nomaximize, d->appName);
1661 top->raise(); 1661 top->raise();
1662 } 1662 }
1663 1663
1664 QWidget *topm = activeModalWidget(); 1664 QWidget *topm = activeModalWidget();
1665 1665
1666 // 2. Raise any parentless widgets (except top and topm, as they 1666 // 2. Raise any parentless widgets (except top and topm, as they
1667 // are raised before and after this loop). Order from most 1667 // are raised before and after this loop). Order from most
1668 // recently raised as deepest to least recently as top, so 1668 // recently raised as deepest to least recently as top, so
1669 // that repeated calls cycle through widgets. 1669 // that repeated calls cycle through widgets.
1670 QWidgetList *list = topLevelWidgets(); 1670 QWidgetList *list = topLevelWidgets();
1671 if ( list ) { 1671 if ( list ) {
1672 bool foundlast = FALSE; 1672 bool foundlast = FALSE;
1673 QWidget* topsub = 0; 1673 QWidget* topsub = 0;
1674 if ( d->lastraised ) { 1674 if ( d->lastraised ) {
1675 for (QWidget* w = list->first(); w; w = list->next()) { 1675 for (QWidget* w = list->first(); w; w = list->next()) {
1676 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1676 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1677 if ( w == d->lastraised ) 1677 if ( w == d->lastraised )
1678 foundlast = TRUE; 1678 foundlast = TRUE;
1679 if ( foundlast ) { 1679 if ( foundlast ) {
1680 w->raise(); 1680 w->raise();
1681 topsub = w; 1681 topsub = w;
1682 } 1682 }
1683 } 1683 }
1684 } 1684 }
1685 } 1685 }
1686 for (QWidget* w = list->first(); w; w = list->next()) { 1686 for (QWidget* w = list->first(); w; w = list->next()) {
1687 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1687 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1688 if ( w == d->lastraised ) 1688 if ( w == d->lastraised )
1689 break; 1689 break;
1690 w->raise(); 1690 w->raise();
1691 topsub = w; 1691 topsub = w;
1692 } 1692 }
1693 } 1693 }
1694 d->lastraised = topsub; 1694 d->lastraised = topsub;
1695 delete list; 1695 delete list;
1696 } 1696 }
1697 1697
1698 // 3. Raise the active modal widget. 1698 // 3. Raise the active modal widget.
1699 if ( topm ) { 1699 if ( topm ) {
1700 topm->show(); 1700 topm->show();
1701 topm->raise(); 1701 topm->raise();
1702 // If we haven't already handled the fastAppShowing message 1702 // If we haven't already handled the fastAppShowing message
1703 if (!top && d->preloaded) { 1703 if (!top && d->preloaded) {
1704#ifndef QT_NO_COP 1704#ifndef QT_NO_COP
1705 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1705 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1706 e << d->appName; 1706 e << d->appName;
1707#endif 1707#endif
1708 } 1708 }
1709 r = FALSE; 1709 r = FALSE;
1710 } 1710 }
1711 1711
1712 return r; 1712 return r;
1713} 1713}
1714 1714
1715 1715
1716void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) 1716void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1717{ 1717{
1718#ifdef Q_WS_QWS 1718#ifdef Q_WS_QWS
1719 1719
1720 if ( msg == "quit()" ) { 1720 if ( msg == "quit()" ) {
1721 tryQuit(); 1721 tryQuit();
1722 } 1722 }
1723 else if ( msg == "quitIfInvisible()" ) { 1723 else if ( msg == "quitIfInvisible()" ) {
1724 if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) 1724 if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() )
1725 quit(); 1725 quit();
1726 } 1726 }
1727 else if ( msg == "close()" ) { 1727 else if ( msg == "close()" ) {
1728 hideOrQuit(); 1728 hideOrQuit();
1729 } 1729 }
1730 else if ( msg == "disablePreload()" ) { 1730 else if ( msg == "disablePreload()" ) {
1731 d->preloaded = FALSE; 1731 d->preloaded = FALSE;
1732 d->keep_running = TRUE; 1732 d->keep_running = TRUE;
1733 /* so that quit will quit */ 1733 /* so that quit will quit */
1734 } 1734 }
1735 else if ( msg == "enablePreload()" ) { 1735 else if ( msg == "enablePreload()" ) {
1736 if (d->qpe_main_widget) 1736 if (d->qpe_main_widget)
1737 d->preloaded = TRUE; 1737 d->preloaded = TRUE;
1738 d->keep_running = TRUE; 1738 d->keep_running = TRUE;
1739 /* so next quit won't quit */ 1739 /* so next quit won't quit */
1740 } 1740 }
1741 else if ( msg == "raise()" ) { 1741 else if ( msg == "raise()" ) {
1742 d->keep_running = TRUE; 1742 d->keep_running = TRUE;
1743 d->notbusysent = FALSE; 1743 d->notbusysent = FALSE;
1744 raiseAppropriateWindow(); 1744 raiseAppropriateWindow();
1745 // Tell the system we're still chugging along... 1745 // Tell the system we're still chugging along...
1746 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1746 QCopEnvelope e("QPE/System", "appRaised(QString)");
1747 e << d->appName; 1747 e << d->appName;
1748 } 1748 }
1749 else if ( msg == "flush()" ) { 1749 else if ( msg == "flush()" ) {
1750 emit flush(); 1750 emit flush();
1751 // we need to tell the desktop 1751 // we need to tell the desktop
1752 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); 1752 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" );
1753 e << d->appName; 1753 e << d->appName;
1754 } 1754 }
1755 else if ( msg == "reload()" ) { 1755 else if ( msg == "reload()" ) {
1756 emit reload(); 1756 emit reload();
1757 } 1757 }
1758 else if ( msg == "setDocument(QString)" ) { 1758 else if ( msg == "setDocument(QString)" ) {
1759 d->keep_running = TRUE; 1759 d->keep_running = TRUE;
1760 QDataStream stream( data, IO_ReadOnly ); 1760 QDataStream stream( data, IO_ReadOnly );
1761 QString doc; 1761 QString doc;
1762 stream >> doc; 1762 stream >> doc;
1763 QWidget *mw = mainWidget(); 1763 QWidget *mw = mainWidget();
1764 if ( !mw ) 1764 if ( !mw )
1765 mw = d->qpe_main_widget; 1765 mw = d->qpe_main_widget;
1766 if ( mw ) 1766 if ( mw )
1767 Global::setDocument( mw, doc ); 1767 Global::setDocument( mw, doc );
1768 1768
1769 } else if ( msg == "QPEProcessQCop()" ) { 1769 } else if ( msg == "QPEProcessQCop()" ) {
1770 processQCopFile(); 1770 processQCopFile();
1771 d->sendQCopQ(); 1771 d->sendQCopQ();
1772 }else 1772 }else
1773 { 1773 {
1774 bool p = d->keep_running; 1774 bool p = d->keep_running;
1775 d->keep_running = FALSE; 1775 d->keep_running = FALSE;
1776 emit appMessage( msg, data); 1776 emit appMessage( msg, data);
1777 if ( d->keep_running ) { 1777 if ( d->keep_running ) {
1778 d->notbusysent = FALSE; 1778 d->notbusysent = FALSE;
1779 raiseAppropriateWindow(); 1779 raiseAppropriateWindow();
1780 if ( !p ) { 1780 if ( !p ) {
1781 // Tell the system we're still chugging along... 1781 // Tell the system we're still chugging along...
1782#ifndef QT_NO_COP 1782#ifndef QT_NO_COP
1783 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1783 QCopEnvelope e("QPE/System", "appRaised(QString)");
1784 e << d->appName; 1784 e << d->appName;
1785#endif 1785#endif
1786 } 1786 }
1787 } 1787 }
1788 if ( p ) 1788 if ( p )
1789 d->keep_running = p; 1789 d->keep_running = p;
1790 } 1790 }
1791#endif 1791#endif
1792} 1792}
1793 1793
1794 1794
1795/*! 1795/*!
1796 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1796 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1797 consider passing TRUE for \a nomaximize rather than the default FALSE. 1797 consider passing TRUE for \a nomaximize rather than the default FALSE.
1798 1798
1799 \sa showMainDocumentWidget() 1799 \sa showMainDocumentWidget()
1800*/ 1800*/
1801void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) 1801void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
1802{ 1802{
1803// setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit 1803// setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit
1804 d->show(mw, nomaximize ); 1804 d->show(mw, nomaximize );
1805} 1805}
1806 1806
1807/*! 1807/*!
1808 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1808 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1809 consider passing TRUE for \a nomaximize rather than the default FALSE. 1809 consider passing TRUE for \a nomaximize rather than the default FALSE.
1810 1810
1811 This calls designates the application as 1811 This calls designates the application as
1812 a \link docwidget.html document-oriented\endlink application. 1812 a \link docwidget.html document-oriented\endlink application.
1813 1813
1814 The \a mw widget \e must have this slot: setDocument(const QString&). 1814 The \a mw widget \e must have this slot: setDocument(const QString&).
1815 1815
1816 \sa showMainWidget() 1816 \sa showMainWidget()
1817*/ 1817*/
1818void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) 1818void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
1819{ 1819{
1820 if ( mw && argc() == 2 ) 1820 if ( mw && argc() == 2 )
1821 Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); 1821 Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
1822 1822
1823 1823
1824// setMainWidget(mw); see above 1824// setMainWidget(mw); see above
1825 d->show(mw, nomaximize ); 1825 d->show(mw, nomaximize );
1826} 1826}
1827 1827
1828 1828
1829/*! 1829/*!
1830 If an application is started via a \link qcop.html QCop\endlink 1830 If an application is started via a \link qcop.html QCop\endlink
1831 message, the application will process the \link qcop.html 1831 message, the application will process the \link qcop.html
1832 QCop\endlink message and then quit. If the application calls this 1832 QCop\endlink message and then quit. If the application calls this
1833 function while processing a \link qcop.html QCop\endlink message, 1833 function while processing a \link qcop.html QCop\endlink message,
1834 after processing its outstanding \link qcop.html QCop\endlink 1834 after processing its outstanding \link qcop.html QCop\endlink
1835 messages the application will start 'properly' and show itself. 1835 messages the application will start 'properly' and show itself.
1836 1836
1837 \sa keepRunning() 1837 \sa keepRunning()
1838*/ 1838*/
1839void QPEApplication::setKeepRunning() 1839void QPEApplication::setKeepRunning()
1840{ 1840{
1841 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 1841 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
1842 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 1842 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
1843 qpeApp->d->keep_running = TRUE; 1843 qpeApp->d->keep_running = TRUE;
1844 } 1844 }
1845} 1845}
1846 1846
1847/*! 1847/*!
1848 Returns TRUE if the application will quit after processing the 1848 Returns TRUE if the application will quit after processing the
1849 current list of qcop messages; otherwise returns FALSE. 1849 current list of qcop messages; otherwise returns FALSE.
1850 1850
1851 \sa setKeepRunning() 1851 \sa setKeepRunning()
1852*/ 1852*/
1853bool QPEApplication::keepRunning() const 1853bool QPEApplication::keepRunning() const
1854{ 1854{
1855 return d->keep_running; 1855 return d->keep_running;
1856} 1856}
1857 1857
1858/*! 1858/*!
1859 \internal 1859 \internal
1860*/ 1860*/
1861void QPEApplication::internalSetStyle( const QString &style ) 1861void QPEApplication::internalSetStyle( const QString &style )
1862{ 1862{
1863#if QT_VERSION >= 300 1863#if QT_VERSION >= 300
1864 if ( style == "QPE" ) { 1864 if ( style == "QPE" ) {
1865 setStyle( new QPEStyle ); 1865 setStyle( new QPEStyle );
1866 } 1866 }
1867 else { 1867 else {
1868 QStyle *s = QStyleFactory::create( style ); 1868 QStyle *s = QStyleFactory::create( style );
1869 if ( s ) 1869 if ( s )
1870 setStyle( s ); 1870 setStyle( s );
1871 } 1871 }
1872#else 1872#else
1873 if ( style == "Windows" ) { 1873 if ( style == "Windows" ) {
1874 setStyle( new QWindowsStyle ); 1874 setStyle( new QWindowsStyle );
1875 } 1875 }
1876 else if ( style == "QPE" ) { 1876 else if ( style == "QPE" ) {
1877 setStyle( new QPEStyle ); 1877 setStyle( new QPEStyle );
1878 } 1878 }
1879 else if ( style == "Light" ) { 1879 else if ( style == "Light" ) {
1880 setStyle( new LightStyle ); 1880 setStyle( new LightStyle );
1881 } 1881 }
1882#ifndef QT_NO_STYLE_PLATINUM 1882#ifndef QT_NO_STYLE_PLATINUM
1883 else if ( style == "Platinum" ) { 1883 else if ( style == "Platinum" ) {
1884 setStyle( new QPlatinumStyle ); 1884 setStyle( new QPlatinumStyle );
1885 } 1885 }
1886#endif 1886#endif
1887#ifndef QT_NO_STYLE_MOTIF 1887#ifndef QT_NO_STYLE_MOTIF
1888 else if ( style == "Motif" ) { 1888 else if ( style == "Motif" ) {
1889 setStyle( new QMotifStyle ); 1889 setStyle( new QMotifStyle );
1890 } 1890 }
1891#endif 1891#endif
1892#ifndef QT_NO_STYLE_MOTIFPLUS 1892#ifndef QT_NO_STYLE_MOTIFPLUS
1893 else if ( style == "MotifPlus" ) { 1893 else if ( style == "MotifPlus" ) {
1894 setStyle( new QMotifPlusStyle ); 1894 setStyle( new QMotifPlusStyle );
1895 } 1895 }
1896#endif 1896#endif
1897 1897
1898 else { 1898 else {
1899 QStyle *sty = 0; 1899 QStyle *sty = 0;
1900 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; 1900 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/";
1901 1901
1902#ifdef Q_OS_MACX 1902#ifdef Q_OS_MACX
1903 if ( style. find ( ".dylib" ) > 0 ) 1903 if ( style. find ( ".dylib" ) > 0 )
1904 path += style; 1904 path += style;
1905 else 1905 else
1906 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility 1906 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility
1907#else 1907#else
1908 if ( style. find ( ".so" ) > 0 ) 1908 if ( style. find ( ".so" ) > 0 )
1909 path += style; 1909 path += style;
1910 else 1910 else
1911 path = path + "lib" + style. lower ( ) + ".so"; // compatibility 1911 path = path + "lib" + style. lower ( ) + ".so"; // compatibility
1912#endif 1912#endif
1913 static QLibrary *lastlib = 0; 1913 static QLibrary *lastlib = 0;
1914 static StyleInterface *lastiface = 0; 1914 static StyleInterface *lastiface = 0;
1915 1915
1916 QLibrary *lib = new QLibrary ( path ); 1916 QLibrary *lib = new QLibrary ( path );
1917 StyleInterface *iface = 0; 1917 StyleInterface *iface = 0;
1918 1918
1919 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) 1919 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface )
1920 sty = iface-> style ( ); 1920 sty = iface-> style ( );
1921 1921
1922 if ( sty ) { 1922 if ( sty ) {
1923 setStyle ( sty ); 1923 setStyle ( sty );
1924 1924
1925 if ( lastiface ) 1925 if ( lastiface )
1926 lastiface-> release ( ); 1926 lastiface-> release ( );
1927 lastiface = iface; 1927 lastiface = iface;
1928 1928
1929 if ( lastlib ) { 1929 if ( lastlib ) {
1930 lastlib-> unload ( ); 1930 lastlib-> unload ( );
1931 delete lastlib; 1931 delete lastlib;
1932 } 1932 }
1933 lastlib = lib; 1933 lastlib = lib;
1934 } 1934 }
1935 else { 1935 else {
1936 if ( iface ) 1936 if ( iface )
1937 iface-> release ( ); 1937 iface-> release ( );
1938 delete lib; 1938 delete lib;
1939 1939
1940 setStyle ( new LightStyle ( )); 1940 setStyle ( new LightStyle ( ));
1941 } 1941 }
1942 } 1942 }
1943#endif 1943#endif
1944} 1944}
1945 1945
1946/*! 1946/*!
1947 \internal 1947 \internal
1948*/ 1948*/
1949void QPEApplication::prepareForTermination( bool willrestart ) 1949void QPEApplication::prepareForTermination( bool willrestart )
1950{ 1950{
1951 if ( willrestart ) { 1951 if ( willrestart ) {
1952 // Draw a big wait icon, the image can be altered in later revisions 1952 QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize |
1953 // QWidget *d = QApplication::desktop();
1954 QImage img = Resource::loadImage( "launcher/new_wait" );
1955 QPixmap pix;
1956 pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) );
1957 QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize |
1958 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); 1953 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
1959 lblWait->setPixmap( pix );
1960 lblWait->setAlignment( QWidget::AlignCenter ); 1954 lblWait->setAlignment( QWidget::AlignCenter );
1961 lblWait->show(); 1955 lblWait->show();
1962 lblWait->showMaximized(); 1956 lblWait->showMaximized();
1963 } 1957 }
1964#ifndef SINGLE_APP
1965 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); 1958 { QCopEnvelope envelope( "QPE/System", "forceQuit()" );
1966 } 1959 }
1967 processEvents(); // ensure the message goes out. 1960 processEvents(); // ensure the message goes out.
1968 sleep( 1 ); // You have 1 second to comply.
1969#endif
1970} 1961}
1971 1962
1972/*! 1963/*!
1973 \internal 1964 \internal
1974*/ 1965*/
1975void QPEApplication::shutdown() 1966void QPEApplication::shutdown()
1976{ 1967{
1977 // Implement in server's QPEApplication subclass 1968 // Implement in server's QPEApplication subclass
1978} 1969}
1979 1970
1980/*! 1971/*!
1981 \internal 1972 \internal
1982*/ 1973*/
1983void QPEApplication::restart() 1974void QPEApplication::restart()
1984{ 1975{
1985 // Implement in server's QPEApplication subclass 1976 // Implement in server's QPEApplication subclass
1986} 1977}
1987 1978
1988static QPtrDict<void>* stylusDict = 0; 1979static QPtrDict<void>* stylusDict = 0;
1989static void createDict() 1980static void createDict()
1990{ 1981{
1991 if ( !stylusDict ) 1982 if ( !stylusDict )
1992 stylusDict = new QPtrDict<void>; 1983 stylusDict = new QPtrDict<void>;
1993} 1984}
1994 1985
1995/*! 1986/*!
1996 Returns the current StylusMode for widget \a w. 1987 Returns the current StylusMode for widget \a w.
1997 1988
1998 \sa setStylusOperation() StylusMode 1989 \sa setStylusOperation() StylusMode
1999*/ 1990*/
2000QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) 1991QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
2001{ 1992{
2002 if ( stylusDict ) 1993 if ( stylusDict )
2003 return ( StylusMode ) ( int ) stylusDict->find( w ); 1994 return ( StylusMode ) ( int ) stylusDict->find( w );
2004 return LeftOnly; 1995 return LeftOnly;
2005} 1996}
2006 1997
2007/*! 1998/*!
2008 \enum QPEApplication::StylusMode 1999 \enum QPEApplication::StylusMode
2009 2000
2010 \value LeftOnly the stylus only generates LeftButton 2001 \value LeftOnly the stylus only generates LeftButton
2011 events (the default). 2002 events (the default).
2012 \value RightOnHold the stylus generates RightButton events 2003 \value RightOnHold the stylus generates RightButton events
2013 if the user uses the press-and-hold gesture. 2004 if the user uses the press-and-hold gesture.
2014 2005
2015 \sa setStylusOperation() stylusOperation() 2006 \sa setStylusOperation() stylusOperation()
2016*/ 2007*/
2017 2008
2018/*! 2009/*!
2019 Causes widget \a w to receive mouse events according to the stylus 2010 Causes widget \a w to receive mouse events according to the stylus
2020 \a mode. 2011 \a mode.
2021 2012
2022 \sa stylusOperation() StylusMode 2013 \sa stylusOperation() StylusMode
2023*/ 2014*/
2024void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) 2015void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode )
2025{ 2016{
2026 createDict(); 2017 createDict();
2027 if ( mode == LeftOnly ) { 2018 if ( mode == LeftOnly ) {
2028 stylusDict->remove 2019 stylusDict->remove
2029 ( w ); 2020 ( w );
2030 w->removeEventFilter( qApp ); 2021 w->removeEventFilter( qApp );
2031 } 2022 }
2032 else { 2023 else {
2033 stylusDict->insert( w, ( void* ) mode ); 2024 stylusDict->insert( w, ( void* ) mode );
2034 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); 2025 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
2035 w->installEventFilter( qApp ); 2026 w->installEventFilter( qApp );
2036 } 2027 }
2037} 2028}
2038 2029
2039 2030
2040/*! 2031/*!
2041 \reimp 2032 \reimp
2042*/ 2033*/
2043bool QPEApplication::eventFilter( QObject *o, QEvent *e ) 2034bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2044{ 2035{
2045 if ( !o->isWidgetType() ) 2036 if ( !o->isWidgetType() )
2046 return FALSE; 2037 return FALSE;
2047 2038
2048 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { 2039 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
2049 QMouseEvent * me = ( QMouseEvent* ) e; 2040 QMouseEvent * me = ( QMouseEvent* ) e;
2050 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 2041 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
2051 switch (mode) { 2042 switch (mode) {
2052 case RightOnHold: 2043 case RightOnHold:
2053 switch ( me->type() ) { 2044 switch ( me->type() ) {
2054 case QEvent::MouseButtonPress: 2045 case QEvent::MouseButtonPress:
2055 if ( me->button() == LeftButton ) { 2046 if ( me->button() == LeftButton ) {
2056 static long Pref = 500; // #### pref. 2047 static long Pref = 500; // #### pref.
2057 d->presswidget = (QWidget*)o; 2048 d->presswidget = (QWidget*)o;
2058 d->presspos = me->pos(); 2049 d->presspos = me->pos();
2059 d->rightpressed = FALSE; 2050 d->rightpressed = FALSE;
2060#ifdef OPIE_WITHROHFEEDBACK 2051#ifdef OPIE_WITHROHFEEDBACK
2061 if( ! d->RoH ) 2052 if( ! d->RoH )
2062 d->RoH = new Opie::Internal::RoHFeedback; 2053 d->RoH = new Opie::Internal::RoHFeedback;
2063 2054
2064 d->RoH->init( me->globalPos(), d->presswidget ); 2055 d->RoH->init( me->globalPos(), d->presswidget );
2065 Pref = d->RoH->delay(); 2056 Pref = d->RoH->delay();
2066 2057
2067#endif 2058#endif
2068 if (!d->presstimer ) 2059 if (!d->presstimer )
2069 d->presstimer = startTimer( Pref ); // #### pref. 2060 d->presstimer = startTimer( Pref ); // #### pref.
2070 2061
2071 } 2062 }
2072 break; 2063 break;
2073 case QEvent::MouseMove: 2064 case QEvent::MouseMove:
2074 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 2065 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
2075 killTimer(d->presstimer); 2066 killTimer(d->presstimer);
2076#ifdef OPIE_WITHROHFEEDBACK 2067#ifdef OPIE_WITHROHFEEDBACK
2077 d->RoH->stop(); 2068 d->RoH->stop();
2078#endif 2069#endif
2079 d->presstimer = 0; 2070 d->presstimer = 0;
2080 } 2071 }
2081 break; 2072 break;
2082 case QEvent::MouseButtonRelease: 2073 case QEvent::MouseButtonRelease:
2083 if ( me->button() == LeftButton ) { 2074 if ( me->button() == LeftButton ) {
2084 if ( d->presstimer ) { 2075 if ( d->presstimer ) {
2085 killTimer(d->presstimer); 2076 killTimer(d->presstimer);
2086#ifdef OPIE_WITHROHFEEDBACK 2077#ifdef OPIE_WITHROHFEEDBACK
2087 d->RoH->stop( ); 2078 d->RoH->stop( );
2088#endif 2079#endif
2089 d->presstimer = 0; 2080 d->presstimer = 0;
2090 } 2081 }
2091 if ( d->rightpressed && d->presswidget ) { 2082 if ( d->rightpressed && d->presswidget ) {
2092 printf( "Send ButtonRelease\n" ); 2083 printf( "Send ButtonRelease\n" );
2093 // Right released 2084 // Right released
2094 postEvent( d->presswidget, 2085 postEvent( d->presswidget,
2095 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 2086 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
2096 RightButton, LeftButton + RightButton ) ); 2087 RightButton, LeftButton + RightButton ) );
2097 // Left released, off-widget 2088 // Left released, off-widget
2098 postEvent( d->presswidget, 2089 postEvent( d->presswidget,
2099 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), 2090 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
2100 LeftButton, LeftButton ) ); 2091 LeftButton, LeftButton ) );
2101 postEvent( d->presswidget, 2092 postEvent( d->presswidget,
2102 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), 2093 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
2103 LeftButton, LeftButton ) ); 2094 LeftButton, LeftButton ) );
2104 d->rightpressed = FALSE; 2095 d->rightpressed = FALSE;
2105 return TRUE; // don't send the real Left release 2096 return TRUE; // don't send the real Left release
2106 } 2097 }
2107 } 2098 }
2108 break; 2099 break;
2109 default: 2100 default:
2110 break; 2101 break;
2111 } 2102 }
2112 break; 2103 break;
2113 default: 2104 default:
2114 ; 2105 ;
2115 } 2106 }
2116 } 2107 }
2117 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 2108 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
2118 QKeyEvent *ke = (QKeyEvent *)e; 2109 QKeyEvent *ke = (QKeyEvent *)e;
2119 if ( ke->key() == Key_Enter ) { 2110 if ( ke->key() == Key_Enter ) {
2120 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { 2111 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
2121 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', 2112 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
2122 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); 2113 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
2123 return TRUE; 2114 return TRUE;
2124 } 2115 }
2125 } 2116 }
2126 } 2117 }
2127 return FALSE; 2118 return FALSE;
2128} 2119}
2129 2120
2130/*! 2121/*!
2131 \reimp 2122 \reimp
2132*/ 2123*/
2133void QPEApplication::timerEvent( QTimerEvent *e ) 2124void QPEApplication::timerEvent( QTimerEvent *e )
2134{ 2125{
2135 if ( e->timerId() == d->presstimer && d->presswidget ) { 2126 if ( e->timerId() == d->presstimer && d->presswidget ) {
2136 2127
2137 // Right pressed 2128 // Right pressed
2138 postEvent( d->presswidget, 2129 postEvent( d->presswidget,
2139 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 2130 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
2140 RightButton, LeftButton ) ); 2131 RightButton, LeftButton ) );
2141 killTimer( d->presstimer ); 2132 killTimer( d->presstimer );
2142 d->presstimer = 0; 2133 d->presstimer = 0;
2143 d->rightpressed = TRUE; 2134 d->rightpressed = TRUE;
2144#ifdef OPIE_WITHROHFEEDBACK 2135#ifdef OPIE_WITHROHFEEDBACK
2145 d->RoH->stop(); 2136 d->RoH->stop();
2146#endif 2137#endif
2147 } 2138 }
2148} 2139}
2149 2140
2150void QPEApplication::removeSenderFromStylusDict() 2141void QPEApplication::removeSenderFromStylusDict()
2151{ 2142{
2152 stylusDict->remove 2143 stylusDict->remove
2153 ( ( void* ) sender() ); 2144 ( ( void* ) sender() );
2154 if ( d->presswidget == sender() ) 2145 if ( d->presswidget == sender() )
2155 d->presswidget = 0; 2146 d->presswidget = 0;
2156} 2147}
2157 2148
2158/*! 2149/*!
2159 \internal 2150 \internal
2160*/ 2151*/
2161bool QPEApplication::keyboardGrabbed() const 2152bool QPEApplication::keyboardGrabbed() const
2162{ 2153{
2163 return d->kbgrabbed; 2154 return d->kbgrabbed;
2164} 2155}
2165 2156
2166 2157
2167/*! 2158/*!
2168 Reverses the effect of grabKeyboard(). This is called automatically 2159 Reverses the effect of grabKeyboard(). This is called automatically
2169 on program exit. 2160 on program exit.
2170*/ 2161*/
2171void QPEApplication::ungrabKeyboard() 2162void QPEApplication::ungrabKeyboard()
2172{ 2163{
2173 ((QPEApplication *) qApp )-> d-> kbgrabbed = false; 2164 ((QPEApplication *) qApp )-> d-> kbgrabbed = false;
2174} 2165}
2175 2166
2176/*! 2167/*!
2177 Grabs the physical keyboard keys, e.g. the application's launching 2168 Grabs the physical keyboard keys, e.g. the application's launching
2178 keys. Instead of launching applications when these keys are pressed 2169 keys. Instead of launching applications when these keys are pressed
2179 the signals emitted are sent to this application instead. Some games 2170 the signals emitted are sent to this application instead. Some games
2180 programs take over the launch keys in this way to make interaction 2171 programs take over the launch keys in this way to make interaction
2181 easier. 2172 easier.
2182 2173
2183 \sa ungrabKeyboard() 2174 \sa ungrabKeyboard()
2184*/ 2175*/
2185void QPEApplication::grabKeyboard() 2176void QPEApplication::grabKeyboard()
2186{ 2177{
2187 ((QPEApplication *) qApp )-> d-> kbgrabbed = true; 2178 ((QPEApplication *) qApp )-> d-> kbgrabbed = true;
2188} 2179}
2189 2180
2190/*! 2181/*!
2191 \reimp 2182 \reimp
2192*/ 2183*/
2193int QPEApplication::exec() 2184int QPEApplication::exec()
2194{ 2185{
2195 d->qcopQok = true; 2186 d->qcopQok = true;
2196#ifndef QT_NO_COP 2187#ifndef QT_NO_COP
2197 d->sendQCopQ(); 2188 d->sendQCopQ();
2198 if ( !d->keep_running ) 2189 if ( !d->keep_running )
2199 processEvents(); // we may have received QCop messages in the meantime. 2190 processEvents(); // we may have received QCop messages in the meantime.
2200#endif 2191#endif
2201 2192
2202 if ( d->keep_running ) 2193 if ( d->keep_running )
2203 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) 2194 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() )
2204 return QApplication::exec(); 2195 return QApplication::exec();
2205 2196
2206#ifndef QT_NO_COP 2197#ifndef QT_NO_COP
2207 2198
2208 { 2199 {
2209 QCopEnvelope e( "QPE/System", "closing(QString)" ); 2200 QCopEnvelope e( "QPE/System", "closing(QString)" );
2210 e << d->appName; 2201 e << d->appName;
2211 } 2202 }
2212#endif 2203#endif
2213 processEvents(); 2204 processEvents();
2214 return 0; 2205 return 0;
2215} 2206}
2216 2207
2217/*! 2208/*!
2218 \internal 2209 \internal
2219 External request for application to quit. Quits if possible without 2210 External request for application to quit. Quits if possible without
2220 loosing state. 2211 loosing state.
2221*/ 2212*/
2222void QPEApplication::tryQuit() 2213void QPEApplication::tryQuit()
2223{ 2214{
2224 if ( activeModalWidget() ) 2215 if ( activeModalWidget() )
2225 return ; // Inside modal loop or konsole. Too hard to save state. 2216 return ; // Inside modal loop or konsole. Too hard to save state.
2226#ifndef QT_NO_COP 2217#ifndef QT_NO_COP
2227 2218
2228 { 2219 {
2229 QCopEnvelope e( "QPE/System", "closing(QString)" ); 2220 QCopEnvelope e( "QPE/System", "closing(QString)" );
2230 e << d->appName; 2221 e << d->appName;
2231 } 2222 }
2232#endif 2223#endif
2233 if ( d->keep_running ) 2224 if ( d->keep_running )
2234 d->store_widget_rect(d->qpe_main_widget, d->appName); 2225 d->store_widget_rect(d->qpe_main_widget, d->appName);
2235 processEvents(); 2226 processEvents();
2236 2227
2237 quit(); 2228 quit();
2238} 2229}
2239 2230
2240/*! 2231/*!
2241 \internal 2232 \internal
2242*/ 2233*/
2243void QPEApplication::installTranslation( const QString& baseName ) { 2234void QPEApplication::installTranslation( const QString& baseName ) {
2244 QTranslator* trans = new QTranslator(this); 2235 QTranslator* trans = new QTranslator(this);
2245 QString tfn = qpeDir() + "/i18n/"+baseName; 2236 QString tfn = qpeDir() + "/i18n/"+baseName;
2246 if ( trans->load( tfn ) ) 2237 if ( trans->load( tfn ) )
2247 installTranslator( trans ); 2238 installTranslator( trans );
2248 else 2239 else
2249 delete trans; 2240 delete trans;
2250} 2241}
2251 2242
2252/*! 2243/*!
2253 \internal 2244 \internal
2254 User initiated quit. Makes the window 'Go Away'. If preloaded this means 2245 User initiated quit. Makes the window 'Go Away'. If preloaded this means
2255 hiding the window. If not it means quitting the application. 2246 hiding the window. If not it means quitting the application.
2256 As this is user initiated we don't need to check state. 2247 As this is user initiated we don't need to check state.
2257*/ 2248*/
2258void QPEApplication::hideOrQuit() 2249void QPEApplication::hideOrQuit()
2259{ 2250{
2260 if ( d->keep_running ) 2251 if ( d->keep_running )
2261 d->store_widget_rect(d->qpe_main_widget, d->appName); 2252 d->store_widget_rect(d->qpe_main_widget, d->appName);
2262 processEvents(); 2253 processEvents();
2263 2254
2264 // If we are a preloaded application we don't actually quit, so emit 2255 // If we are a preloaded application we don't actually quit, so emit
2265 // a System message indicating we're quasi-closing. 2256 // a System message indicating we're quasi-closing.
2266 if ( d->preloaded && d->qpe_main_widget ) 2257 if ( d->preloaded && d->qpe_main_widget )
2267#ifndef QT_NO_COP 2258#ifndef QT_NO_COP
2268 2259
2269 { 2260 {
2270 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 2261 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
2271 e << d->appName; 2262 e << d->appName;
2272 d->qpe_main_widget->hide(); 2263 d->qpe_main_widget->hide();
2273 } 2264 }
2274#endif 2265#endif
2275 else 2266 else
2276 quit(); 2267 quit();
2277} 2268}
2278 2269
2279#if (__GNUC__ > 2 ) 2270#if (__GNUC__ > 2 )
2280extern "C" void __cxa_pure_virtual(); 2271extern "C" void __cxa_pure_virtual();
2281 2272
2282void __cxa_pure_virtual() 2273void __cxa_pure_virtual()
2283{ 2274{
2284 fprintf( stderr, "Pure virtual called\n"); 2275 fprintf( stderr, "Pure virtual called\n");
2285 abort(); 2276 abort();
2286 2277
2287} 2278}
2288 2279
2289#endif 2280#endif
2290 2281
2291 2282
2292#if defined(OPIE_NEW_MALLOC) 2283#if defined(OPIE_NEW_MALLOC)
2293 2284
2294// The libraries with the skiff package (and possibly others) have 2285// The libraries with the skiff package (and possibly others) have
2295// completely useless implementations of builtin new and delete that 2286// completely useless implementations of builtin new and delete that
2296// use about 50% of your CPU. Here we revert to the simple libc 2287// use about 50% of your CPU. Here we revert to the simple libc
2297// functions. 2288// functions.
2298 2289
2299void* operator new[]( size_t size ) 2290void* operator new[]( size_t size )
2300{ 2291{
2301 return malloc( size ); 2292 return malloc( size );
2302} 2293}
2303 2294
2304void* operator new( size_t size ) 2295void* operator new( size_t size )
2305{ 2296{
2306 return malloc( size ); 2297 return malloc( size );
2307} 2298}
2308 2299
2309void operator delete[]( void* p ) 2300void operator delete[]( void* p )
2310{ 2301{
2311 free( p ); 2302 free( p );
2312} 2303}
2313 2304
2314void operator delete[]( void* p, size_t /*size*/ ) 2305void operator delete[]( void* p, size_t /*size*/ )
2315{ 2306{
2316 free( p ); 2307 free( p );
2317} 2308}
2318 2309
2319 2310
2320void operator delete( void* p ) 2311void operator delete( void* p )
2321{ 2312{
2322 free( p ); 2313 free( p );
2323} 2314}
2324 2315
2325void operator delete( void* p, size_t /*size*/ ) 2316void operator delete( void* p, size_t /*size*/ )
2326{ 2317{
2327 free( p ); 2318 free( p );
2328} 2319}
2329 2320
2330#endif 2321#endif
2331 2322
2332#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) 2323#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP)
2333#include <qwidgetlist.h> 2324#include <qwidgetlist.h>
2334#ifdef QWS 2325#ifdef QWS
2335#include <qgfx_qws.h> 2326#include <qgfx_qws.h>
2336extern QRect qt_maxWindowRect; 2327extern QRect qt_maxWindowRect;
2337void qt_setMaxWindowRect(const QRect& r ) 2328void qt_setMaxWindowRect(const QRect& r )
2338{ 2329{
2339 qt_maxWindowRect = qt_screen->mapFromDevice( r, 2330 qt_maxWindowRect = qt_screen->mapFromDevice( r,
2340 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); 2331 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) );
2341 // Re-resize any maximized windows 2332 // Re-resize any maximized windows
2342 QWidgetList* l = QApplication::topLevelWidgets(); 2333 QWidgetList* l = QApplication::topLevelWidgets();
2343 if ( l ) { 2334 if ( l ) {
2344 QWidget * w = l->first(); 2335 QWidget * w = l->first();
2345 while ( w ) { 2336 while ( w ) {
2346 if ( w->isVisible() && w->isMaximized() ) { 2337 if ( w->isVisible() && w->isMaximized() ) {
2347 w->showMaximized(); 2338 w->showMaximized();
2348 } 2339 }
2349 w = l->next(); 2340 w = l->next();
2350 } 2341 }
2351 delete l; 2342 delete l;
2352 } 2343 }
2353} 2344}
2354#endif 2345#endif
2355#endif 2346#endif