emailuis/nmailui/src/nmeditorview.cpp
changeset 56 15bc1d5d6267
parent 51 d845db10c0d4
child 57 ae34e1715e21
equal deleted inserted replaced
51:d845db10c0d4 56:15bc1d5d6267
    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 
       
    23 // extension list item frame.
       
    24 static const QString NmPopupListFrame = "qtg_fr_popup_list_normal";
    22 
    25 
    23 static const QString NmDelimiter("; ");
    26 static const QString NmDelimiter("; ");
    24 
    27 
    25 /*!
    28 /*!
    26 	\class NmEditorView
    29 	\class NmEditorView
    50       mRemoveAttachmentOperation(NULL),
    53       mRemoveAttachmentOperation(NULL),
    51       mWaitDialog(NULL),
    54       mWaitDialog(NULL),
    52       mQueryDialog(NULL),
    55       mQueryDialog(NULL),
    53       mAttachmentPicker(NULL),
    56       mAttachmentPicker(NULL),
    54       mCcBccFieldVisible(false),
    57       mCcBccFieldVisible(false),
    55       mServiceSendingDialog(NULL)
    58       mServiceSendingDialog(NULL),
       
    59       mIsNotFetchedBefore(true)
    56 {
    60 {
    57     NM_FUNCTION;
    61     NM_FUNCTION;
    58     
    62     
    59     mDocumentLoader	= new HbDocumentLoader();
    63     mDocumentLoader	= new HbDocumentLoader();
    60     // Set object name
    64     // Set object name
   391 */
   395 */
   392 void NmEditorView::fetchMessageIfNeeded(NmUiStartParam &startParam)
   396 void NmEditorView::fetchMessageIfNeeded(NmUiStartParam &startParam)
   393 {
   397 {
   394     NM_FUNCTION;
   398     NM_FUNCTION;
   395     
   399     
   396     if (startParam.editorStartMode() == NmUiEditorForward
   400     if (mIsNotFetchedBefore == true) {
   397         || startParam.editorStartMode()== NmUiEditorReply
   401         if (startParam.editorStartMode() == NmUiEditorForward
   398         || startParam.editorStartMode() == NmUiEditorReplyAll) {
   402             || startParam.editorStartMode()== NmUiEditorReply
       
   403             || startParam.editorStartMode() == NmUiEditorReplyAll) {
   399         
   404         
   400         fetchProgressDialogShow();
   405             fetchProgressDialogShow();
   401         mAttaManager.clearObserver();
   406             mAttaManager.clearObserver();
   402         mAttaManager.setObserver(this);
   407             mAttaManager.setObserver(this);
   403         mAttaManager.fetchAllMessageParts(
   408             mAttaManager.fetchAllMessageParts(
   404             startParam.mailboxId(),
   409                 startParam.mailboxId(),
   405             startParam.folderId(),
   410                 startParam.folderId(),
   406             startParam.messageId());
   411                 startParam.messageId());
   407     }
   412 			mIsNotFetchedBefore = false;
   408     else {
   413         }
   409         startMessageCreation(startParam);
   414         else {
       
   415             startMessageCreation(startParam);
       
   416         }
   410     }
   417     }
   411 }
   418 }
   412 
   419 
   413 /*!
   420 /*!
   414     Slot. Called when attachments fetch progress changes.
   421     Slot. Called when attachments fetch progress changes.
   889                 mAttachmentPicker = new NmAttachmentPicker(this);
   896                 mAttachmentPicker = new NmAttachmentPicker(this);
   890                 
   897                 
   891                 if (extension && mAttachmentPicker) {
   898                 if (extension && mAttachmentPicker) {
   892                     connect(mAttachmentPicker, SIGNAL(attachmentsFetchOk(const QVariant &)),
   899                     connect(mAttachmentPicker, SIGNAL(attachmentsFetchOk(const QVariant &)),
   893                         this, SLOT(onAttachmentReqCompleted(const QVariant &)));            
   900                         this, SLOT(onAttachmentReqCompleted(const QVariant &)));            
   894                                                 
       
   895                     HbAction* actionPhoto = 
       
   896                         extension->addAction(hbTrId("txt_mail_list_photo"), extension, SLOT(close()));
       
   897                     connect(actionPhoto, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchImage()));
       
   898                     
   901                     
   899                     HbAction* actionMusic = 
   902                     list[i]->setToolBarExtension(extension);
   900                         extension->addAction(hbTrId("txt_mail_list_music"), extension, SLOT(close()));
       
   901                     connect(actionMusic, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchAudio()));
       
   902                     
   903                     
   903                     HbAction* actionVideo = 
   904                     //content widget to get the items to a list
   904                         extension->addAction(hbTrId("txt_mail_list_video"), extension, SLOT(close()));
   905                     mTBExtnContentWidget = new HbListWidget();
   905                     connect(actionVideo, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchVideo()));
   906                     mTBExtnContentWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
   906                     
   907                     
   907                     HbAction* actionOther = 
   908                     mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_photo"));
   908                         extension->addAction(hbTrId("txt_mail_list_other"), extension, SLOT(close()));
   909                     mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_music"));
   909                     connect(actionOther, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchOther()));
   910                     mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_video"));
       
   911                     mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_other"));
       
   912                     mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_new_photo"));
       
   913                     mTBExtnContentWidget->addItem(hbTrId("txt_mail_list_new_video"));
       
   914                     HbListViewItem *listView = mTBExtnContentWidget->listItemPrototype();
       
   915                     HbFrameBackground frame(NmPopupListFrame, HbFrameDrawer::NinePieces);
       
   916                     listView->setDefaultFrame(frame);
   910                     
   917                     
   911                     HbAction* actionCameraStill = 
   918                     connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)), 
   912                        extension->addAction(hbTrId("txt_mail_list_new_photo"), extension, SLOT(close()));
   919                     		mAttachmentPicker, SLOT (selectFetcher(HbListWidgetItem*)));
   913                     connect(actionCameraStill, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchCameraStill()));
       
   914             
   920             
   915                     HbAction* actionCameraVideo = 
   921                     connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)),
   916                         extension->addAction(hbTrId("txt_mail_list_new_video"), extension, SLOT(close()));
   922                             extension, SLOT(close()));
   917                     connect(actionCameraVideo, SIGNAL(triggered()), mAttachmentPicker, SLOT(fetchCameraVideo()));
       
   918                                         
   923                                         
   919                     list[i]->setToolBarExtension(extension);
   924                     extension->setContentWidget(mTBExtnContentWidget);
   920                 }
   925                 }
   921             }            
   926             }            
   922         }        
   927         }        
   923     }
   928     }
   924 }
   929 }