emailuis/nmailui/src/nmapplication.cpp
changeset 76 38bf5461e270
parent 74 6c59112cfd31
equal deleted inserted replaced
74:6c59112cfd31 76:38bf5461e270
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 
    20 
    21 static const QString NmSendServiceName = "nmail.com.nokia.symbian.IFileShare";
    21 static const QString NmSendServiceName = "nmail.com.nokia.symbian.IFileShare";
    22 static const QString NmActivityName = "EmailInboxView";
    22 static const QString NmActivityName = "EmailInboxView";
    23 static const int NmErrorNoteDelay = 300000;
    23 static const int NmErrorNoteDelay = 300000;
       
    24 static const qreal NmMinusNinetyDegrees = -90;
    24 
    25 
    25 /*!
    26 /*!
    26     \class NmApplication
    27     \class NmApplication
    27     \brief Application class, creates main window and handles view switching.
    28     \brief Application class, creates main window and handles view switching.
    28 */
    29 */
    42   mMbListModel(NULL),
    43   mMbListModel(NULL),
    43   mServiceViewId(NmUiViewNone),
    44   mServiceViewId(NmUiViewNone),
    44   mForegroundService(false),
    45   mForegroundService(false),
    45   mEffects(NULL),
    46   mEffects(NULL),
    46   mAttaManager(NULL),
    47   mAttaManager(NULL),
    47   mSettingsViewLauncher(NULL),
       
    48   mViewReady(false),
    48   mViewReady(false),
    49   mQueryDialog(NULL),
    49   mQueryDialog(NULL),
    50   mBackButtonPressed(false),
    50   mBackButtonPressed(false),
    51   mApplicationHidden(false),
    51   mApplicationHidden(false),
    52   mErrorNoteTimer(NULL),
    52   mErrorNoteTimer(NULL),
   165     
   165     
   166     // Effects need to be deleted before MainWindow.
   166     // Effects need to be deleted before MainWindow.
   167     delete mEffects;
   167     delete mEffects;
   168     delete mMainWindow;
   168     delete mMainWindow;
   169     delete mAttaManager;
   169     delete mAttaManager;
   170     delete mSettingsViewLauncher;
       
   171     delete mActivityStorage;
   170     delete mActivityStorage;
   172     delete mActivation;
   171     delete mActivation;
   173 }
   172 }
   174 
   173 
   175 
   174 
   251     Slot. React to view ready signal and call current view method.
   250     Slot. React to view ready signal and call current view method.
   252 */
   251 */
   253 void NmApplication::viewReady()
   252 void NmApplication::viewReady()
   254 {
   253 {
   255     mViewReady = true;
   254     mViewReady = true;
   256 
   255     
   257     if (mViewStack && !mViewStack->isEmpty()) {
   256     if (mViewStack && !mViewStack->isEmpty()) {
   258     	NmBaseView *currentView = mViewStack->top();
   257     	NmBaseView *currentView = mViewStack->top();
   259 
   258 
   260         if (currentView) {
   259         if (currentView) {
   261             currentView->viewReady();
   260             currentView->viewReady();
   262             emit applicationReady();
       
   263         }
   261         }
   264     NM_TIMESTAMP("Application view ready.");
   262     NM_TIMESTAMP("Application view ready.");
   265     }
   263     }
       
   264     emit applicationReady();
   266 }
   265 }
   267 
   266 
   268 
   267 
   269 /*!
   268 /*!
   270     Event filter. End key is filtered from the main window and either the view
   269     Event filter. End key is filtered from the main window and either the view
   562         // view if started as service to editor view (ShareUI).
   561         // view if started as service to editor view (ShareUI).
   563         if (mActiveViewId == startParam->viewId() &&
   562         if (mActiveViewId == startParam->viewId() &&
   564         	(!startParam->service() || mActiveViewId!=NmUiViewMessageEditor)) {
   563         	(!startParam->service() || mActiveViewId!=NmUiViewMessageEditor)) {
   565             
   564             
   566             //startParam pointer is tested before usage below
   565             //startParam pointer is tested before usage below
   567             //coverity[deref_arg]
   566             //coverity[freed_arg]
   568             mViewStack->top()->reloadViewContents(startParam);
   567             mViewStack->top()->reloadViewContents(startParam);
   569         }
   568         }
   570         else {
   569         else {
   571             switch (startParam->viewId()) {
   570             switch (startParam->viewId()) {
   572                 case NmUiViewMailboxList:
   571                 case NmUiViewMailboxList:
   807 */
   806 */
   808 void NmApplication::launchSettings(HbAction* action)
   807 void NmApplication::launchSettings(HbAction* action)
   809 {
   808 {
   810     // Check whether yes button was pressed.
   809     // Check whether yes button was pressed.
   811     if (mQueryDialog&& action == mQueryDialog->actions().at(0)) {
   810     if (mQueryDialog&& action == mQueryDialog->actions().at(0)) {
   812         // Create settingslauncher if doesn't exist.
   811         // Launch.
   813         if(!mSettingsViewLauncher) {
   812         mExtensionManager->launchSettings(mCurrentMailboxId);
   814             mSettingsViewLauncher = new NmSettingsViewLauncher();
       
   815             }
       
   816         // Mailboxname required.
       
   817         NmMailboxMetaData *mailboxMetaData = mUiEngine->mailboxById(mLastOperationMailbox); // No ownership.
       
   818         if( mailboxMetaData ) {
       
   819             // Launch.
       
   820             mSettingsViewLauncher->launchSettingsView(mLastOperationMailbox, mailboxMetaData->name());
       
   821         }
       
   822     }
   813     }
   823 }
   814 }
   824 
   815 
   825 
   816 
   826 /*!
   817 /*!
   859     if(!XQServiceUtil::isService() || !XQServiceUtil::isEmbedded()) {
   850     if(!XQServiceUtil::isService() || !XQServiceUtil::isEmbedded()) {
   860         if (meta) {
   851         if (meta) {
   861             TsTaskSettings tasksettings;
   852             TsTaskSettings tasksettings;
   862             tasksettings.setVisibility(false);
   853             tasksettings.setVisibility(false);
   863             QVariantHash metadata;
   854             QVariantHash metadata;
   864             metadata.insert(ActivityScreenshotKeyword, QPixmap::grabWidget(mainWindow(), mainWindow()->rect()));
   855             QPixmap screenshot = QPixmap::grabWidget(mainWindow(), mainWindow()->rect());
       
   856             // Landscape needs to be rotated 90 degrees counter-clockwise
       
   857             if (mainWindow()->orientation() == Qt::Horizontal) {
       
   858                 QMatrix mat;
       
   859                 mat.rotate(NmMinusNinetyDegrees);
       
   860                 screenshot = screenshot.transformed(mat);
       
   861             }
       
   862             metadata.insert(ActivityScreenshotKeyword, screenshot);
   865             metadata.insert(ActivityApplicationName, meta->name());
   863             metadata.insert(ActivityApplicationName, meta->name());
   866             metadata.insert(ActivityVisibility, true);
   864             metadata.insert(ActivityVisibility, true);
   867             ok = mActivityStorage->saveActivity(NmActivityName, QVariant(), metadata);
   865             ok = mActivityStorage->saveActivity(NmActivityName, QVariant(), metadata);
   868             if(!ok) {
   866             if(!ok) {
   869                 NM_COMMENT("Save activity to Task Switcher failed.");
   867                 NM_COMMENT("Save activity to Task Switcher failed.");