messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
child 70 a15d9966050f
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp	Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp	Wed Aug 18 09:45:25 2010 +0300
@@ -35,6 +35,7 @@
 #include <HbListViewItem>
 #include <HbListWidgetItem>
 #include <HbNotificationDialog>
+#include <HbDeviceNotificationDialog>
 #include <HbMessageBox>
 #include <HbAbstractVkbHost>
 #include <HbMainWindow>
@@ -87,9 +88,9 @@
 #define LOC_BCC hbTrId("txt_messaging_formlabel_bcc")
 
 //attach options
-#define LOC_PHOTO           hbTrId("txt_messaging_button_photo")
-#define LOC_SOUND           hbTrId("txt_messaging_button_sound")
-#define LOC_BUSINESS_CARD   hbTrId("txt_messaging_button_business_card")
+#define LOC_PHOTO           hbTrId("txt_messaging_opt_attach_sub_photo")
+#define LOC_SOUND           hbTrId("txt_messaging_opt_attach_sub_sound")
+#define LOC_BUSINESS_CARD   hbTrId("txt_messaging_opt_sub_business_card")
 
 //options menu.
 #define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
@@ -103,7 +104,7 @@
 #define LOC_LOW hbTrId("txt_messaging_opt_attach_sub_low")
 
 //group box
-#define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_group_title_ln_other_recipients",n)
+#define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_title_ln_other_recipients",n)
 #define LOC_OTHER_RECIPIENTS_EXPAND hbTrId("txt_messaging_title_other_recipients")
 
 //saved to draft note
@@ -302,13 +303,14 @@
     mCanSaveToDrafts = false;  
 }
 
-void MsgUnifiedEditorView::forwardMessage(ConvergedMessageId& messageId,
-    ConvergedMessage::MessageType messageType )
+void MsgUnifiedEditorView::fetchMessageFromStore(
+        ConvergedMessageId& messageId,
+        ConvergedMessage::MessageType messageType,
+        int editorOperation)
 {
     if(!mPluginLoader)
     {
         mPluginLoader = new UniEditorPluginLoader(this);
-  
     }
     UniEditorPluginInterface* pluginInterface = NULL;
     if( messageType == ConvergedMessage::Mms )
@@ -325,8 +327,7 @@
     //Fetch the converged message from the msgId
     ConvergedMessage* msg;
     msg = pluginInterface->convertFrom(messageId.getId(),
-        UniEditorPluginInterface::Forward);
-
+                    (UniEditorPluginInterface::EditorOperation)editorOperation);
     if( msg != NULL )
     {
         //Populate the content inside editor
@@ -367,7 +368,23 @@
         break;
         case MsgBaseView::FORWARD_MSG:
         {
-            forwardMessage(*messageDetails->id(), messageDetails->messageType());
+            fetchMessageFromStore(*messageDetails->id(),
+                                   messageDetails->messageType(),
+                                   UniEditorPluginInterface::Forward);
+        }
+        break;
+        case MsgBaseView::REPLY_MSG:
+        {
+            fetchMessageFromStore(*messageDetails->id(),
+                                   messageDetails->messageType(),
+                                   UniEditorPluginInterface::Reply);
+        }
+        break;
+        case MsgBaseView::REPLY_ALL_MSG:
+        {
+            fetchMessageFromStore(*messageDetails->id(),
+                                   messageDetails->messageType(),
+                                   UniEditorPluginInterface::ReplyAll);
         }
         break;
         default:
@@ -418,7 +435,10 @@
             QString mimeType;
             TMsgMediaType mediaType = EMsgMediaUnknown;
             QString filePath = messageDetails->attachments().at(i)->filePath();
-            UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+            
+           
+            UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
+            
             TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize,
                                            mimeType,mediaType));
             delete genUtils;
@@ -496,8 +516,8 @@
     ConvergedMessageAttachmentList attachmentList =
         messageDetails.attachments();
     int attachmentCount = attachmentList.count();
-
-    UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+     
+    UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
 
     QStringList pendingAttList;
     for( int i=0; i < attachmentCount; i++ )
@@ -554,8 +574,8 @@
     
     //tool bar extension for attach action.
     HbToolBarExtension* attachExtension = new HbToolBarExtension();
-    HbAction *attachAction = toolBar->addExtension(attachExtension);    
-    attachAction->setIcon(HbIcon(ATTACH_ICON));
+    mAttachAction = toolBar->addExtension(attachExtension);    
+    mAttachAction->setIcon(HbIcon(ATTACH_ICON));
     
     mTBExtnContentWidget = new HbListWidget();
     mTBExtnContentWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
@@ -652,8 +672,8 @@
     ccBccLayout->addItem(mCcField);
     ccBccLayout->addItem(mBccField);
 
-    HbGroupBox* groupBox = new HbGroupBox(0);    
-    groupBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
+    HbGroupBox* groupBox = new HbGroupBox(0);  
+    groupBox->setObjectName("groupBox");
     
     groupBox->setContentWidget(groupWidget);
     groupBox->setHeading(LOC_OTHER_RECIPIENTS_EXPAND);
@@ -1166,7 +1186,7 @@
     
     if(res)
         {
-        HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
+        HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS);
         }
     return msgId;
 }
@@ -1508,6 +1528,29 @@
 }
 
 //---------------------------------------------------------------
+// MsgUnifiedEditorView::vkbAboutToOpen
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::vkbAboutToOpen()
+{    
+	  //This is done to avoid user action on attachment
+	  //toolbar button when vkb is opening
+    mAttachAction->setDisabled(true);
+    disconnect(mVkbHost,SIGNAL(aboutToOpen()),
+            this,SLOT(vkbAboutToOpen()));
+}
+      
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::vkbAboutToClose
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::vkbAboutToClose()
+{      
+    mAttachAction->setDisabled(false);
+    connect(mVkbHost,SIGNAL(aboutToOpen()),
+            this,SLOT(vkbAboutToOpen()));
+}
+//---------------------------------------------------------------
 // MsgUnifiedEditorView::hideChrome
 //
 //---------------------------------------------------------------
@@ -1538,6 +1581,8 @@
     mVkbHost = new HbAbstractVkbHost(this);
     connect(mVkbHost, SIGNAL(keypadOpened()), this, SLOT(vkbOpened()));
     connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(vkbClosed()));
+    connect(mVkbHost,SIGNAL(aboutToOpen()),this,SLOT(vkbAboutToOpen()));
+    connect(mVkbHost,SIGNAL(aboutToClose()),this,SLOT(vkbAboutToClose()));
     
     disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));