emailuis/nmailuiengine/src/nmbaseclientplugin.cpp
changeset 43 99bcbff212ad
parent 40 2c62ef3caffd
child 66 084b5b1f02a7
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
   102 mUiEngine(NULL),
   102 mUiEngine(NULL),
   103 mEditorToolBarRequest(NULL),
   103 mEditorToolBarRequest(NULL),
   104 mViewerToolBarRequest(NULL),
   104 mViewerToolBarRequest(NULL),
   105 mViewerViewRequest(NULL)
   105 mViewerViewRequest(NULL)
   106 {
   106 {
   107     NMLOG("NmBaseClientPlugin::NmBaseClientPlugin()-->");
   107     NM_FUNCTION;
       
   108     
   108     mUiEngine = NmUiEngine::instance();
   109     mUiEngine = NmUiEngine::instance();
   109     NMLOG("<--NmBaseClientPlugin::NmBaseClientPlugin()");
       
   110 }
   110 }
   111 
   111 
   112 /*!
   112 /*!
   113     Destructor.
   113     Destructor.
   114 */
   114 */
   115 NmBaseClientPlugin::~NmBaseClientPlugin()
   115 NmBaseClientPlugin::~NmBaseClientPlugin()
   116 {
   116 {
   117     NMLOG("NmBaseClientPlugin::~NmBaseClientPlugin()-->");
   117     NM_FUNCTION;
       
   118     
   118     NmUiEngine::releaseInstance(mUiEngine);
   119     NmUiEngine::releaseInstance(mUiEngine);
   119     mUiEngine = NULL;
   120     mUiEngine = NULL;
   120     NMLOG("<--NmBaseClientPlugin::~NmBaseClientPlugin()");
   121 }
   121 }
   122 
   122 
   123 
   123 /*!
   124 /*!
   124     Provides list of supported NmActions.
   125     Provides a list of supported NmActions.
   125     Implementation of NmUiExtensionInterface.
   126     Implementation of NmUiExtensionInterface.
       
   127 
   126     Parameter \a request controls list of request services.
   128     Parameter \a request controls list of request services.
   127     Parameter \a actionList is updated by supported NmActions.
   129     Parameter \a actionList is updated by supported NmActions.
   128 */
   130 */
   129 void NmBaseClientPlugin::getActions(
   131 void NmBaseClientPlugin::getActions(const NmActionRequest &request,
   130       const NmActionRequest &request,
   132                                     QList<NmAction *> &actionList)
   131       QList<NmAction *> &actionList)
   133 {
   132 {
   134     NM_FUNCTION;
   133     NMLOG("NmBaseClientPlugin::getActions()-->");
   135     
   134 
       
   135     if (request.observer()) {
   136     if (request.observer()) {
   136         switch (request.contextView()) {
   137         switch (request.contextView()) {
   137             case NmActionContextViewMessageList:
   138             case NmActionContextViewMessageList:
       
   139             case NmActionContextViewMessageSearchList:
   138             {
   140             {
   139                 createMessageListCommands(request, actionList);
   141                 createMessageListCommands(request, actionList);
   140                 break;
   142                 break;
   141             }
   143             }
   142             case NmActionContextViewViewer:
   144             case NmActionContextViewViewer:
   149                 createEditorViewCommands(request, actionList);
   151                 createEditorViewCommands(request, actionList);
   150                 break;
   152                 break;
   151             }
   153             }
   152             default:
   154             default:
   153             {
   155             {
   154                 NMLOG(QString("NmBaseClientPlugin::getActions(): Unknown contextView()=%1").arg(request.contextView()));
   156                 NM_COMMENT(QString("NmBaseClientPlugin::getActions(): unknown contextView()=%1").arg(request.contextView()));
   155                 break;
   157                 break;
   156             }
   158             }
   157         }
   159         }
   158     }
   160     }
   159     NMLOG("<--NmBaseClientPlugin::getActions()");
   161 }
   160 }
   162 
   161 
   163 
   162 /*!
   164 /*!
   163     Public slot connected to options menu refresh NmAction.
   165     Public slot connected to options menu refresh NmAction.
   164     Refreshes mailbox using the NmUiEngine instance.
   166     Refreshes mailbox using the NmUiEngine instance.
   165 */
   167 */
   166 void NmBaseClientPlugin::refresh()
   168 void NmBaseClientPlugin::refresh()
   167 {
   169 {
   168     NMLOG("NmBaseClientPlugin::refresh()-->");
   170     NM_FUNCTION;
   169 
   171     
   170     int err = mUiEngine->refreshMailbox(mMenuRequest.mailboxId());
   172     int err = mUiEngine->refreshMailbox(mMenuRequest.mailboxId());
   171 
   173 
   172     if (NmNoError != err) {
   174     if (NmNoError != err) {
   173         // Failed to refresh the mailbox!
   175         // Failed to refresh the mailbox!
   174         NMLOG(QString("NmBaseClientPlugin::refresh(): failed err=%1").arg(err));
   176         NM_ERROR(1,QString("NmBaseClientPlugin::refresh(): failed err=%1").arg(err));
   175     }
   177     }
   176 
       
   177     NMLOG("<--NmBaseClientPlugin::refresh()");
       
   178 }
   178 }
   179 
   179 
   180 /*!
   180 /*!
   181     Public slot connected to triggered() signal of open message action instance.
   181     Public slot connected to triggered() signal of open message action instance.
   182     The method sends an open response command to the action observer.
   182     The method sends an open response command to the action observer.
   183 */
   183 */
   184 void NmBaseClientPlugin::openMessage()
   184 void NmBaseClientPlugin::openMessage()
   185 {
   185 {
       
   186     NM_FUNCTION;
       
   187     
   186     handleRequest(NmActionResponseCommandOpen, mMenuRequest);
   188     handleRequest(NmActionResponseCommandOpen, mMenuRequest);
   187 }
   189 }
   188 
   190 
   189 /*!
   191 /*!
   190     Public slot connected to delete message. Method asks UI engine to delete messages
   192     Public slot connected to delete message. Method asks UI engine to delete messages
   191 */
   193 */
   192 void NmBaseClientPlugin::deleteMessage()
   194 void NmBaseClientPlugin::deleteMessage()
   193 {
   195 {
   194     NMLOG("NmBaseClientPlugin::deleteMessage()-->");
   196     NM_FUNCTION;
   195 
   197     
   196     QList<NmId> messageList;
   198     QList<NmId> messageList;
   197     messageList.append(mMenuRequest.messageId());
   199     messageList.append(mMenuRequest.messageId());
   198 
   200 
   199     int err = mUiEngine->deleteMessages(mMenuRequest.mailboxId(),
   201     int err = mUiEngine->deleteMessages(mMenuRequest.mailboxId(),
   200                                         mMenuRequest.folderId(),
   202                                         mMenuRequest.folderId(),
   201                                         messageList);
   203                                         messageList);
   202     if (NmNoError != err) {
   204     if (NmNoError != err) {
   203         // Failed to delete the messages!
   205         // Failed to delete the messages!
   204         NMLOG(QString("NmBaseClientPlugin::deleteMessage(): failed err=%1").arg(err));
   206         NM_ERROR(1,QString("NmBaseClientPlugin::deleteMessage(): failed err=%1").arg(err));
   205     }
   207     }
   206     messageList.clear();
   208     messageList.clear();
   207     NMLOG("<--NmBaseClientPlugin::deleteMessage()");
       
   208 }
   209 }
   209 
   210 
   210 /*!
   211 /*!
   211     Public slot connected to triggered() signal of delete action instance.
   212     Public slot connected to triggered() signal of delete action instance.
   212     The method sends a delete mail command to the action observer.
   213     The method sends a delete mail command to the action observer.
   213 */
   214 */
   214 void NmBaseClientPlugin::deleteMessageFromViewerView()
   215 void NmBaseClientPlugin::deleteMessageFromViewerView()
   215 {
   216 {
       
   217     NM_FUNCTION;
       
   218     
   216     handleRequest(NmActionResponseCommandDeleteMail, mViewerViewRequest);
   219     handleRequest(NmActionResponseCommandDeleteMail, mViewerViewRequest);
   217 }
   220 }
   218 
   221 
   219 /*!
   222 /*!
   220     Public slot connected to triggered() signal of create mail action instance.
   223     Public slot connected to triggered() signal of create mail action instance.
   221     The method sends a new mail command to the action observer.
   224     The method sends a new mail command to the action observer.
   222 */
   225 */
   223 void NmBaseClientPlugin::createNewMailViewerToolBar()
   226 void NmBaseClientPlugin::createNewMailViewerToolBar()
   224 {
   227 {
       
   228     NM_FUNCTION;
       
   229     
   225     handleRequest(NmActionResponseCommandNewMail, mViewerToolBarRequest);
   230     handleRequest(NmActionResponseCommandNewMail, mViewerToolBarRequest);
   226 }
   231 }
   227 
   232 
   228 /*!
   233 /*!
   229     Public slot for handling the event of menu request for creating a new email.
   234     Public slot for handling the event of menu request for creating a new email.
   230     The method sends a new mail command to the action observer of the menu request.
   235     The method sends a new mail command to the action observer of the menu request.
   231 */
   236 */
   232 void NmBaseClientPlugin::createNewMail()
   237 void NmBaseClientPlugin::createNewMail()
   233 {
   238 {
       
   239     NM_FUNCTION;
       
   240     
   234     handleRequest(NmActionResponseCommandNewMail, mMenuRequest);
   241     handleRequest(NmActionResponseCommandNewMail, mMenuRequest);
   235 }
   242 }
   236 
   243 
   237 /*!
   244 /*!
   238     Public slot connected to options menu settings NmAction.
   245     Public slot connected to options menu settings NmAction.
   239     Opens mailbox settings.
   246     Opens mailbox settings.
   240 */
   247 */
   241 void NmBaseClientPlugin::settings()
   248 void NmBaseClientPlugin::settings()
   242 {
   249 {
       
   250     NM_FUNCTION;
       
   251     
   243     handleRequest(NmActionResponseCommandSettings, mMenuRequest);
   252     handleRequest(NmActionResponseCommandSettings, mMenuRequest);
   244 }
   253 }
   245 
   254 
   246 /*!
   255 /*!
   247     Public slot connected to triggered() signal of send mail action instance.
   256     Public slot connected to triggered() signal of send mail action instance.
   248     Sends the send mail command to the action observer.
   257     Sends the send mail command to the action observer.
   249 */
   258 */
   250 void NmBaseClientPlugin::sendMail()
   259 void NmBaseClientPlugin::sendMail()
   251 {
   260 {
       
   261     NM_FUNCTION;
       
   262     
   252     handleRequest(NmActionResponseCommandSendMail, mEditorToolBarRequest);
   263     handleRequest(NmActionResponseCommandSendMail, mEditorToolBarRequest);
   253 }
   264 }
   254 
   265 
   255 /*!
   266 /*!
   256     Public slot connected to triggered() signal of reply action instance of the
   267     Public slot connected to triggered() signal of reply action instance of the
   257     toolbar. Sends a reply mail command to the action observer.
   268     toolbar. Sends a reply mail command to the action observer.
   258 */
   269 */
   259 
   270 
   260 void NmBaseClientPlugin::replyMail()
   271 void NmBaseClientPlugin::replyMail()
   261 {
   272 {
       
   273     NM_FUNCTION;
       
   274     
   262     handleRequest(NmActionResponseCommandReply, mViewerViewRequest);
   275     handleRequest(NmActionResponseCommandReply, mViewerViewRequest);
   263 }
   276 }
   264 
   277 
   265 /*!
   278 /*!
   266     Public slot connected to triggered signal of reply all action instance of
   279     Public slot connected to triggered signal of reply all action instance of
   267     the toolbar. Sends a reply all mail command to the action observer.
   280     the toolbar. Sends a reply all mail command to the action observer.
   268 */
   281 */
   269 
   282 
   270 void NmBaseClientPlugin::replyAllMail()
   283 void NmBaseClientPlugin::replyAllMail()
   271 {
   284 {
       
   285     NM_FUNCTION;
       
   286     
   272     handleRequest(NmActionResponseCommandReplyAll, mViewerViewRequest);
   287     handleRequest(NmActionResponseCommandReplyAll, mViewerViewRequest);
   273 }
   288 }
   274 
   289 
   275 /*!
   290 /*!
   276     Public slot connected to triggered() signal of forward action instance of
   291     Public slot connected to triggered() signal of forward action instance of
   277     the toolbar. Sends a forward mail command to the action observer.
   292     the toolbar. Sends a forward mail command to the action observer.
   278 */
   293 */
   279 void NmBaseClientPlugin::forwardMail()
   294 void NmBaseClientPlugin::forwardMail()
   280 {
   295 {
       
   296     NM_FUNCTION;
       
   297     
   281     handleRequest(NmActionResponseCommandForward, mViewerViewRequest);
   298     handleRequest(NmActionResponseCommandForward, mViewerViewRequest);
   282 }
   299 }
   283 
   300 
   284 /*!
   301 /*!
   285     Public slot connected to set high priority toolbar action.
   302     Public slot connected to set high priority toolbar action.
   286 */
   303 */
   287 void NmBaseClientPlugin::setPriorityHigh()
   304 void NmBaseClientPlugin::setPriorityHigh()
   288 {
   305 {
       
   306     NM_FUNCTION;
       
   307     
   289     handleRequest(NmActionResponseCommandPriorityHigh, mMenuRequest);
   308     handleRequest(NmActionResponseCommandPriorityHigh, mMenuRequest);
   290 }
   309 }
   291 
   310 
   292 /*!
   311 /*!
   293     Public slot connected to set normal priority toolbar action.
   312     Public slot connected to set normal priority toolbar action.
   294 */
   313 */
   295 void NmBaseClientPlugin::setPriorityNormal()
   314 void NmBaseClientPlugin::setPriorityNormal()
   296 {
   315 {
       
   316     NM_FUNCTION;
       
   317     
   297     handleRequest(NmActionResponseCommandNone, mMenuRequest);
   318     handleRequest(NmActionResponseCommandNone, mMenuRequest);
   298 }
   319 }
   299 
   320 
   300 /*!
   321 /*!
   301     Public slot connected to set low priority toolbar action.
   322     Public slot connected to set low priority toolbar action.
   302 */
   323 */
   303 void NmBaseClientPlugin::setPriorityLow()
   324 void NmBaseClientPlugin::setPriorityLow()
   304 {
   325 {
       
   326     NM_FUNCTION;
       
   327     
   305     handleRequest(NmActionResponseCommandPriorityLow, mMenuRequest);
   328     handleRequest(NmActionResponseCommandPriorityLow, mMenuRequest);
   306 }
   329 }
   307 
   330 
   308 /*!
   331 /*!
   309     Public slot connected to attach toolbar action.
   332     Public slot connected to attach toolbar action.
   310 */
   333 */
   311 void NmBaseClientPlugin::attach()
   334 void NmBaseClientPlugin::attach()
   312 {
   335 {
       
   336     NM_FUNCTION;
       
   337     
   313     handleRequest(NmActionResponseCommandAttach, mEditorToolBarRequest);
   338     handleRequest(NmActionResponseCommandAttach, mEditorToolBarRequest);
   314 }
   339 }
   315 
   340 
   316 /*!
   341 /*!
   317     Public slot connected to remove attachment context menu action
   342     Public slot connected to remove attachment context menu action
   318 */
   343 */
   319 void NmBaseClientPlugin::removeAttachment()
   344 void NmBaseClientPlugin::removeAttachment()
   320 {
   345 {
       
   346     NM_FUNCTION;
       
   347     
   321     handleRequest(NmActionResponseCommandRemoveAttachment, mMenuRequest);
   348     handleRequest(NmActionResponseCommandRemoveAttachment, mMenuRequest);
   322 }
   349 }
   323 
   350 
   324 /*!
   351 /*!
   325     Public slot connected to open attachment context menu action
   352     Public slot connected to open attachment context menu action
   326 */
   353 */
   327 void NmBaseClientPlugin::openAttachment()
   354 void NmBaseClientPlugin::openAttachment()
   328 {
   355 {
       
   356     NM_FUNCTION;
       
   357     
   329     handleRequest(NmActionResponseCommandOpenAttachment, mMenuRequest);
   358     handleRequest(NmActionResponseCommandOpenAttachment, mMenuRequest);
   330 }
   359 }
   331 
   360 
   332 /*!
   361 /*!
   333     Requests the handling of the search action.
   362     Requests the handling of the search action.
   334     This public slot gets called when the search button in a toolbar is clicked.
   363     This public slot gets called when the search button in a toolbar is clicked.
   335 */
   364 */
   336 void NmBaseClientPlugin::search()
   365 void NmBaseClientPlugin::search()
   337 {
   366 {
       
   367     NM_FUNCTION;
       
   368     
   338     handleRequest(NmActionResponseCommandSearch, mViewerToolBarRequest);
   369     handleRequest(NmActionResponseCommandSearch, mViewerToolBarRequest);
   339 }
   370 }
   340 
   371 
   341 /*!
   372 /*!
   342     Private slot connected to settings view launcher.
   373     Private slot connected to settings view launcher.
   345     \param type type of change.
   376     \param type type of change.
   346 */
   377 */
   347 void NmBaseClientPlugin::mailboxListChanged(const NmId &mailboxId,
   378 void NmBaseClientPlugin::mailboxListChanged(const NmId &mailboxId,
   348     NmSettings::MailboxEventType type)
   379     NmSettings::MailboxEventType type)
   349 {
   380 {
       
   381     NM_FUNCTION;
       
   382     
   350     Q_UNUSED(mailboxId)
   383     Q_UNUSED(mailboxId)
   351     Q_UNUSED(type)
   384     Q_UNUSED(type)
   352     handleRequest(NmActionResponseCommandMailboxDeleted, mMenuRequest);
   385     handleRequest(NmActionResponseCommandMailboxDeleted, mMenuRequest);
   353 }
   386 }
   354 
   387 
   360     \param value
   393     \param value
   361 */
   394 */
   362 void NmBaseClientPlugin::mailboxPropertyChanged(const NmId &mailboxId, QVariant property,
   395 void NmBaseClientPlugin::mailboxPropertyChanged(const NmId &mailboxId, QVariant property,
   363     QVariant value)
   396     QVariant value)
   364 {
   397 {
       
   398     NM_FUNCTION;
       
   399     
   365     Q_UNUSED(property)
   400     Q_UNUSED(property)
   366     Q_UNUSED(value)
   401     Q_UNUSED(value)
   367 
   402 
   368     NmActionObserver *observer = mMenuRequest.observer();
   403     NmActionObserver *observer = mMenuRequest.observer();
   369     if (observer) {
   404     if (observer) {
   370         // Force model item to be updated, because framework adapter sends it too slowly.
   405         // Force model item to be updated, because framework adapter sends it too slowly.
   371         // Data changed signal is not emitted by this change, it is send when ever famework adapter
   406         mUiEngine->mailboxListModel().refreshModelItem(mailboxId);
   372         // calls data model's handleMailboxEvent method.
       
   373         mUiEngine->mailboxListModel().refreshModelItem(mailboxId, false);
       
   374 
   407 
   375         // Notify view of changes.
   408         // Notify view of changes.
   376         NmActionResponse response(NmActionResponseCommandUpdateMailboxName, mMenuRequest);
   409         NmActionResponse response(NmActionResponseCommandUpdateMailboxName, mMenuRequest);
   377         observer->handleActionCommand(response);
   410         observer->handleActionCommand(response);
   378     }
   411     }
   382     Private slot connected to settings view launcher.
   415     Private slot connected to settings view launcher.
   383     \param mailboxId Id of mailbox.
   416     \param mailboxId Id of mailbox.
   384 */
   417 */
   385 void NmBaseClientPlugin::goOnline(const NmId &mailboxId)
   418 void NmBaseClientPlugin::goOnline(const NmId &mailboxId)
   386 {
   419 {
       
   420     NM_FUNCTION;
       
   421     
   387 		(void) mUiEngine->refreshMailbox(mailboxId);
   422 		(void) mUiEngine->refreshMailbox(mailboxId);
   388 }
   423 }
   389 /*!
   424 /*!
   390     Private slot connected to settings view launcher.
   425     Private slot connected to settings view launcher.
   391     \param mailboxId Id of mailbox.
   426     \param mailboxId Id of mailbox.
   392 */
   427 */
   393 void NmBaseClientPlugin::goOffline(const NmId &mailboxId)
   428 void NmBaseClientPlugin::goOffline(const NmId &mailboxId)
   394 {
   429 {
       
   430     NM_FUNCTION;
       
   431     
   395         mUiEngine->goOffline(mailboxId);
   432         mUiEngine->goOffline(mailboxId);
   396 }
   433 }
   397 
   434 
   398 /*!
   435 /*!
   399     Create messagelist command actions.
   436     Create messagelist command actions.
   403 */
   440 */
   404 void NmBaseClientPlugin::createMessageListCommands(
   441 void NmBaseClientPlugin::createMessageListCommands(
   405     const NmActionRequest &request,
   442     const NmActionRequest &request,
   406     QList<NmAction *> &actionList)
   443     QList<NmAction *> &actionList)
   407 {
   444 {
   408     NMLOG("NmBaseClientPlugin::createMessageListCommands()-->");
   445     NM_FUNCTION;
   409 
   446     
   410     switch (request.menuType()) {
   447     switch (request.menuType()) {
   411         case NmActionOptionsMenu:
   448         case NmActionOptionsMenu:
   412         {
   449         {
   413             mMenuRequest = request;
   450             mMenuRequest = request;
   414 
   451 
   476                     folderType!=NmFolderDrafts ){
   513                     folderType!=NmFolderDrafts ){
   477                     NmMessageEnvelope *envelope =
   514                     NmMessageEnvelope *envelope =
   478                         request.requestData().value<NmMessageEnvelope*>();    
   515                         request.requestData().value<NmMessageEnvelope*>();    
   479                     if (envelope){
   516                     if (envelope){
   480                         if (envelope->isRead()){
   517                         if (envelope->isRead()){
   481                             NMLOG("nmailui: envelope is read");
   518                             NM_COMMENT("nmailui: envelope is read");
   482                             NmAction* unreadAction = new NmAction(0);
   519                             NmAction* unreadAction = new NmAction(0);
   483                             unreadAction->setObjectName("baseclientplugin_unreadaction");
   520                             unreadAction->setObjectName("baseclientplugin_unreadaction");
   484                             unreadAction->setText(hbTrId("txt_mail_menu_mark_as_unread"));
   521                             unreadAction->setText(hbTrId("txt_mail_menu_mark_as_unread"));
   485     
   522     
   486                             connect(unreadAction,
   523                             connect(unreadAction,
   489                                 SLOT(markAsUnread()));
   526                                 SLOT(markAsUnread()));
   490     
   527     
   491                             actionList.append(unreadAction);
   528                             actionList.append(unreadAction);
   492                         }
   529                         }
   493                         else {
   530                         else {
   494                             NMLOG("nmailui: envelope is unread");
   531                             NM_COMMENT("nmailui: envelope is unread");
   495                             NmAction* readAction = new NmAction(0);
   532                             NmAction* readAction = new NmAction(0);
   496                             readAction->setObjectName("baseclientplugin_readaction");
   533                             readAction->setObjectName("baseclientplugin_readaction");
   497                             readAction->setText(hbTrId("txt_mail_menu_mark_as_read"));
   534                             readAction->setText(hbTrId("txt_mail_menu_mark_as_read"));
   498     
   535     
   499                             connect(readAction,
   536                             connect(readAction,
   508             }
   545             }
   509             break;
   546             break;
   510         }
   547         }
   511         default:
   548         default:
   512         {
   549         {
   513             NMLOG(QString("NmBaseClientPlugin::createMessageListCommands(): Unknown menuType()=%1").arg(request.menuType()));
   550             NM_COMMENT(QString("NmBaseClientPlugin::createMessageListCommands(): unknown menuType()=%1").arg(request.menuType()));
   514             break;
   551             break;
   515         }
   552         }
   516     }
   553     }
   517     NMLOG("<--NmBaseClientPlugin::createMessageListCommands()");
       
   518 }
   554 }
   519 
   555 
   520 /*!
   556 /*!
   521     Create Viewer view command actions.
   557     Create Viewer view command actions.
   522     Internal helper method.
   558     Internal helper method.
   525 */
   561 */
   526 void NmBaseClientPlugin::createViewerViewCommands(
   562 void NmBaseClientPlugin::createViewerViewCommands(
   527     const NmActionRequest &request,
   563     const NmActionRequest &request,
   528     QList<NmAction *> &actionList)
   564     QList<NmAction *> &actionList)
   529 {
   565 {
   530     NMLOG("NmBaseClientPlugin::createViewerViewCommands()-->");
   566     NM_FUNCTION;
   531 
   567     
   532     switch (request.menuType()) {
   568     switch (request.menuType()) {
   533     	case NmActionOptionsMenu:
   569     	case NmActionOptionsMenu:
   534 		{
   570 		{
   535 			mViewerViewRequest = request;
   571 			mViewerViewRequest = request;
   536 
   572 
   619             actionList.append(deleteAction);
   655             actionList.append(deleteAction);
   620             break;
   656             break;
   621         }
   657         }
   622         default:
   658         default:
   623         {
   659         {
   624             NMLOG(QString("NmBaseClientPlugin::createViewerViewCommands(): Unknown menuType()=%1").arg(request.menuType()));
   660             NM_COMMENT(QString("NmBaseClientPlugin::createViewerViewCommands(): unknown menuType()=%1").arg(request.menuType()));
   625             break;
   661             break;
   626         }
   662         }
   627     }
   663     }
   628 
   664 
   629 }
   665 }
   636 */
   672 */
   637 void NmBaseClientPlugin::createEditorViewCommands(
   673 void NmBaseClientPlugin::createEditorViewCommands(
   638     const NmActionRequest &request,
   674     const NmActionRequest &request,
   639     QList<NmAction *> &actionList)
   675     QList<NmAction *> &actionList)
   640 {
   676 {
   641     NMLOG("NmBaseClientPlugin::createEditorViewCommands()-->");
   677     NM_FUNCTION;
   642 
   678     
   643     switch (request.menuType()) {
   679     switch (request.menuType()) {
   644         case NmActionToolbar:
   680         case NmActionToolbar:
   645         {
   681         {
   646             mEditorToolBarRequest = request;
   682             mEditorToolBarRequest = request;
   647 
   683 
   721             actionList.append(sendAction);
   757             actionList.append(sendAction);
   722             break;
   758             break;
   723         }
   759         }
   724         default:
   760         default:
   725         {
   761         {
   726             NMLOG(QString("NmBaseClientPlugin::createEditorViewCommands(): Unknown menuType()=%1").arg(request.menuType()));
   762             NM_COMMENT(QString("NmBaseClientPlugin::createEditorViewCommands(): unknown menuType()=%1").arg(request.menuType()));
   727             break;
   763             break;
   728         }
   764         }
   729     }
   765     }
   730 
       
   731     NMLOG("<--NmBaseClientPlugin::createEditorViewCommands()");
       
   732 }
   766 }
   733 
   767 
   734 /*!
   768 /*!
   735     Marks the message as read.
   769     Marks the message as read.
   736 */
   770 */
   737 void NmBaseClientPlugin::markAsRead()
   771 void NmBaseClientPlugin::markAsRead()
   738 {
   772 {
   739     NMLOG("NmBaseClientPlugin::markAsRead()-->");
   773     NM_FUNCTION;
       
   774     
   740     updateEnvelopeProperty(MarkAsRead);
   775     updateEnvelopeProperty(MarkAsRead);
   741     NMLOG("<--NmBaseClientPlugin::markAsRead()");
       
   742 }
   776 }
   743 
   777 
   744 /*!
   778 /*!
   745     Marks the message as unread.
   779     Marks the message as unread.
   746 */
   780 */
   747 void NmBaseClientPlugin::markAsUnread()
   781 void NmBaseClientPlugin::markAsUnread()
   748 {
   782 {
   749     NMLOG("NmBaseClientPlugin::markAsUnread()-->");
   783     NM_FUNCTION;
       
   784     
   750     updateEnvelopeProperty(MarkAsUnread);
   785     updateEnvelopeProperty(MarkAsUnread);
   751     NMLOG("<--NmBaseClientPlugin::markAsUnread()");
       
   752 }
   786 }
   753 
   787 
   754 /*!
   788 /*!
   755     Handles requests.
   789     Handles requests.
   756 */
   790 */
   757 void NmBaseClientPlugin::handleRequest(NmActionResponseCommand command, const NmActionRequest &request)
   791 void NmBaseClientPlugin::handleRequest(NmActionResponseCommand command, const NmActionRequest &request)
   758 {
   792 {
       
   793     NM_FUNCTION;
       
   794     
   759     NmActionObserver *observer = request.observer();
   795     NmActionObserver *observer = request.observer();
   760     if (observer) {
   796     if (observer) {
   761         NmActionResponse response(command, request);
   797         NmActionResponse response(command, request);
   762         observer->handleActionCommand(response);
   798         observer->handleActionCommand(response);
   763     }
   799     }
   765 /*!
   801 /*!
   766     Store envelope property.
   802     Store envelope property.
   767 */
   803 */
   768 void NmBaseClientPlugin::updateEnvelopeProperty(NmEnvelopeProperties property)
   804 void NmBaseClientPlugin::updateEnvelopeProperty(NmEnvelopeProperties property)
   769 {
   805 {
   770     NMLOG("NmBaseClientPlugin::updateEnvelopeProperty()-->");
   806     NM_FUNCTION;
   771 
   807     
   772     QList<const NmMessageEnvelope*> envelopeList;
   808     QList<const NmMessageEnvelope*> envelopeList;
   773     NmMessageEnvelope *envelope =
   809     NmMessageEnvelope *envelope =
   774             mMenuRequest.requestData().value<NmMessageEnvelope*>();
   810             mMenuRequest.requestData().value<NmMessageEnvelope*>();
   775 
   811 
   776     if (envelope) {
   812     if (envelope) {
   781                                         mMenuRequest.folderId(),
   817                                         mMenuRequest.folderId(),
   782                                         property,
   818                                         property,
   783                                         envelopeList);
   819                                         envelopeList);
   784     }
   820     }
   785     envelopeList.clear();
   821     envelopeList.clear();
   786     NMLOG("<--NmBaseClientPlugin::updateEnvelopeProperty()");
   822 }
   787 }