summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-29 06:52:04 (UTC)
committer zecke <zecke>2003-08-29 06:52:04 (UTC)
commitd8fadaf4f510803983d0b8b99994fd70e770ccab (patch) (side-by-side diff)
tree3921c576b3dbd0dc4fd3ccfe4d39204522bf57a6
parentb9861471966f8bb0e3bea2db58a0d1289add1d4f (diff)
downloadopie-d8fadaf4f510803983d0b8b99994fd70e770ccab.zip
opie-d8fadaf4f510803983d0b8b99994fd70e770ccab.tar.gz
opie-d8fadaf4f510803983d0b8b99994fd70e770ccab.tar.bz2
-IF the app is visible and has more than once topLevel widget
iterate over the list and activate the next one. -Install translation in .qm -Add an else again ( was lost in a merge )
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 @@
**
-** $Id$
-**
-**********************************************************************/
+*/
#define QTOPIA_INTERNAL_LANGLIST
@@ -53,2 +51,3 @@
#include <qmainwindow.h>
+#include <qwidgetlist.h>
@@ -119,2 +118,3 @@ public:
+ QStringList langs;
QString appName;
@@ -132,3 +132,6 @@ public:
QWidget* qpe_main_widget;
+ QGuardedPtr<QWidget> lastWidget;
QList<QCopRec> qcopq;
+ QString styleName;
+ QString decorationName;
@@ -268,4 +271,2 @@ public:
}
- QString styleName;
- QString decorationName;
};
@@ -665,4 +666,4 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
- QStringList langs = Global::languageList();
- for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
+ d->langs = Global::languageList();
+ for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
QString lang = *it;
@@ -744,2 +745,6 @@ void QPEApplication::initApp( int argc, char **argv )
setArgs(argc, argv);
+
+ /* install translation here */
+ for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
+ installTranslation( (*it) + "/" + d->appName + ".qm" );
}
@@ -1313,2 +1318,32 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
+#include <qmetaobject.h>
+
+QWidget *QPEApplication::nextWidget(QWidgetList* list, QWidget* _wid) {
+ QWidget *next = 0;
+ if ( list->isEmpty() || list->count() == 1 )
+ next = _wid;
+ else{
+ QWidget* wid;
+ uint idx = list->findRef( _wid );
+ uint count = list->count();
+
+ /* one time through the list hacky we may not start with idx but end with it*/
+ for (uint i = (idx + 1)%count; true; i=(i+1)%count ) {
+ wid = list->at(i);
+ if ( wid == _wid ) {
+ next = _wid;
+ break;
+ }else if ((( wid->inherits("QMainWindow") ||
+ wid->inherits("QDialog") ) &&
+ wid != qApp->desktop() && !wid->isHidden() ) ||
+ ( wid == mainWidget() || wid == d->qpe_main_widget ) ){
+ next = wid;
+ break;
+ }
+ }
+ }
+
+ delete list;
+ return next;
+}
/*!
@@ -1316,38 +1351,66 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
*/
+// ########## raise()ing main window should raise and set active
+// ########## it and then all childen. This belongs in Qt/Embedded
+/*
+ * slightly change in behaviour to kill the need of modality in Opie
+ * If any of the topLevelWidgets !isFullyObscured we highlight the next
+ * top level window
+ * 1)If visible and not modal we iterate over the list of top level widgets
+ * 2)If modal we we make the modal and its parent toplevel widget visible if available
+ * 3)else make topLevel visible
+ *
+ * send qcop if necessary and save current visible widget if not modal
+ */
bool QPEApplication::raiseAppropriateWindow()
{
- bool r = FALSE;
- // ########## raise()ing main window should raise and set active
- // ########## it and then all childen. This belongs in Qt/Embedded
- QWidget *top = d->qpe_main_widget;
- if ( !top )
- top = mainWidget();
- if ( top && d->keep_running ) {
- if ( top->isVisible() )
- r = TRUE;
- else if (d->preloaded) {
- // We are preloaded and not visible.. pretend we just started..
- QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
- e << d->appName;
- }
+ bool r = FALSE;
+
+ QWidget *top = d->qpe_main_widget ? d->qpe_main_widget : mainWidget();
+ /* 1. */
+ if ( ( top && (top->isVisible() ) || ( d->lastWidget && d->lastWidget->isVisible() ) ) &&
+ !activeModalWidget() ) {
+ r = TRUE;
+ /*wid will be valid and topLevelWidgets will be deleted properly.. */
+ QWidget *wid = nextWidget( topLevelWidgets(),
+ d->lastWidget ? (QWidget*)d->lastWidget : top );
+ /* keep the size window got but not for root*/
+ if ( top == wid )
+ d->show_mx(top, d->nomaximize );
+ else
+ wid->show();
+
+ wid->raise();
+ wid->setActiveWindow();
+ d->lastWidget = wid;
+ }else if ( activeModalWidget() ) {
+ QWidget* mod = activeModalWidget();
+ /* get the parent of the modal and its topLevelWidget as background widget */
+ QWidget* par = activeModalWidget()->parentWidget() ? activeModalWidget()->parentWidget()->topLevelWidget() : 0;
+ if (par ) {
+ if (par == top )
+ d->show_mx(par, d->nomaximize );
+ else
+ par->show();
+ par->raise();
+ par->setActiveWindow();
+ }
+ mod->show();
+ mod->raise();
+ mod->setActiveWindow();
+ }else if (top){
+ d->show_mx(top, d->nomaximize );
+ top->raise();
+ top->setActiveWindow();
+ d->lastWidget = top;
+ }
- d->show_mx(top, d->nomaximize);
- top->raise();
- top->setActiveWindow();
- }
- QWidget *topm = activeModalWidget();
- if ( topm && topm != top ) {
- topm->show();
- topm->raise();
- topm->setActiveWindow();
- // If we haven't already handled the fastAppShowing message
- if (!top && d->preloaded) {
- QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
- e << d->appName;
- }
- r = FALSE;
- }
- return r;
+ if (!r && d->preloaded ) {
+ QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
+ e << d->appName;
+ }
+
+ return r;
}
+
void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
@@ -1404,2 +1467,3 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
Global::setDocument( mw, doc );
+
} else if ( msg == "QPEProcessQCop()" ) {
@@ -1407,3 +1471,3 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
d->sendQCopQ();
- }
+ }else
{
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:
+private:
+ inline QWidget *nextWidget( QWidgetList*, QWidget* );
+
protected:
@@ -193,9 +196,9 @@ inline void QPEApplication::setCurrentRotation( int r )
// for compatibility with the SharpROM use fallback to setDefaultTransformation()
- #if QT_VERSION > 233
+#if QT_VERSION > 233
Transformation e = DegToTrans( r );
- setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
+ ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
qApp->desktop()->qwsDisplay()->setTransformation( e );
- #else
+#else
setDefaultRotation( r );
- #endif
+#endif
}