-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 6e2db7c..dff8235 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1256,193 +1256,193 @@ void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | |||
1256 | } | 1256 | } |
1257 | } else if ( d->keep_running ) { | 1257 | } else if ( d->keep_running ) { |
1258 | #ifdef Q_WS_QWS | 1258 | #ifdef Q_WS_QWS |
1259 | if ( !nomaximize ) | 1259 | if ( !nomaximize ) |
1260 | mw->showMaximized(); | 1260 | mw->showMaximized(); |
1261 | else | 1261 | else |
1262 | #endif | 1262 | #endif |
1263 | mw->show(); | 1263 | mw->show(); |
1264 | } | 1264 | } |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | 1267 | ||
1268 | /*! | 1268 | /*! |
1269 | Sets that the application should continue running after processing | 1269 | Sets that the application should continue running after processing |
1270 | qcop messages. Normally if an application is started via a qcop message, | 1270 | qcop messages. Normally if an application is started via a qcop message, |
1271 | the application will process the qcop message and then quit. If while | 1271 | the application will process the qcop message and then quit. If while |
1272 | processing the qcop message it calls this function, then the application | 1272 | processing the qcop message it calls this function, then the application |
1273 | will show and start proper once it has finished processing qcop messages. | 1273 | will show and start proper once it has finished processing qcop messages. |
1274 | 1274 | ||
1275 | \sa keepRunning() | 1275 | \sa keepRunning() |
1276 | */ | 1276 | */ |
1277 | void QPEApplication::setKeepRunning() | 1277 | void QPEApplication::setKeepRunning() |
1278 | { | 1278 | { |
1279 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1279 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1280 | QPEApplication *qpeApp = (QPEApplication*)qApp; | 1280 | QPEApplication *qpeApp = (QPEApplication*)qApp; |
1281 | qpeApp->d->keep_running = TRUE; | 1281 | qpeApp->d->keep_running = TRUE; |
1282 | } | 1282 | } |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | /*! | 1285 | /*! |
1286 | Returns whether the application will quit after processing the current | 1286 | Returns whether the application will quit after processing the current |
1287 | list of qcop messages. | 1287 | list of qcop messages. |
1288 | 1288 | ||
1289 | \sa setKeepRunning() | 1289 | \sa setKeepRunning() |
1290 | */ | 1290 | */ |
1291 | bool QPEApplication::keepRunning() const | 1291 | bool QPEApplication::keepRunning() const |
1292 | { | 1292 | { |
1293 | return d->keep_running; | 1293 | return d->keep_running; |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | /*! | 1296 | /*! |
1297 | \internal | 1297 | \internal |
1298 | */ | 1298 | */ |
1299 | void QPEApplication::internalSetStyle( const QString &style ) | 1299 | void QPEApplication::internalSetStyle( const QString &style ) |
1300 | { | 1300 | { |
1301 | #if QT_VERSION >= 300 | 1301 | #if QT_VERSION >= 300 |
1302 | if ( style == "QPE" ) { | 1302 | if ( style == "QPE" ) { |
1303 | setStyle( new QPEStyle ); | 1303 | setStyle( new QPEStyle ); |
1304 | } else { | 1304 | } else { |
1305 | QStyle *s = QStyleFactory::create(style); | 1305 | QStyle *s = QStyleFactory::create(style); |
1306 | if ( s ) setStyle(s); | 1306 | if ( s ) setStyle(s); |
1307 | } | 1307 | } |
1308 | #else | 1308 | #else |
1309 | if ( style == "Windows" ) { | 1309 | if ( style == "Windows" ) { |
1310 | setStyle( new QWindowsStyle ); | 1310 | setStyle( new QWindowsStyle ); |
1311 | } else if ( style == "QPE" ) { | 1311 | } else if ( style == "QPE" ) { |
1312 | setStyle( new QPEStyle ); | 1312 | setStyle( new QPEStyle ); |
1313 | } else if ( style == "Light" ) { | 1313 | } else if ( style == "Light" ) { |
1314 | setStyle( new LightStyle ); | 1314 | setStyle( new LightStyle ); |
1315 | } | 1315 | } |
1316 | #ifndef QT_NO_STYLE_PLATINUM | 1316 | #ifndef QT_NO_STYLE_PLATINUM |
1317 | else if ( style == "Platinum" ) { | 1317 | else if ( style == "Platinum" ) { |
1318 | setStyle( new QPlatinumStyle ); | 1318 | setStyle( new QPlatinumStyle ); |
1319 | } | 1319 | } |
1320 | #endif | 1320 | #endif |
1321 | #ifndef QT_NO_STYLE_MOTIF | 1321 | #ifndef QT_NO_STYLE_MOTIF |
1322 | else if ( style == "Motif" ) { | 1322 | else if ( style == "Motif" ) { |
1323 | setStyle( new QMotifStyle ); | 1323 | setStyle( new QMotifStyle ); |
1324 | } | 1324 | } |
1325 | #endif | 1325 | #endif |
1326 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1326 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1327 | else if ( style == "MotifPlus" ) { | 1327 | else if ( style == "MotifPlus" ) { |
1328 | setStyle( new QMotifPlusStyle ); | 1328 | setStyle( new QMotifPlusStyle ); |
1329 | } | 1329 | } |
1330 | #endif | 1330 | #endif |
1331 | 1331 | ||
1332 | // HACK for Qt2 only | 1332 | // HACK for Qt2 only |
1333 | else { | 1333 | else { |
1334 | // style == "Liquid Style (libliquid.so)" (or "Windows XP (libxp.so)" | 1334 | // style == "Liquid Style (libliquid.so)" (or "Windows XP (libxp.so)" |
1335 | 1335 | ||
1336 | int p2 = style. findRev ( ']' ); | 1336 | int p2 = style. findRev ( ']' ); |
1337 | int p1 = style. findRev ( '[' ); | 1337 | int p1 = style. findRev ( '[' ); |
1338 | QString style2; | 1338 | QString style2; |
1339 | 1339 | ||
1340 | if (( p1 > 0 ) && ( p2 > 0 ) && (( p1 + 1 ) < p2 )) | 1340 | if (( p1 > 0 ) && ( p2 > 0 ) && (( p1 + 1 ) < p2 )) |
1341 | style2 = "lib" + style. mid ( p1 + 1, p2 - p1 - 1 ). lower ( ) + ".so"; | 1341 | style2 = "lib" + style. mid ( p1 + 1, p2 - p1 - 1 ). lower ( ) + ".so"; |
1342 | else | 1342 | else |
1343 | style2 = "lib" + style. lower ( ) + ".so"; | 1343 | style2 = "lib" + style. lower ( ) + ".so"; |
1344 | 1344 | ||
1345 | // static QLibrary *currentlib = 0; | 1345 | // static QLibrary *currentlib = 0; |
1346 | static void *currentlib = 0; | 1346 | static void *currentlib = 0; |
1347 | 1347 | ||
1348 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/" + style2; | 1348 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/" + style2; |
1349 | 1349 | ||
1350 | do { // try/catch simulation | 1350 | do { // try/catch simulation |
1351 | // QLibrary *lib = new QLibrary ( path, QLibrary::Immediately ); | 1351 | // QLibrary *lib = new QLibrary ( path, QLibrary::Immediately ); |
1352 | void *lib = ::dlopen ( path. local8Bit ( ), RTLD_NOW | RTLD_GLOBAL ); | 1352 | void *lib = ::dlopen ( path. local8Bit ( ), RTLD_LAZY | RTLD_GLOBAL ); |
1353 | 1353 | ||
1354 | if ( lib ) { | 1354 | if ( lib ) { |
1355 | //QStyle * (*fpa) ( ) = (QStyle * (*) ( )) lib-> resolve ( "allocate" ); | 1355 | //QStyle * (*fpa) ( ) = (QStyle * (*) ( )) lib-> resolve ( "allocate" ); |
1356 | QStyle * (*fpa) ( ) = (QStyle * (*) ( )) ::dlsym ( lib, "allocate" ); | 1356 | QStyle * (*fpa) ( ) = (QStyle * (*) ( )) ::dlsym ( lib, "allocate" ); |
1357 | 1357 | ||
1358 | if ( fpa ) { | 1358 | if ( fpa ) { |
1359 | QStyle *sty = ( *fpa ) ( ); | 1359 | QStyle *sty = ( *fpa ) ( ); |
1360 | 1360 | ||
1361 | if ( sty ) { | 1361 | if ( sty ) { |
1362 | setStyle ( sty ); | 1362 | setStyle ( sty ); |
1363 | 1363 | ||
1364 | if ( currentlib ) { | 1364 | if ( currentlib ) { |
1365 | //delete currentlib; | 1365 | //delete currentlib; |
1366 | ::dlclose ( currentlib ); | 1366 | ::dlclose ( currentlib ); |
1367 | } | 1367 | } |
1368 | currentlib = lib; | 1368 | currentlib = lib; |
1369 | 1369 | ||
1370 | break; | 1370 | break; |
1371 | } | 1371 | } |
1372 | } | 1372 | } |
1373 | //delete lib; | 1373 | //delete lib; |
1374 | ::dlclose ( lib ); | 1374 | ::dlclose ( lib ); |
1375 | } | 1375 | } |
1376 | } while ( false ); | 1376 | } while ( false ); |
1377 | } | 1377 | } |
1378 | // HACK for Qt2 only | 1378 | // HACK for Qt2 only |
1379 | #endif | 1379 | #endif |
1380 | } | 1380 | } |
1381 | 1381 | ||
1382 | /*! | 1382 | /*! |
1383 | \internal | 1383 | \internal |
1384 | */ | 1384 | */ |
1385 | void QPEApplication::prepareForTermination(bool willrestart) | 1385 | void QPEApplication::prepareForTermination(bool willrestart) |
1386 | { | 1386 | { |
1387 | if ( willrestart ) { | 1387 | if ( willrestart ) { |
1388 | // Draw a big wait icon, the image can be altered in later revisions | 1388 | // Draw a big wait icon, the image can be altered in later revisions |
1389 | // QWidget *d = QApplication::desktop(); | 1389 | // QWidget *d = QApplication::desktop(); |
1390 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 1390 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
1391 | QPixmap pix; | 1391 | QPixmap pix; |
1392 | pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height())); | 1392 | pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height())); |
1393 | QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize | | 1393 | QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize | |
1394 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1394 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1395 | lblWait->setPixmap( pix ); | 1395 | lblWait->setPixmap( pix ); |
1396 | lblWait->setAlignment( QWidget::AlignCenter ); | 1396 | lblWait->setAlignment( QWidget::AlignCenter ); |
1397 | lblWait->show(); | 1397 | lblWait->show(); |
1398 | lblWait->showMaximized(); | 1398 | lblWait->showMaximized(); |
1399 | } | 1399 | } |
1400 | #ifndef SINGLE_APP | 1400 | #ifndef SINGLE_APP |
1401 | { QCopEnvelope envelope("QPE/System", "forceQuit()"); } | 1401 | { QCopEnvelope envelope("QPE/System", "forceQuit()"); } |
1402 | processEvents(); // ensure the message goes out. | 1402 | processEvents(); // ensure the message goes out. |
1403 | sleep(1); // You have 1 second to comply. | 1403 | sleep(1); // You have 1 second to comply. |
1404 | #endif | 1404 | #endif |
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | /*! | 1407 | /*! |
1408 | \internal | 1408 | \internal |
1409 | */ | 1409 | */ |
1410 | void QPEApplication::shutdown() | 1410 | void QPEApplication::shutdown() |
1411 | { | 1411 | { |
1412 | // Implement in server's QPEApplication subclass | 1412 | // Implement in server's QPEApplication subclass |
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | /*! | 1415 | /*! |
1416 | \internal | 1416 | \internal |
1417 | */ | 1417 | */ |
1418 | void QPEApplication::restart() | 1418 | void QPEApplication::restart() |
1419 | { | 1419 | { |
1420 | // Implement in server's QPEApplication subclass | 1420 | // Implement in server's QPEApplication subclass |
1421 | } | 1421 | } |
1422 | 1422 | ||
1423 | static QPtrDict<void>* stylusDict=0; | 1423 | static QPtrDict<void>* stylusDict=0; |
1424 | static void createDict() | 1424 | static void createDict() |
1425 | { | 1425 | { |
1426 | if ( !stylusDict ) | 1426 | if ( !stylusDict ) |
1427 | stylusDict = new QPtrDict<void>; | 1427 | stylusDict = new QPtrDict<void>; |
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | /*! | 1430 | /*! |
1431 | Returns the current StylusMode for \a w. | 1431 | Returns the current StylusMode for \a w. |
1432 | 1432 | ||
1433 | \sa setStylusOperation() | 1433 | \sa setStylusOperation() |
1434 | */ | 1434 | */ |
1435 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1435 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1436 | { | 1436 | { |
1437 | if ( stylusDict ) | 1437 | if ( stylusDict ) |
1438 | return (StylusMode)(int)stylusDict->find(w); | 1438 | return (StylusMode)(int)stylusDict->find(w); |
1439 | return LeftOnly; | 1439 | return LeftOnly; |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | /*! | 1442 | /*! |
1443 | \enum QPEApplication::StylusMode | 1443 | \enum QPEApplication::StylusMode |
1444 | 1444 | ||
1445 | \value LeftOnly the stylus only generates LeftButton | 1445 | \value LeftOnly the stylus only generates LeftButton |
1446 | events (the default). | 1446 | events (the default). |
1447 | \value RightOnHold the stylus generates RightButton events | 1447 | \value RightOnHold the stylus generates RightButton events |
1448 | if the user uses the press-and-hold gesture. | 1448 | if the user uses the press-and-hold gesture. |