96 /*! |
97 /*! |
97 Constructs a new NmBaseClientPlugin. |
98 Constructs a new NmBaseClientPlugin. |
98 */ |
99 */ |
99 NmBaseClientPlugin::NmBaseClientPlugin() |
100 NmBaseClientPlugin::NmBaseClientPlugin() |
100 :mMenuRequest(NULL), |
101 :mMenuRequest(NULL), |
|
102 mUiEngine(NULL), |
101 mEditorToolBarRequest(NULL), |
103 mEditorToolBarRequest(NULL), |
102 mViewerToolBarRequest(NULL), |
104 mViewerToolBarRequest(NULL), |
103 mViewerViewRequest(NULL), |
105 mViewerViewRequest(NULL) |
104 mUiEngine(NULL), |
|
105 mSettingsViewLauncher(NULL) |
|
106 { |
106 { |
107 NMLOG("NmBaseClientPlugin::NmBaseClientPlugin()-->"); |
107 NMLOG("NmBaseClientPlugin::NmBaseClientPlugin()-->"); |
108 mUiEngine = NmUiEngine::instance(); |
108 mUiEngine = NmUiEngine::instance(); |
109 NMLOG("<--NmBaseClientPlugin::NmBaseClientPlugin()"); |
109 NMLOG("<--NmBaseClientPlugin::NmBaseClientPlugin()"); |
110 } |
110 } |
239 Public slot connected to options menu settings NmAction. |
238 Public slot connected to options menu settings NmAction. |
240 Opens mailbox settings. |
239 Opens mailbox settings. |
241 */ |
240 */ |
242 void NmBaseClientPlugin::settings() |
241 void NmBaseClientPlugin::settings() |
243 { |
242 { |
244 NMLOG("NmBaseClientPlugin::settings()-->"); |
|
245 |
|
246 #ifndef NM_WINS_ENV |
|
247 const NmId &id = mMenuRequest.mailboxId(); |
|
248 NmMailboxMetaData *mailbox = mUiEngine->mailboxById(id); |
|
249 |
|
250 if (mailbox) { |
|
251 if (!mSettingsViewLauncher) { |
|
252 mSettingsViewLauncher = new NmSettingsViewLauncher(); |
|
253 |
|
254 connect(mSettingsViewLauncher, |
|
255 SIGNAL(mailboxListChanged(const NmId &, NmSettings::MailboxEventType)), |
|
256 this, SLOT(mailboxListChanged(const NmId &, NmSettings::MailboxEventType))); |
|
257 |
|
258 connect(mSettingsViewLauncher, |
|
259 SIGNAL(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 &))); |
|
269 } |
|
270 |
|
271 mSettingsViewLauncher->launchSettingsView(id, mailbox->name()); |
|
272 } |
|
273 #endif |
|
274 |
|
275 NMLOG("<--NmBaseClientPlugin::settings()"); |
|
276 } |
243 } |
277 |
244 |
278 /*! |
245 /*! |
279 Public slot connected to triggered() signal of send mail action instance. |
246 Public slot connected to triggered() signal of send mail action instance. |
280 Sends the send mail command to the action observer. |
247 Sends the send mail command to the action observer. |
357 Public slot connected to open attachment context menu action |
324 Public slot connected to open attachment context menu action |
358 */ |
325 */ |
359 void NmBaseClientPlugin::openAttachment() |
326 void NmBaseClientPlugin::openAttachment() |
360 { |
327 { |
361 handleRequest(NmActionResponseCommandOpenAttachment, mMenuRequest); |
328 handleRequest(NmActionResponseCommandOpenAttachment, mMenuRequest); |
|
329 } |
|
330 |
|
331 /*! |
|
332 Requests the handling of the search action. |
|
333 This public slot gets called when the search button in a toolbar is clicked. |
|
334 */ |
|
335 void NmBaseClientPlugin::search() |
|
336 { |
|
337 handleRequest(NmActionResponseCommandSearch, mViewerToolBarRequest); |
362 } |
338 } |
363 |
339 |
364 /*! |
340 /*! |
365 Private slot connected to settings view launcher. |
341 Private slot connected to settings view launcher. |
366 |
342 |
448 actionList.append(settingsAction); |
424 actionList.append(settingsAction); |
449 break; |
425 break; |
450 } |
426 } |
451 case NmActionToolbar: |
427 case NmActionToolbar: |
452 { |
428 { |
|
429 // Create the search button. |
|
430 NmAction *mailSearchAction = new NmAction(0); |
|
431 mailSearchAction->setObjectName("baseclientplugin_mailsearchaction"); |
|
432 mailSearchAction->setText(hbTrId("txt_mail_list_search")); |
|
433 mailSearchAction->setIcon(HbIcon("qtg_mono_search")); |
|
434 connect(mailSearchAction, SIGNAL(triggered()), this, SLOT(search())); |
|
435 actionList.append(mailSearchAction); |
|
436 |
|
437 // Create new mail button. |
453 mViewerToolBarRequest = request; |
438 mViewerToolBarRequest = request; |
454 NmAction *createMailAction = new NmAction(0); |
439 NmAction *createMailAction = new NmAction(0); |
455 createMailAction->setObjectName("baseclientplugin_createmailaction"); |
440 createMailAction->setObjectName("baseclientplugin_createmailaction"); |
456 createMailAction->setText(hbTrId("txt_mail_button_new_mail")); |
441 createMailAction->setText(hbTrId("txt_mail_button_new_mail")); |
457 createMailAction->setIcon(NmIcons::getIcon(NmIcons::NmIconNewEmail)); |
442 createMailAction->setIcon(NmIcons::getIcon(NmIcons::NmIconNewEmail)); |
463 case NmActionContextMenu: |
448 case NmActionContextMenu: |
464 { |
449 { |
465 if (request.contextDataType() == NmActionContextDataMessage){ |
450 if (request.contextDataType() == NmActionContextDataMessage){ |
466 mMenuRequest = request; |
451 mMenuRequest = request; |
467 |
452 |
468 // Open message |
453 NmFolderType folderType(NmFolderInbox); |
469 NmAction* openAction = new NmAction(0); |
454 if (mUiEngine){ |
470 openAction->setObjectName("baseclientplugin_openaction"); |
455 folderType = mUiEngine->folderTypeById(request.mailboxId(),request.folderId()); |
471 openAction->setText(hbTrId("txt_common_menu_open")); |
456 } |
472 connect(openAction, SIGNAL(triggered()), this, SLOT(openMessage())); |
457 |
473 actionList.append(openAction); |
458 if (folderType!=NmFolderOutbox){ |
|
459 // Open message |
|
460 NmAction* openAction = new NmAction(0); |
|
461 openAction->setObjectName("baseclientplugin_openaction"); |
|
462 openAction->setText(hbTrId("txt_common_menu_open")); |
|
463 connect(openAction, SIGNAL(triggered()), this, SLOT(openMessage())); |
|
464 actionList.append(openAction); |
|
465 } |
474 |
466 |
475 // Delete message |
467 // Delete message |
476 NmAction* deleteAction = new NmAction(0); |
468 NmAction* deleteAction = new NmAction(0); |
477 deleteAction->setObjectName("baseclientplugin_deleteaction"); |
469 deleteAction->setObjectName("baseclientplugin_deleteaction"); |
478 deleteAction->setText(hbTrId("txt_common_menu_delete")); |
470 deleteAction->setText(hbTrId("txt_common_menu_delete")); |
479 connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteMessage())); |
471 connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteMessage())); |
480 actionList.append(deleteAction); |
472 actionList.append(deleteAction); |
481 |
473 |
482 NmMessageEnvelope *envelope = |
474 if (folderType!=NmFolderOutbox && |
483 request.requestData().value<NmMessageEnvelope*>(); |
475 folderType!=NmFolderDrafts ){ |
484 |
476 NmMessageEnvelope *envelope = |
485 if (envelope){ |
477 request.requestData().value<NmMessageEnvelope*>(); |
486 if (envelope->isRead()){ |
478 if (envelope){ |
487 NMLOG("nmailui: envelope is read"); |
479 if (envelope->isRead()){ |
488 NmAction* unreadAction = new NmAction(0); |
480 NMLOG("nmailui: envelope is read"); |
489 unreadAction->setObjectName("baseclientplugin_unreadaction"); |
481 NmAction* unreadAction = new NmAction(0); |
490 unreadAction->setText(hbTrId("txt_mail_menu_mark_as_unread")); |
482 unreadAction->setObjectName("baseclientplugin_unreadaction"); |
491 |
483 unreadAction->setText(hbTrId("txt_mail_menu_mark_as_unread")); |
492 connect(unreadAction, |
484 |
493 SIGNAL(triggered()), |
485 connect(unreadAction, |
494 this, |
486 SIGNAL(triggered()), |
495 SLOT(markAsUnread())); |
487 this, |
496 |
488 SLOT(markAsUnread())); |
497 actionList.append(unreadAction); |
489 |
498 } |
490 actionList.append(unreadAction); |
499 else { |
491 } |
500 NMLOG("nmailui: envelope is unread"); |
492 else { |
501 NmAction* readAction = new NmAction(0); |
493 NMLOG("nmailui: envelope is unread"); |
502 readAction->setObjectName("baseclientplugin_readaction"); |
494 NmAction* readAction = new NmAction(0); |
503 readAction->setText(hbTrId("txt_mail_menu_mark_as_read")); |
495 readAction->setObjectName("baseclientplugin_readaction"); |
504 |
496 readAction->setText(hbTrId("txt_mail_menu_mark_as_read")); |
505 connect(readAction, |
497 |
506 SIGNAL(triggered()), |
498 connect(readAction, |
507 this, |
499 SIGNAL(triggered()), |
508 SLOT(markAsRead())); |
500 this, |
509 |
501 SLOT(markAsRead())); |
510 actionList.append(readAction); |
502 |
|
503 actionList.append(readAction); |
|
504 } |
511 } |
505 } |
512 } |
506 } |
513 } |
507 } |
514 break; |
508 break; |
515 } |
509 } |
653 // ToolBar Attach action |
647 // ToolBar Attach action |
654 NmAction *attachAction = new NmAction(0); |
648 NmAction *attachAction = new NmAction(0); |
655 attachAction->setObjectName("baseclientplugin_attachaction"); |
649 attachAction->setObjectName("baseclientplugin_attachaction"); |
656 attachAction->setText(hbTrId("txt_mail_button_attach")); |
650 attachAction->setText(hbTrId("txt_mail_button_attach")); |
657 attachAction->setIcon(NmIcons::getIcon(NmIcons::NmIconAttach)); |
651 attachAction->setIcon(NmIcons::getIcon(NmIcons::NmIconAttach)); |
|
652 // Action only available when attachment can be added |
|
653 attachAction->setAvailabilityCondition(NmAction::NmAttachable); |
658 // connect action/add toolbar extensions |
654 // connect action/add toolbar extensions |
659 connect(attachAction, SIGNAL(triggered()), this, SLOT(attach())); |
655 connect(attachAction, SIGNAL(triggered()), this, SLOT(attach())); |
660 actionList.append(attachAction); |
656 actionList.append(attachAction); |
661 |
657 |
662 // ToolBar Send action |
658 // ToolBar Send action |
706 action = new NmAction(0); |
702 action = new NmAction(0); |
707 action->setObjectName("baseclientplugin_openattachmentaction"); |
703 action->setObjectName("baseclientplugin_openattachmentaction"); |
708 action->setText(hbTrId("txt_common_menu_open")); |
704 action->setText(hbTrId("txt_common_menu_open")); |
709 connect(action, SIGNAL(triggered()), this, SLOT(openAttachment())); |
705 connect(action, SIGNAL(triggered()), this, SLOT(openAttachment())); |
710 actionList.append(action); |
706 actionList.append(action); |
711 break; |
707 break; |
712 } |
708 } |
713 case NmActionVKB: |
709 case NmActionVKB: |
714 { |
710 { |
715 mMenuRequest = request; |
711 mMenuRequest = request; |
716 |
712 |
777 mMenuRequest.requestData().value<NmMessageEnvelope*>(); |
773 mMenuRequest.requestData().value<NmMessageEnvelope*>(); |
778 |
774 |
779 if (envelope) { |
775 if (envelope) { |
780 envelopeList.append(envelope); |
776 envelopeList.append(envelope); |
781 |
777 |
782 NmStoreEnvelopesOperation* op = |
778 QPointer<NmStoreEnvelopesOperation> op = |
783 mUiEngine->setEnvelopes(mMenuRequest.mailboxId(), |
779 mUiEngine->setEnvelopes(mMenuRequest.mailboxId(), |
784 mMenuRequest.folderId(), |
780 mMenuRequest.folderId(), |
785 property, |
781 property, |
786 envelopeList); |
782 envelopeList); |
787 |
|
788 if (op) { |
|
789 mUiEngine->storeOperation(op); |
|
790 } |
|
791 } |
783 } |
792 envelopeList.clear(); |
784 envelopeList.clear(); |
793 NMLOG("<--NmBaseClientPlugin::updateEnvelopeProperty()"); |
785 NMLOG("<--NmBaseClientPlugin::updateEnvelopeProperty()"); |
794 } |
786 } |