summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwminit.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/pwminit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwminit.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index d775aa9..fbd17a7 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -85,12 +85,13 @@ PwMInit::PwMInit(PwMApplication *_app)
sig_init_pointer = this;
app = _app;
}
PwMInit::~PwMInit()
{
+ qDebug("PwMInit::~PwMInit() ");
#ifndef PWM_EMBEDDED
SelfTest::cancel();
// close all open mainwnds
QValueList<PwM *>::iterator i = _mainWndList.begin(),
end = _mainWndList.end();
@@ -176,13 +177,12 @@ void PwMInit::initializeApp()
createMainWnd(conf()->confGlobAutoStart(),
openDeeplocked,
true,
0,
savedCmd.minimized);
}
-
runStatus = running;
}
void PwMInit::shutdownApp(int exitStatus)
{
printDebug(string("PwMInit::shutdownApp(")
@@ -319,16 +319,14 @@ PwM * PwMInit::createMainWnd(const QString &loadFile,
#else //PWM_EMBEDDED
#ifndef DESKTOP_VERSION
app->showMainWidget( newWnd );
#else //DESKTOP_VERSION
- app->setMainWidget( newWnd );
newWnd->resize (640, 480 );
newWnd->show();
- qDebug("show ");
#endif //DESKTOP_VERSION
#endif //PWM_EMBEDDED
if (loadFile != QString::null &&
loadFile != "") {
@@ -388,13 +386,13 @@ again:
} else {
doDeleteDoc = true;
}
}
if (doMinimizeToTray) {
-
+ qDebug("doMinimizeToTray ");
PWM_ASSERT(_tray);
int mmlock = conf()->confGlobMinimizeLock();
switch (mmlock) {
case 0: // don't lock anything
break;
case 1: // normal lock
@@ -404,12 +402,13 @@ again:
wnd->curDoc()->deepLock();
break;
default:
WARN();
}
} else if (doDeleteDoc) {
+ qDebug("doDeleteDoc ");
if (!wnd->curDoc()->tryDelete()) {
/* We failed deleting the doc,
* so open a new window with it, again.
*/
createMainWnd(QString::null, false,
false, wnd->curDoc());
@@ -428,12 +427,22 @@ again:
if (*i == wnd) {
#ifndef PWM_EMBEDDED
_mainWndList.erase(i);
#else
_mainWndList.remove(i);
#endif
+
+ if ( app->mainWidget() == wnd ) {
+ if ( _mainWndList.count() ) {
+#ifndef DESKTOP_VERSION
+ app->showMainWidget(_mainWndList.first() );
+#endif //DESKTOP_VERSION
+
+ }
+ }
+ delete wnd;
goto out_success;
}
++i;
}
BUG();
out_success: