emailuis/nmailui/src/nmsendserviceinterface.cpp
changeset 54 997a02608b3a
parent 30 759dc5235cdb
child 62 a8c646b56683
equal deleted inserted replaced
53:bf7eb7911fc5 54:997a02608b3a
    56     */
    56     */
    57     inline bool extractData(const QVariant &data)
    57     inline bool extractData(const QVariant &data)
    58     {
    58     {
    59         NM_FUNCTION;
    59         NM_FUNCTION;
    60         
    60         
    61         bool success = false;
    61         bool success(false);
    62 
    62 
    63         if (data.canConvert(QVariant::Map)) {
    63         if (data.canConvert(QVariant::Map)) {
    64             // The given data may contain a mail subject and recipient lists.
    64             // The given data may contain a mail subject and recipient lists.
    65             QMap<QString, QVariant> map = data.toMap();
    65             QMap<QString, QVariant> map = data.toMap();
    66             success = processMap(map);
    66             success = processMap(map);
   247 */
   247 */
   248 NmSendServiceInterface::NmSendServiceInterface(QString interfaceName,
   248 NmSendServiceInterface::NmSendServiceInterface(QString interfaceName,
   249                                                QObject *parent,
   249                                                QObject *parent,
   250                                                NmUiEngine &uiEngine,
   250                                                NmUiEngine &uiEngine,
   251                                                NmApplication *application)
   251                                                NmApplication *application)
   252 #ifndef NM_WINS_ENV
       
   253     : XQServiceProvider(interfaceName, parent),
   252     : XQServiceProvider(interfaceName, parent),
   254 #else
       
   255     : QObject(parent),
       
   256 #endif
       
   257       mApplication(application),
   253       mApplication(application),
   258       mUiEngine(uiEngine),
   254       mUiEngine(uiEngine),
   259       mAsyncReqId(0),
   255       mAsyncReqId(0),
   260       mStartParam(NULL),
   256       mStartParam(NULL),
   261       mSelectionDialog(NULL),
   257       mSelectionDialog(NULL),
   262       mCurrentView(NULL)
   258       mCurrentView(NULL)
   263 {
   259 {
   264 #ifndef NM_WINS_ENV
       
   265     publishAll();
   260     publishAll();
   266 #endif
       
   267 }
   261 }
   268 
   262 
   269 
   263 
   270 /*!
   264 /*!
   271     Class desctructor.
   265     Class desctructor.
   309 */
   303 */
   310 void NmSendServiceInterface::send(QVariant data)
   304 void NmSendServiceInterface::send(QVariant data)
   311 {
   305 {
   312     NM_FUNCTION;
   306     NM_FUNCTION;
   313     
   307     
   314 #ifndef NM_WINS_ENV
   308     HbMainWindow *mainWindow(NULL);
   315     
   309     
   316     // Make sure that qmail stays background if user presses back in editorview
   310     // Make sure that qmail stays background if user presses back in editorview
   317     mApplication->updateVisibilityState();
   311     if (mApplication) {
   318     
   312         mApplication->updateVisibilityState();
   319     HbMainWindow *mainWindow = mApplication->mainWindow();
   313         
   320     mCurrentView = mainWindow->currentView();
   314         mainWindow = mApplication->mainWindow();
   321 
   315         mCurrentView = mainWindow->currentView();
   322     // Hide the current view.
   316     
   323     if (mCurrentView) {
   317         // Hide the current view.
   324         mCurrentView->hide();
   318         if (mCurrentView) {
       
   319             mCurrentView->hide();
       
   320         }    
   325     }
   321     }
   326 
   322 
   327     // Check the given data.
   323     // Check the given data.
   328     NmStartParamDataHelper dataHelper;
   324     NmStartParamDataHelper dataHelper;
   329     bool validData = dataHelper.extractData(data);
   325     bool validData = dataHelper.extractData(data);
   345         note.setTimeout(HbMessageBox::NoTimeout);
   341         note.setTimeout(HbMessageBox::NoTimeout);
   346         note.show();
   342         note.show();
   347         cancelService();
   343         cancelService();
   348     }
   344     }
   349     else { // count > 0
   345     else { // count > 0
   350         // Make sure the NMail application is in the foreground.
   346         if (mainWindow) {
   351         XQServiceUtil::toBackground(false);
   347             mainWindow->show();        
   352         mainWindow->show();
   348         }
   353 
   349 
   354     	mStartParam = new NmUiStartParam(
   350     	mStartParam = new NmUiStartParam(
   355         	NmUiViewMessageEditor,
   351         	NmUiViewMessageEditor,
   356 	        0, // account id
   352 	        0, // account id
   357 	        0, // folder id
   353 	        0, // folder id
   376         else { // count > 1
   372         else { // count > 1
   377             if (!mSelectionDialog) {
   373             if (!mSelectionDialog) {
   378                 mSelectionDialog =
   374                 mSelectionDialog =
   379                     new NmMailboxSelectionDialog(mUiEngine.mailboxListModel());
   375                     new NmMailboxSelectionDialog(mUiEngine.mailboxListModel());
   380             }
   376             }
   381             connect(mSelectionDialog,SIGNAL(selectionDialogClosed(NmId&)),
   377 
   382                 this,SLOT(selectionDialogClosed(NmId&)));
   378             connect(mSelectionDialog, SIGNAL(selectionDialogClosed(NmId&)),
       
   379                     this, SLOT(selectionDialogClosed(NmId&)));
   383             mSelectionDialog->open();
   380             mSelectionDialog->open();
   384 
   381 
   385             // launch the editor when the dialog is closed
   382             // launch the editor when the dialog is closed
   386         }
   383         }
   387     }
   384     }
   438             mCurrentView = NULL;
   435             mCurrentView = NULL;
   439         }
   436         }
   440     }
   437     }
   441 }
   438 }
   442 
   439 
   443 #endif /* NM_WINS_ENV */
       
   444 
       
   445 
       
   446 
       
   447 // End of file.
   440 // End of file.