emailuis/nmailuiengine/src/nmbaseclientplugin.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
    98 */
    98 */
    99 NmBaseClientPlugin::NmBaseClientPlugin()
    99 NmBaseClientPlugin::NmBaseClientPlugin()
   100 :mMenuRequest(NULL),
   100 :mMenuRequest(NULL),
   101 mEditorToolBarRequest(NULL),
   101 mEditorToolBarRequest(NULL),
   102 mViewerToolBarRequest(NULL),
   102 mViewerToolBarRequest(NULL),
   103 mViewerViewToolbarRequest(NULL),
   103 mViewerViewRequest(NULL),
   104 mUiEngine(NULL),
   104 mUiEngine(NULL),
   105 mSettingsViewLauncher(NULL)
   105 mSettingsViewLauncher(NULL)
   106 {
   106 {
   107     NMLOG("NmBaseClientPlugin::NmBaseClientPlugin()-->");
   107     NMLOG("NmBaseClientPlugin::NmBaseClientPlugin()-->");
   108     mUiEngine = NmUiEngine::instance();
   108     mUiEngine = NmUiEngine::instance();
   210 
   210 
   211 /*!
   211 /*!
   212     Public slot connected to triggered() signal of delete action instance.
   212     Public slot connected to triggered() signal of delete action instance.
   213     The method sends a delete mail command to the action observer.
   213     The method sends a delete mail command to the action observer.
   214 */
   214 */
   215 void NmBaseClientPlugin::deleteMessageFromViewerViewToolbar()
   215 void NmBaseClientPlugin::deleteMessageFromViewerView()
   216 {
   216 {
   217     handleRequest(NmActionResponseCommandDeleteMail, mViewerViewToolbarRequest);
   217     handleRequest(NmActionResponseCommandDeleteMail, mViewerViewRequest);
   218 }
   218 }
   219 
   219 
   220 /*!
   220 /*!
   221     Public slot connected to triggered() signal of create mail action instance.
   221     Public slot connected to triggered() signal of create mail action instance.
   222     The method sends a new mail command to the action observer.
   222     The method sends a new mail command to the action observer.
   256                 this, SLOT(mailboxListChanged(const NmId &, NmSettings::MailboxEventType)));
   256                 this, SLOT(mailboxListChanged(const NmId &, NmSettings::MailboxEventType)));
   257 
   257 
   258             connect(mSettingsViewLauncher,
   258             connect(mSettingsViewLauncher,
   259                 SIGNAL(mailboxPropertyChanged(const NmId &, QVariant, QVariant)),
   259                 SIGNAL(mailboxPropertyChanged(const NmId &, QVariant, QVariant)),
   260                 this, SLOT(mailboxPropertyChanged(const NmId &, QVariant, QVariant)));
   260                 this, SLOT(mailboxPropertyChanged(const NmId &, QVariant, QVariant)));
       
   261 
       
   262             connect(mSettingsViewLauncher,
       
   263             	SIGNAL(goOnline(const NmId &)),
       
   264                 this, SLOT(goOnline(const NmId &)));
       
   265 
       
   266             connect(mSettingsViewLauncher,
       
   267             	SIGNAL(goOffline(const NmId &)),
       
   268                 this, SLOT(goOffline(const NmId &)));
   261         }
   269         }
   262 
   270 
   263         mSettingsViewLauncher->launchSettingsView(id, mailbox->name());
   271         mSettingsViewLauncher->launchSettingsView(id, mailbox->name());
   264     }
   272     }
   265  #endif
   273  #endif
   281     toolbar. Sends a reply mail command to the action observer.
   289     toolbar. Sends a reply mail command to the action observer.
   282 */
   290 */
   283 
   291 
   284 void NmBaseClientPlugin::replyMail()
   292 void NmBaseClientPlugin::replyMail()
   285 {
   293 {
   286     handleRequest(NmActionResponseCommandReply, mViewerViewToolbarRequest);
   294     handleRequest(NmActionResponseCommandReply, mViewerViewRequest);
   287 }
   295 }
   288 
   296 
   289 /*!
   297 /*!
   290     Public slot connected to triggered signal of reply all action instance of
   298     Public slot connected to triggered signal of reply all action instance of
   291     the toolbar. Sends a reply all mail command to the action observer.
   299     the toolbar. Sends a reply all mail command to the action observer.
   292 */
   300 */
   293 
   301 
   294 void NmBaseClientPlugin::replyAllMail()
   302 void NmBaseClientPlugin::replyAllMail()
   295 {
   303 {
   296     handleRequest(NmActionResponseCommandReplyAll, mViewerViewToolbarRequest);
   304     handleRequest(NmActionResponseCommandReplyAll, mViewerViewRequest);
   297 }
   305 }
   298 
   306 
   299 /*!
   307 /*!
   300     Public slot connected to triggered() signal of forward action instance of
   308     Public slot connected to triggered() signal of forward action instance of
   301     the toolbar. Sends a forward mail command to the action observer.
   309     the toolbar. Sends a forward mail command to the action observer.
   302 */
   310 */
   303 void NmBaseClientPlugin::forwardMail()
   311 void NmBaseClientPlugin::forwardMail()
   304 {
   312 {
   305     handleRequest(NmActionResponseCommandForward, mViewerViewToolbarRequest);
   313     handleRequest(NmActionResponseCommandForward, mViewerViewRequest);
   306 }
   314 }
   307 
   315 
   308 /*!
   316 /*!
   309     Public slot connected to set high priority toolbar action.
   317     Public slot connected to set high priority toolbar action.
   310 */
   318 */
   333     Public slot connected to attach toolbar action.
   341     Public slot connected to attach toolbar action.
   334 */
   342 */
   335 void NmBaseClientPlugin::attach()
   343 void NmBaseClientPlugin::attach()
   336 {
   344 {
   337     handleRequest(NmActionResponseCommandAttach, mEditorToolBarRequest);
   345     handleRequest(NmActionResponseCommandAttach, mEditorToolBarRequest);
       
   346 }
       
   347 
       
   348 /*!
       
   349     Public slot connected to remove attachment context menu action
       
   350 */
       
   351 void NmBaseClientPlugin::removeAttachment()
       
   352 {
       
   353     handleRequest(NmActionResponseCommandRemoveAttachment, mMenuRequest);
       
   354 }
       
   355 
       
   356 /*!
       
   357     Public slot connected to open attachment context menu action
       
   358 */
       
   359 void NmBaseClientPlugin::openAttachment()
       
   360 {
       
   361     handleRequest(NmActionResponseCommandOpenAttachment, mMenuRequest);
   338 }
   362 }
   339 
   363 
   340 /*!
   364 /*!
   341     Private slot connected to settings view launcher.
   365     Private slot connected to settings view launcher.
   342 
   366 
   373 
   397 
   374         // Notify view of changes.
   398         // Notify view of changes.
   375         NmActionResponse response(NmActionResponseCommandUpdateMailboxName, mMenuRequest);
   399         NmActionResponse response(NmActionResponseCommandUpdateMailboxName, mMenuRequest);
   376         observer->handleActionCommand(response);
   400         observer->handleActionCommand(response);
   377     }
   401     }
       
   402 }
       
   403 
       
   404 /*!
       
   405     Private slot connected to settings view launcher.
       
   406     \param mailboxId Id of mailbox.
       
   407 */
       
   408 void NmBaseClientPlugin::goOnline(const NmId &mailboxId)
       
   409 {
       
   410         mUiEngine->goOnline(mailboxId);
       
   411 }
       
   412 /*!
       
   413     Private slot connected to settings view launcher.
       
   414     \param mailboxId Id of mailbox.
       
   415 */
       
   416 void NmBaseClientPlugin::goOffline(const NmId &mailboxId)
       
   417 {
       
   418         mUiEngine->goOffline(mailboxId);
   378 }
   419 }
   379 
   420 
   380 /*!
   421 /*!
   381     Create messagelist command actions.
   422     Create messagelist command actions.
   382     Internal helper method.
   423     Internal helper method.
   492     QList<NmAction *> &actionList)
   533     QList<NmAction *> &actionList)
   493 {
   534 {
   494     NMLOG("NmBaseClientPlugin::createViewerViewCommands()-->");
   535     NMLOG("NmBaseClientPlugin::createViewerViewCommands()-->");
   495 
   536 
   496     switch (request.menuType()) {
   537     switch (request.menuType()) {
       
   538     	case NmActionOptionsMenu:
       
   539 		{
       
   540 			mViewerViewRequest = request;
       
   541 
       
   542 			// Options menu Reply action
       
   543 			NmAction *replyAction = new NmAction(0);
       
   544 			replyAction->setObjectName("baseclientplugin_reply");
       
   545 			replyAction->setText(hbTrId("txt_mail_viewer_opt_reply"));
       
   546 			connect(replyAction, SIGNAL(triggered()), this, SLOT(replyMail()));
       
   547 			actionList.append(replyAction);
       
   548 
       
   549 			// Options menu Reply all action
       
   550 			NmAction *replyAllAction = new NmAction(0);
       
   551 			replyAllAction->setObjectName("baseclientplugin_reply_all");
       
   552 			replyAllAction->setText(hbTrId("txt_mail_viewer_opt_reply_all"));
       
   553 			connect(replyAllAction, SIGNAL(triggered()), this, SLOT(replyAllMail()));
       
   554 			actionList.append(replyAllAction);
       
   555 
       
   556 			// Options menu Forward action
       
   557 			NmAction *forwardAction = new NmAction(0);
       
   558 			forwardAction->setObjectName("baseclientplugin_forward");
       
   559 			forwardAction->setText(hbTrId("txt_mail_viewer_opt_forward"));
       
   560 			connect(forwardAction, SIGNAL(triggered()), this, SLOT(forwardMail()));
       
   561 			actionList.append(forwardAction);
       
   562 
       
   563 			// Options menu Delete action
       
   564 			NmAction *deleteAction = new NmAction(0);
       
   565 			deleteAction->setObjectName("baseclientplugin_delete");
       
   566 			deleteAction->setText(hbTrId("txt_mail_viewer_opt_delete"));
       
   567 			connect(deleteAction, SIGNAL(triggered()),
       
   568 					this, SLOT(deleteMessageFromViewerView()));
       
   569 			actionList.append(deleteAction);
       
   570 			break;
       
   571 		}
   497         case NmActionToolbar:
   572         case NmActionToolbar:
   498         {
   573         {
   499             mViewerViewToolbarRequest = request;
   574             mViewerViewRequest = request;
   500 			Qt::Orientation orientation = Qt::Horizontal;
   575 			Qt::Orientation orientation = Qt::Horizontal;
   501 			HbMainWindow *mainWindow = static_cast<HbMainWindow*>(HbApplication::activeWindow());
   576 			HbMainWindow *mainWindow = static_cast<HbMainWindow*>(HbApplication::activeWindow());
   502 			if( mainWindow ) {
   577 			if( mainWindow ) {
   503             	orientation = mainWindow->orientation();
   578             	orientation = mainWindow->orientation();
   504 			}
   579 			}
   543             }
   618             }
   544             deleteAction->setToolTip(hbTrId("txt_mail_button_delete"));
   619             deleteAction->setToolTip(hbTrId("txt_mail_button_delete"));
   545             deleteAction->setIcon(NmIcons::getIcon(NmIcons::NmIconDelete));
   620             deleteAction->setIcon(NmIcons::getIcon(NmIcons::NmIconDelete));
   546             deleteAction->setObjectName("baseclientplugin_delete");
   621             deleteAction->setObjectName("baseclientplugin_delete");
   547             connect(deleteAction, SIGNAL(triggered()),
   622             connect(deleteAction, SIGNAL(triggered()),
   548                     this, SLOT(deleteMessageFromViewerViewToolbar()));
   623                     this, SLOT(deleteMessageFromViewerView()));
   549             actionList.append(deleteAction);
   624             actionList.append(deleteAction);
   550             break;
   625             break;
   551         }
   626         }
   552         default:
   627         default:
   553         {
   628         {
   616             action->setText(hbTrId("txt_mail_opt_add_priority_sub_low"));
   691             action->setText(hbTrId("txt_mail_opt_add_priority_sub_low"));
   617             connect(action, SIGNAL(triggered()), this, SLOT(setPriorityLow()));
   692             connect(action, SIGNAL(triggered()), this, SLOT(setPriorityLow()));
   618             actionList.append(action);
   693             actionList.append(action);
   619             break;
   694             break;
   620         }
   695         }
       
   696         case NmActionContextMenu:
       
   697         {
       
   698             mMenuRequest = request;
       
   699 
       
   700             NmAction *action = new NmAction(0);
       
   701             action->setObjectName("baseclientplugin_removeattachmentaction");
       
   702             action->setText(hbTrId("txt_common_menu_remove"));
       
   703             connect(action, SIGNAL(triggered()), this, SLOT(removeAttachment()));
       
   704             actionList.append(action);
       
   705 
       
   706             action = new NmAction(0);
       
   707             action->setObjectName("baseclientplugin_openattachmentaction");
       
   708             action->setText(hbTrId("txt_common_menu_open"));
       
   709             connect(action, SIGNAL(triggered()), this, SLOT(openAttachment()));
       
   710             actionList.append(action);
       
   711             break;	
       
   712         }
   621         case NmActionVKB:
   713         case NmActionVKB:
   622         {
   714         {
   623             mMenuRequest = request;
   715             mMenuRequest = request;
   624 
   716 
   625             // Virtual Keyboard Send action
   717             // Virtual Keyboard Send action