16 */ |
16 */ |
17 #include "nmuiheaders.h" |
17 #include "nmuiheaders.h" |
18 |
18 |
19 // Layout file and view |
19 // Layout file and view |
20 static const char *NMUI_EDITOR_VIEW_XML = ":/docml/nmeditorview.docml"; |
20 static const char *NMUI_EDITOR_VIEW_XML = ":/docml/nmeditorview.docml"; |
21 static const char *NMUI_EDITOR_VIEW= "editorview"; |
21 static const char *NMUI_EDITOR_VIEW = "editorview"; |
22 |
22 |
|
23 // extension list item frame. |
|
24 static const QString NmPopupListFrame = "qtg_fr_popup_list_normal"; |
23 static const QString NmDelimiter("; "); |
25 static const QString NmDelimiter("; "); |
|
26 static const QString NmPriorityLow("low"); |
|
27 static const QString NmPriorityNormal("normal"); |
|
28 static const QString NmPriorityHigh("high"); |
24 |
29 |
25 /*! |
30 /*! |
26 \class NmEditorView |
31 \class NmEditorView |
27 \brief Mail editor view |
32 \brief Mail editor view |
28 */ |
33 */ |
50 mRemoveAttachmentOperation(NULL), |
55 mRemoveAttachmentOperation(NULL), |
51 mWaitDialog(NULL), |
56 mWaitDialog(NULL), |
52 mQueryDialog(NULL), |
57 mQueryDialog(NULL), |
53 mAttachmentPicker(NULL), |
58 mAttachmentPicker(NULL), |
54 mCcBccFieldVisible(false), |
59 mCcBccFieldVisible(false), |
55 mServiceSendingDialog(NULL) |
60 mServiceSendingDialog(NULL), |
|
61 mIsNotFetchedBefore(true), |
|
62 mHiddenPriorityName(NmPriorityNormal) |
56 { |
63 { |
57 NM_FUNCTION; |
64 NM_FUNCTION; |
58 |
65 |
59 mDocumentLoader = new HbDocumentLoader(); |
66 mDocumentLoader = new HbDocumentLoader(); |
60 // Set object name |
67 // Set object name |
390 */ |
398 */ |
391 void NmEditorView::fetchMessageIfNeeded(NmUiStartParam &startParam) |
399 void NmEditorView::fetchMessageIfNeeded(NmUiStartParam &startParam) |
392 { |
400 { |
393 NM_FUNCTION; |
401 NM_FUNCTION; |
394 |
402 |
395 if (startParam.editorStartMode() == NmUiEditorForward |
403 if (mIsNotFetchedBefore == true) { |
396 || startParam.editorStartMode()== NmUiEditorReply |
404 if (startParam.editorStartMode() == NmUiEditorForward |
397 || startParam.editorStartMode() == NmUiEditorReplyAll) { |
405 || startParam.editorStartMode()== NmUiEditorReply |
398 |
406 || startParam.editorStartMode() == NmUiEditorReplyAll) { |
399 fetchProgressDialogShow(); |
407 |
400 mAttaManager.clearObserver(); |
408 fetchProgressDialogShow(); |
401 mAttaManager.setObserver(this); |
409 mAttaManager.clearObserver(); |
402 mAttaManager.fetchAllMessageParts( |
410 mAttaManager.setObserver(this); |
403 startParam.mailboxId(), |
411 mAttaManager.fetchAllMessageParts( |
404 startParam.folderId(), |
412 startParam.mailboxId(), |
405 startParam.messageId()); |
413 startParam.folderId(), |
406 } |
414 startParam.messageId()); |
407 else { |
415 } |
408 startMessageCreation(startParam); |
416 else { |
|
417 startMessageCreation(startParam); |
|
418 } |
|
419 |
|
420 mIsNotFetchedBefore = false; |
409 } |
421 } |
410 } |
422 } |
411 |
423 |
412 /*! |
424 /*! |
413 Slot. Called when attachments fetch progress changes. |
425 Slot. Called when attachments fetch progress changes. |
888 mAttachmentPicker = new NmAttachmentPicker(this); |
900 mAttachmentPicker = new NmAttachmentPicker(this); |
889 |
901 |
890 if (extension && mAttachmentPicker) { |
902 if (extension && mAttachmentPicker) { |
891 connect(mAttachmentPicker, SIGNAL(attachmentsFetchOk(const QVariant &)), |
903 connect(mAttachmentPicker, SIGNAL(attachmentsFetchOk(const QVariant &)), |
892 this, SLOT(onAttachmentReqCompleted(const QVariant &))); |
904 this, SLOT(onAttachmentReqCompleted(const QVariant &))); |
893 |
|
894 HbAction* actionPhoto = |
|
895 extension->addAction(hbTrId("txt_mail_list_photo"), extension, SLOT(close())); |
|
896 connect(actionPhoto, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchImage())); |
|
897 |
905 |
898 HbAction* actionMusic = |
906 list[i]->setToolBarExtension(extension); |
899 extension->addAction(hbTrId("txt_mail_list_music"), extension, SLOT(close())); |
|
900 connect(actionMusic, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchAudio())); |
|
901 |
907 |
902 HbAction* actionVideo = |
908 //content widget to get the items to a list |
903 extension->addAction(hbTrId("txt_mail_list_video"), extension, SLOT(close())); |
909 mTBExtnContentWidget = new HbListWidget(); |
904 connect(actionVideo, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchVideo())); |
910 mTBExtnContentWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); |
905 |
911 |
906 HbAction* actionOther = |
912 mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_photo")); |
907 extension->addAction(hbTrId("txt_mail_list_other"), extension, SLOT(close())); |
913 mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_music")); |
908 connect(actionOther, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchOther())); |
914 mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_video")); |
|
915 mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_other")); |
|
916 mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_new_photo")); |
|
917 mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_new_video")); |
|
918 HbListViewItem *listView = mTBExtnContentWidget->listItemPrototype(); |
|
919 HbFrameBackground frame(NmPopupListFrame, HbFrameDrawer::NinePieces); |
|
920 listView->setDefaultFrame(frame); |
909 |
921 |
910 HbAction* actionCameraStill = |
922 connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)), |
911 extension->addAction(hbTrId("txt_mail_list_new_photo"), extension, SLOT(close())); |
923 mAttachmentPicker, SLOT (selectFetcher(HbListWidgetItem*))); |
912 connect(actionCameraStill, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchCameraStill())); |
|
913 |
924 |
914 HbAction* actionCameraVideo = |
925 connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)), |
915 extension->addAction(hbTrId("txt_mail_list_new_video"), extension, SLOT(close())); |
926 extension, SLOT(close())); |
916 connect(actionCameraVideo, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchCameraVideo())); |
|
917 |
927 |
918 list[i]->setToolBarExtension(extension); |
928 extension->setContentWidget(mTBExtnContentWidget); |
919 } |
929 } |
920 } |
930 } |
921 } |
931 } |
922 } |
932 } |
923 } |
933 } |
950 mStartParam->messageId()); |
960 mStartParam->messageId()); |
951 NmUiExtensionManager &extMngr = mApplication.extManager(); |
961 NmUiExtensionManager &extMngr = mApplication.extManager(); |
952 QList<NmAction*> list; |
962 QList<NmAction*> list; |
953 extMngr.getActions(request, list); |
963 extMngr.getActions(request, list); |
954 for (int i = 0; i < list.count(); i++) { |
964 for (int i = 0; i < list.count(); i++) { |
955 mPrioritySubMenu->addAction(list[i]); |
965 // check what priority has already been selected and hide it from options menu |
|
966 if (!list[i]->objectName().contains(mHiddenPriorityName)) { |
|
967 mPrioritySubMenu->addAction(list[i]); |
|
968 } |
956 } |
969 } |
957 mPrioritySubMenu->setObjectName("editorPrioritySubMenu"); |
970 mPrioritySubMenu->setObjectName("editorPrioritySubMenu"); |
958 mPrioritySubMenu->setTitle(hbTrId("txt_mail_opt_add_priority")); |
971 mPrioritySubMenu->setTitle(hbTrId("txt_mail_opt_add_priority")); |
959 menu()->addMenu(mPrioritySubMenu); |
972 menu()->addMenu(mPrioritySubMenu); |
960 } |
973 } |
1363 |
1376 |
1364 mHeaderWidget->setPriority(priority); |
1377 mHeaderWidget->setPriority(priority); |
1365 |
1378 |
1366 if (mMessage) { |
1379 if (mMessage) { |
1367 NmMessagePriority messagePriority = NmMessagePriorityNormal; |
1380 NmMessagePriority messagePriority = NmMessagePriorityNormal; |
|
1381 mHiddenPriorityName = NmPriorityNormal; |
1368 |
1382 |
1369 if (priority == NmActionResponseCommandPriorityHigh) { |
1383 if (priority == NmActionResponseCommandPriorityHigh) { |
1370 messagePriority = NmMessagePriorityHigh; |
1384 messagePriority = NmMessagePriorityHigh; |
|
1385 mHiddenPriorityName = NmPriorityHigh; |
1371 } |
1386 } |
1372 else if (priority == NmActionResponseCommandPriorityLow) { |
1387 else if (priority == NmActionResponseCommandPriorityLow) { |
1373 messagePriority = NmMessagePriorityLow; |
1388 messagePriority = NmMessagePriorityLow; |
|
1389 mHiddenPriorityName = NmPriorityLow; |
1374 } |
1390 } |
1375 mMessage->envelope().setPriority(messagePriority); |
1391 mMessage->envelope().setPriority(messagePriority); |
1376 } |
1392 } |
1377 } |
1393 } |
1378 |
1394 |