-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index fbd17a7..68f3637 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp | |||
@@ -164,48 +164,57 @@ void PwMInit::initializeApp() | |||
164 | 164 | ||
165 | //US ENH for embedded devices: in the case of failure, open a document the default way | 165 | //US ENH for embedded devices: in the case of failure, open a document the default way |
166 | createMainWnd(conf()->confGlobAutoStart(), | 166 | createMainWnd(conf()->confGlobAutoStart(), |
167 | openDeeplocked, | 167 | openDeeplocked, |
168 | true, | 168 | true, |
169 | 0, | 169 | 0, |
170 | savedCmd.minimized); | 170 | savedCmd.minimized); |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | //} | 175 | //} |
176 | } else { | 176 | } else { |
177 | createMainWnd(conf()->confGlobAutoStart(), | 177 | createMainWnd(conf()->confGlobAutoStart(), |
178 | openDeeplocked, | 178 | openDeeplocked, |
179 | true, | 179 | true, |
180 | 0, | 180 | 0, |
181 | savedCmd.minimized); | 181 | savedCmd.minimized); |
182 | } | 182 | } |
183 | runStatus = running; | 183 | runStatus = running; |
184 | } | 184 | } |
185 | 185 | ||
186 | void PwMInit::shutdownApp(int exitStatus) | 186 | void PwMInit::shutdownApp(int exitStatus) |
187 | { | 187 | { |
188 | |||
189 | |||
190 | PwM * iii; | ||
191 | while ( iii = _mainWndList.first() ) { | ||
192 | disconnect(iii, SIGNAL(closed(PwM *)), | ||
193 | this, SLOT(mainWndClosed(PwM *))); | ||
194 | mainWndClosed((iii)); | ||
195 | } | ||
196 | |||
188 | printDebug(string("PwMInit::shutdownApp(") | 197 | printDebug(string("PwMInit::shutdownApp(") |
189 | + tostr(exitStatus) + ") called."); | 198 | + tostr(exitStatus) + ") called."); |
190 | PWM_ASSERT((runStatus == running) || (runStatus == init)); | 199 | PWM_ASSERT((runStatus == running) || (runStatus == init)); |
191 | runStatus = shutdown; | 200 | runStatus = shutdown; |
192 | QApplication::exit(exitStatus); | 201 | QApplication::exit(exitStatus); |
193 | /* The destructor of PwMInit is called when control | 202 | /* The destructor of PwMInit is called when control |
194 | * leaves main() | 203 | * leaves main() |
195 | */ | 204 | */ |
196 | } | 205 | } |
197 | 206 | ||
198 | void PwMInit::initPosixSignalHandler() | 207 | void PwMInit::initPosixSignalHandler() |
199 | { | 208 | { |
200 | signal(SIGINT, sig_handler); | 209 | signal(SIGINT, sig_handler); |
201 | signal(SIGTERM, sig_handler); | 210 | signal(SIGTERM, sig_handler); |
202 | } | 211 | } |
203 | 212 | ||
204 | void PwMInit::initDCOP() | 213 | void PwMInit::initDCOP() |
205 | { | 214 | { |
206 | #ifndef PWM_EMBEDDED | 215 | #ifndef PWM_EMBEDDED |
207 | _dcopClient = app->dcopClient(); | 216 | _dcopClient = app->dcopClient(); |
208 | _dcopClient->setNotifications(true); | 217 | _dcopClient->setNotifications(true); |
209 | #endif | 218 | #endif |
210 | 219 | ||
211 | } | 220 | } |
@@ -403,48 +412,49 @@ again: | |||
403 | break; | 412 | break; |
404 | default: | 413 | default: |
405 | WARN(); | 414 | WARN(); |
406 | } | 415 | } |
407 | } else if (doDeleteDoc) { | 416 | } else if (doDeleteDoc) { |
408 | qDebug("doDeleteDoc "); | 417 | qDebug("doDeleteDoc "); |
409 | if (!wnd->curDoc()->tryDelete()) { | 418 | if (!wnd->curDoc()->tryDelete()) { |
410 | /* We failed deleting the doc, | 419 | /* We failed deleting the doc, |
411 | * so open a new window with it, again. | 420 | * so open a new window with it, again. |
412 | */ | 421 | */ |
413 | createMainWnd(QString::null, false, | 422 | createMainWnd(QString::null, false, |
414 | false, wnd->curDoc()); | 423 | false, wnd->curDoc()); |
415 | } | 424 | } |
416 | } | 425 | } |
417 | #ifndef PWM_EMBEDDED | 426 | #ifndef PWM_EMBEDDED |
418 | // find the closed window in the "mainWndList" and delete it. | 427 | // find the closed window in the "mainWndList" and delete it. |
419 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 428 | QValueList<PwM *>::iterator i = _mainWndList.begin(), |
420 | end = _mainWndList.end(); | 429 | end = _mainWndList.end(); |
421 | #else | 430 | #else |
422 | // find the closed window in the "mainWndList" and delete it. | 431 | // find the closed window in the "mainWndList" and delete it. |
423 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 432 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), |
424 | end = _mainWndList.end(); | 433 | end = _mainWndList.end(); |
425 | #endif | 434 | #endif |
426 | while (i != end) { | 435 | while (i != end) { |
436 | //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd); | ||
427 | if (*i == wnd) { | 437 | if (*i == wnd) { |
428 | #ifndef PWM_EMBEDDED | 438 | #ifndef PWM_EMBEDDED |
429 | _mainWndList.erase(i); | 439 | _mainWndList.erase(i); |
430 | #else | 440 | #else |
431 | _mainWndList.remove(i); | 441 | _mainWndList.remove(i); |
432 | #endif | 442 | #endif |
433 | 443 | ||
434 | if ( app->mainWidget() == wnd ) { | 444 | if ( app->mainWidget() == wnd ) { |
435 | if ( _mainWndList.count() ) { | 445 | if ( _mainWndList.count() ) { |
436 | #ifndef DESKTOP_VERSION | 446 | #ifndef DESKTOP_VERSION |
437 | app->showMainWidget(_mainWndList.first() ); | 447 | app->showMainWidget(_mainWndList.first() ); |
438 | #endif //DESKTOP_VERSION | 448 | #endif //DESKTOP_VERSION |
439 | 449 | ||
440 | } | 450 | } |
441 | } | 451 | } |
442 | delete wnd; | 452 | delete wnd; |
443 | goto out_success; | 453 | goto out_success; |
444 | } | 454 | } |
445 | ++i; | 455 | ++i; |
446 | } | 456 | } |
447 | BUG(); | 457 | BUG(); |
448 | out_success: | 458 | out_success: |
449 | #ifndef PWM_EMBEDDED | 459 | #ifndef PWM_EMBEDDED |
450 | if (!_mainWndList.size()) | 460 | if (!_mainWndList.size()) |