emailuis/nmailui/src/nmsendserviceinterface.cpp
changeset 54 997a02608b3a
parent 30 759dc5235cdb
child 62 a8c646b56683
--- a/emailuis/nmailui/src/nmsendserviceinterface.cpp	Wed Jun 23 18:00:21 2010 +0300
+++ b/emailuis/nmailui/src/nmsendserviceinterface.cpp	Tue Jul 06 14:04:34 2010 +0300
@@ -58,7 +58,7 @@
     {
         NM_FUNCTION;
         
-        bool success = false;
+        bool success(false);
 
         if (data.canConvert(QVariant::Map)) {
             // The given data may contain a mail subject and recipient lists.
@@ -249,11 +249,7 @@
                                                QObject *parent,
                                                NmUiEngine &uiEngine,
                                                NmApplication *application)
-#ifndef NM_WINS_ENV
     : XQServiceProvider(interfaceName, parent),
-#else
-    : QObject(parent),
-#endif
       mApplication(application),
       mUiEngine(uiEngine),
       mAsyncReqId(0),
@@ -261,9 +257,7 @@
       mSelectionDialog(NULL),
       mCurrentView(NULL)
 {
-#ifndef NM_WINS_ENV
     publishAll();
-#endif
 }
 
 
@@ -311,17 +305,19 @@
 {
     NM_FUNCTION;
     
-#ifndef NM_WINS_ENV
+    HbMainWindow *mainWindow(NULL);
     
     // Make sure that qmail stays background if user presses back in editorview
-    mApplication->updateVisibilityState();
+    if (mApplication) {
+        mApplication->updateVisibilityState();
+        
+        mainWindow = mApplication->mainWindow();
+        mCurrentView = mainWindow->currentView();
     
-    HbMainWindow *mainWindow = mApplication->mainWindow();
-    mCurrentView = mainWindow->currentView();
-
-    // Hide the current view.
-    if (mCurrentView) {
-        mCurrentView->hide();
+        // Hide the current view.
+        if (mCurrentView) {
+            mCurrentView->hide();
+        }    
     }
 
     // Check the given data.
@@ -347,9 +343,9 @@
         cancelService();
     }
     else { // count > 0
-        // Make sure the NMail application is in the foreground.
-        XQServiceUtil::toBackground(false);
-        mainWindow->show();
+        if (mainWindow) {
+            mainWindow->show();        
+        }
 
     	mStartParam = new NmUiStartParam(
         	NmUiViewMessageEditor,
@@ -378,8 +374,9 @@
                 mSelectionDialog =
                     new NmMailboxSelectionDialog(mUiEngine.mailboxListModel());
             }
-            connect(mSelectionDialog,SIGNAL(selectionDialogClosed(NmId&)),
-                this,SLOT(selectionDialogClosed(NmId&)));
+
+            connect(mSelectionDialog, SIGNAL(selectionDialogClosed(NmId&)),
+                    this, SLOT(selectionDialogClosed(NmId&)));
             mSelectionDialog->open();
 
             // launch the editor when the dialog is closed
@@ -440,8 +437,4 @@
     }
 }
 
-#endif /* NM_WINS_ENV */
-
-
-
 // End of file.