summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp142
-rw-r--r--library/qpeapplication.h11
2 files changed, 110 insertions, 43 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 9286f9f..149e6bb 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -18,5 +18,3 @@
18** 18**
19** $Id$ 19*/
20**
21**********************************************************************/
22#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
@@ -53,2 +51,3 @@
53#include <qmainwindow.h> 51#include <qmainwindow.h>
52#include <qwidgetlist.h>
54 53
@@ -119,2 +118,3 @@ public:
119 118
119 QStringList langs;
120 QString appName; 120 QString appName;
@@ -132,3 +132,6 @@ public:
132 QWidget* qpe_main_widget; 132 QWidget* qpe_main_widget;
133 QGuardedPtr<QWidget> lastWidget;
133 QList<QCopRec> qcopq; 134 QList<QCopRec> qcopq;
135 QString styleName;
136 QString decorationName;
134 137
@@ -268,4 +271,2 @@ public:
268 } 271 }
269 QString styleName;
270 QString decorationName;
271}; 272};
@@ -665,4 +666,4 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
665 666
666 QStringList langs = Global::languageList(); 667 d->langs = Global::languageList();
667 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { 668 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
668 QString lang = *it; 669 QString lang = *it;
@@ -744,2 +745,6 @@ void QPEApplication::initApp( int argc, char **argv )
744 setArgs(argc, argv); 745 setArgs(argc, argv);
746
747 /* install translation here */
748 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
749 installTranslation( (*it) + "/" + d->appName + ".qm" );
745} 750}
@@ -1313,2 +1318,32 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
1313 1318
1319#include <qmetaobject.h>
1320
1321QWidget *QPEApplication::nextWidget(QWidgetList* list, QWidget* _wid) {
1322 QWidget *next = 0;
1323 if ( list->isEmpty() || list->count() == 1 )
1324 next = _wid;
1325 else{
1326 QWidget* wid;
1327 uint idx = list->findRef( _wid );
1328 uint count = list->count();
1329
1330 /* one time through the list hacky we may not start with idx but end with it*/
1331 for (uint i = (idx + 1)%count; true; i=(i+1)%count ) {
1332 wid = list->at(i);
1333 if ( wid == _wid ) {
1334 next = _wid;
1335 break;
1336 }else if ((( wid->inherits("QMainWindow") ||
1337 wid->inherits("QDialog") ) &&
1338 wid != qApp->desktop() && !wid->isHidden() ) ||
1339 ( wid == mainWidget() || wid == d->qpe_main_widget ) ){
1340 next = wid;
1341 break;
1342 }
1343 }
1344 }
1345
1346 delete list;
1347 return next;
1348}
1314/*! 1349/*!
@@ -1316,38 +1351,66 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
1316*/ 1351*/
1352// ########## raise()ing main window should raise and set active
1353// ########## it and then all childen. This belongs in Qt/Embedded
1354/*
1355 * slightly change in behaviour to kill the need of modality in Opie
1356 * If any of the topLevelWidgets !isFullyObscured we highlight the next
1357 * top level window
1358 * 1)If visible and not modal we iterate over the list of top level widgets
1359 * 2)If modal we we make the modal and its parent toplevel widget visible if available
1360 * 3)else make topLevel visible
1361 *
1362 * send qcop if necessary and save current visible widget if not modal
1363 */
1317bool QPEApplication::raiseAppropriateWindow() 1364bool QPEApplication::raiseAppropriateWindow()
1318{ 1365{
1319 bool r = FALSE; 1366 bool r = FALSE;
1320 // ########## raise()ing main window should raise and set active 1367
1321 // ########## it and then all childen. This belongs in Qt/Embedded 1368 QWidget *top = d->qpe_main_widget ? d->qpe_main_widget : mainWidget();
1322 QWidget *top = d->qpe_main_widget; 1369 /* 1. */
1323 if ( !top ) 1370 if ( ( top && (top->isVisible() ) || ( d->lastWidget && d->lastWidget->isVisible() ) ) &&
1324 top = mainWidget(); 1371 !activeModalWidget() ) {
1325 if ( top && d->keep_running ) { 1372 r = TRUE;
1326 if ( top->isVisible() ) 1373 /*wid will be valid and topLevelWidgets will be deleted properly.. */
1327 r = TRUE; 1374 QWidget *wid = nextWidget( topLevelWidgets(),
1328 else if (d->preloaded) { 1375 d->lastWidget ? (QWidget*)d->lastWidget : top );
1329 // We are preloaded and not visible.. pretend we just started.. 1376 /* keep the size window got but not for root*/
1330 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1377 if ( top == wid )
1331 e << d->appName; 1378 d->show_mx(top, d->nomaximize );
1332 } 1379 else
1380 wid->show();
1381
1382 wid->raise();
1383 wid->setActiveWindow();
1384 d->lastWidget = wid;
1385 }else if ( activeModalWidget() ) {
1386 QWidget* mod = activeModalWidget();
1387 /* get the parent of the modal and its topLevelWidget as background widget */
1388 QWidget* par = activeModalWidget()->parentWidget() ? activeModalWidget()->parentWidget()->topLevelWidget() : 0;
1389 if (par ) {
1390 if (par == top )
1391 d->show_mx(par, d->nomaximize );
1392 else
1393 par->show();
1394 par->raise();
1395 par->setActiveWindow();
1396 }
1397 mod->show();
1398 mod->raise();
1399 mod->setActiveWindow();
1400 }else if (top){
1401 d->show_mx(top, d->nomaximize );
1402 top->raise();
1403 top->setActiveWindow();
1404 d->lastWidget = top;
1405 }
1333 1406
1334 d->show_mx(top, d->nomaximize); 1407 if (!r && d->preloaded ) {
1335 top->raise(); 1408 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1336 top->setActiveWindow(); 1409 e << d->appName;
1337 } 1410 }
1338 QWidget *topm = activeModalWidget(); 1411
1339 if ( topm && topm != top ) { 1412 return r;
1340 topm->show();
1341 topm->raise();
1342 topm->setActiveWindow();
1343 // If we haven't already handled the fastAppShowing message
1344 if (!top && d->preloaded) {
1345 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1346 e << d->appName;
1347 }
1348 r = FALSE;
1349 }
1350 return r;
1351} 1413}
1352 1414
1415
1353void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) 1416void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
@@ -1404,2 +1467,3 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1404 Global::setDocument( mw, doc ); 1467 Global::setDocument( mw, doc );
1468
1405 } else if ( msg == "QPEProcessQCop()" ) { 1469 } else if ( msg == "QPEProcessQCop()" ) {
@@ -1407,3 +1471,3 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1407 d->sendQCopQ(); 1471 d->sendQCopQ();
1408 } 1472 }else
1409 { 1473 {
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 770ea23..343e0b9 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -115,2 +115,5 @@ private slots:
115 115
116private:
117 inline QWidget *nextWidget( QWidgetList*, QWidget* );
118
116protected: 119protected:
@@ -193,9 +196,9 @@ inline void QPEApplication::setCurrentRotation( int r )
193 // for compatibility with the SharpROM use fallback to setDefaultTransformation() 196 // for compatibility with the SharpROM use fallback to setDefaultTransformation()
194 #if QT_VERSION > 233 197#if QT_VERSION > 233
195 Transformation e = DegToTrans( r ); 198 Transformation e = DegToTrans( r );
196 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 199 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
197 qApp->desktop()->qwsDisplay()->setTransformation( e ); 200 qApp->desktop()->qwsDisplay()->setTransformation( e );
198 #else 201#else
199 setDefaultRotation( r ); 202 setDefaultRotation( r );
200 #endif 203#endif
201} 204}