summaryrefslogtreecommitdiff
path: root/library
Side-by-side diff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp162
-rw-r--r--library/qpeapplication.h3
2 files changed, 75 insertions, 90 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index bf353d4..86aa53d 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -132,3 +132,3 @@ public:
QWidget* qpe_main_widget;
- QGuardedPtr<QWidget> lastWidget;
+ QGuardedPtr<QWidget> lastraised;
QList<QCopRec> qcopq;
@@ -153,3 +153,3 @@ public:
}
- static void show_mx(QWidget* mw, bool nomaximize)
+ static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null )
{
@@ -706,2 +706,3 @@ void QPEApplication::initApp( int argc, char **argv )
{
+ bool initial = pidChannel; // was set to 0 in the initializer
delete pidChannel;
@@ -725,4 +726,6 @@ void QPEApplication::initApp( int argc, char **argv )
- processQCopFile();
- d->keep_running = d->qcopq.isEmpty();
+ if (!initial) {
+ processQCopFile();
+ d->keep_running = d->qcopq.isEmpty();
+ }
@@ -1364,32 +1367,6 @@ 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;
-}
+
+
+
/*!
@@ -1397,60 +1374,71 @@ QWidget *QPEApplication::nextWidget(QWidgetList* list, QWidget* _wid) {
*/
-// ########## 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;
-
- 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;
+ bool r=FALSE;
+
+ // 1. Raise the main widget
+ 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..
+#ifndef QT_NO_COP
+ QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
+ e << d->appName;
+#endif
+ }
+
+ d->show_mx(top,d->nomaximize, d->appName);
+ top->raise();
+ }
+
+ QWidget *topm = activeModalWidget();
+
+ // 2. Raise any parentless widgets (except top and topm, as they
+ // are raised before and after this loop). Order from most
+ // recently raised as deepest to least recently as top, so
+ // that repeated calls cycle through widgets.
+ QWidgetList *list = topLevelWidgets();
+ if ( list ) {
+ bool foundlast = FALSE;
+ QWidget* topsub = 0;
+ if ( d->lastraised ) {
+ for (QWidget* w = list->first(); w; w = list->next()) {
+ if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
+ if ( w == d->lastraised )
+ foundlast = TRUE;
+ if ( foundlast ) {
+ w->raise();
+ topsub = w;
+ }
+ }
+ }
+ }
+ for (QWidget* w = list->first(); w; w = list->next()) {
+ if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
+ if ( w == d->lastraised )
+ break;
+ w->raise();
+ topsub = w;
+ }
+ }
+ d->lastraised = topsub;
+ delete list;
}
- if (!r && d->preloaded ) {
- QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
- e << d->appName;
+ // 3. Raise the active modal widget.
+ if ( topm && topm != top ) {
+ topm->show();
+ topm->raise();
+ // If we haven't already handled the fastAppShowing message
+ if (!top && d->preloaded) {
+#ifndef QT_NO_COP
+ QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
+ e << d->appName;
+#endif
+ }
+ r = FALSE;
}
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 69e0058..729cf2b 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -117,5 +117,2 @@ private slots:
-private:
- QWidget *nextWidget( QWidgetList*, QWidget* );
-
protected: