355 // If view was started as service, move the app now |
359 // If view was started as service, move the app now |
356 // to the background, unless it was started when the app |
360 // to the background, unless it was started when the app |
357 // was already in foreground.. |
361 // was already in foreground.. |
358 if (mServiceViewId == topViewId) { |
362 if (mServiceViewId == topViewId) { |
359 mServiceViewId = NmUiViewNone; |
363 mServiceViewId = NmUiViewNone; |
360 |
364 NM_COMMENT("Returned from service view"); |
361 // if started as embedded, do not hide the app |
365 |
|
366 // if started as embedded or while the app was in foreground, |
|
367 // do not hide the app |
362 if (!XQServiceUtil::isEmbedded() && |
368 if (!XQServiceUtil::isEmbedded() && |
363 !mForegroundService) { |
369 !mForegroundService) { |
364 XQServiceUtil::toBackground(true); |
370 XQServiceUtil::toBackground(true); |
365 } |
371 } |
366 } |
372 } |
407 |
413 |
408 if (startParam->service() && mMainWindow) { |
414 if (startParam->service() && mMainWindow) { |
409 // When the message list is started as a service previous views are removed |
415 // When the message list is started as a service previous views are removed |
410 // from the stack. Open editors are not closed. |
416 // from the stack. Open editors are not closed. |
411 // Also if the view is same than the new one, keep it open (reload the content). |
417 // Also if the view is same than the new one, keep it open (reload the content). |
|
418 |
|
419 |
|
420 // reset the foreground service flag while popping the views |
|
421 bool previousForegroundService = mForegroundService; |
|
422 mForegroundService = true; |
412 |
423 |
413 // at least one view must remain in the stack |
424 // at least one view must remain in the stack |
414 while (mViewStack->count()>1) { |
425 while (mViewStack->count()>1) { |
415 NmUiViewId topId = mViewStack->top()->nmailViewId(); |
426 NmUiViewId topId = mViewStack->top()->nmailViewId(); |
416 if (topId!=NmUiViewMessageEditor && |
427 if (topId!=NmUiViewMessageEditor && |
421 else { |
432 else { |
422 // Editor or mailbox list in the top. Stop the loop. |
433 // Editor or mailbox list in the top. Stop the loop. |
423 break; |
434 break; |
424 } |
435 } |
425 } |
436 } |
|
437 mForegroundService = previousForegroundService; |
426 } |
438 } |
427 |
439 |
428 // Check whether requested view is already active |
440 // Check whether requested view is already active |
429 // and if so, ask it to reload contents with new start parameter data |
441 // and if so, ask it to reload contents with new start parameter data |
430 // Do not reuse the view if started as service to editor view (ShareUI) |
442 // Do not reuse the view if started as service to editor view (ShareUI) |
615 if (mQueryDialog){ |
627 if (mQueryDialog){ |
616 delete mQueryDialog; |
628 delete mQueryDialog; |
617 mQueryDialog=NULL; |
629 mQueryDialog=NULL; |
618 } |
630 } |
619 mQueryDialog = NmUtilities::displayQuestionNote(hbTrId("txt_mail_dialog_address_or_password_incorrect"), |
631 mQueryDialog = NmUtilities::displayQuestionNote(hbTrId("txt_mail_dialog_address_or_password_incorrect"), |
620 this, SLOT(launchSettings(HbAction*))); |
632 this, SLOT(launchSettings(HbAction*))); |
621 } |
633 } |
622 if(event.mOperationType == Synch && event.mCompletionCode == NmServerConnectionError) { |
634 if(event.mOperationType == Synch && event.mCompletionCode == NmServerConnectionError) { |
623 mLastOperationMailbox=event.mMailboxId; |
635 mLastOperationMailbox=event.mMailboxId; |
624 if (mQueryDialog){ |
636 if (mQueryDialog){ |
625 delete mQueryDialog; |
637 delete mQueryDialog; |
626 mQueryDialog=NULL; |
638 mQueryDialog=NULL; |
627 } |
639 } |
628 mQueryDialog = NmUtilities::displayQuestionNote(hbTrId("txt_mail_dialog_server_settings_incorrect"), |
640 mQueryDialog = NmUtilities::displayQuestionNote(hbTrId("txt_mail_dialog_server_settings_incorrect"), |
629 this, SLOT(launchSettings(HbAction*))); |
641 this, SLOT(launchSettings(HbAction*))); |
630 } |
642 } |
631 // following applies to all operation/event types |
643 // following applies to all operation/event types |
632 if(event.mCompletionCode == NmConnectionError) { |
644 if(event.mCompletionCode == NmConnectionError) { |
633 NmUtilities::displayWarningNote(hbTrId("txt_mail_dialog_mail_connection_error")); |
645 NmUtilities::displayWarningNote(hbTrId("txt_mail_dialog_mail_connection_error")); |
634 } |
646 } |
639 launches settings view of the specified mailbox |
651 launches settings view of the specified mailbox |
640 */ |
652 */ |
641 void NmApplication::launchSettings(HbAction* action) |
653 void NmApplication::launchSettings(HbAction* action) |
642 { |
654 { |
643 NM_FUNCTION; |
655 NM_FUNCTION; |
644 |
656 |
645 // Check whether yes button was pressed |
657 // Check whether yes button was pressed |
646 if (mQueryDialog&& action == mQueryDialog->actions().at(0)) { |
658 if (mQueryDialog&& action == mQueryDialog->actions().at(0)) { |
647 // create settingslauncher if doesn't exist |
659 // create settingslauncher if doesn't exist |
648 if(!mSettingsViewLauncher) { |
660 if(!mSettingsViewLauncher) { |
649 mSettingsViewLauncher = new NmSettingsViewLauncher(); |
661 mSettingsViewLauncher = new NmSettingsViewLauncher(); |
650 } |
662 } |
651 |
663 |
652 if(mSettingsViewLauncher) { |
664 if(mSettingsViewLauncher) { |
653 // mailboxname required |
665 // mailboxname required |
654 NmMailboxMetaData *mailboxMetaData = mUiEngine->mailboxById(mLastOperationMailbox); // no ownership |
666 NmMailboxMetaData *mailboxMetaData = mUiEngine->mailboxById(mLastOperationMailbox); // no ownership |
655 if( mailboxMetaData ) { |
667 if( mailboxMetaData ) { |
656 // launch |
668 // launch |
657 mSettingsViewLauncher->launchSettingsView(mLastOperationMailbox, mailboxMetaData->name()); |
669 mSettingsViewLauncher->launchSettingsView(mLastOperationMailbox, mailboxMetaData->name()); |
658 } |
670 } |
659 } |
671 } |
660 } |
672 } |
661 } |
673 } |
662 |
674 |
663 /*! |
675 /*! |
664 Stores the visibility state, e.g. when the service was launched. |
676 Stores the visibility state, e.g. when the service was launched. |
665 \return true if the app was visible |
677 \return true if the app was visible |