messagingapp/msgui/unifiededitor/inc/msgunieditorview.h
changeset 76 60a8a215b0ec
parent 62 fdbe8253b596
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h	Tue Oct 05 13:58:47 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h	Tue Oct 19 11:30:16 2010 +0530
@@ -18,7 +18,7 @@
 #ifndef MSG_UNIFIED_EDITOR_VIEW_H
 #define MSG_UNIFIED_EDITOR_VIEW_H
 
-#ifdef MSGUI_UNIT_TEST
+#ifdef UNIEDITOR_UNIT_TEST
  #define UNIFIEDEDITOR_EXPORT
 #else
  #ifdef UNIFIEDEDITOR_DLL
@@ -31,23 +31,59 @@
 #include "msgbaseview.h"
 #include "convergedmessage.h"
 #include "convergedmessageid.h"
+#include <HbStaticVkbHost>
 
-class HbWidget;
 class HbAction;
-class HbGroupBox;
 class QGraphicsLinearLayout;
-class MsgUnifiedEditorSubject;
-class MsgUnifiedEditorAddress;
-class MsgUnifiedEditorBody;
 class MsgUnifiedEditorMonitor;
-class MsgAttachmentContainer;
 class UniEditorPluginLoader;
-class HbListWidgetItem;
-class HbAbstractVkbHost;
 class MsgUnifiedEditorBaseWidget;
-class HbListWidget;
 class MsgAudioFetcherDialog;
+class MsgUnifiedEditorScrollArea;
+class MsgUnifiedEditorBodyEditor;
 
+/**
+ * options in menu.
+ */
+enum MENU_ACTIONS
+{
+    PHOTO = 0x00,
+    SOUND = 0x01,
+    VCARD = 0x02,
+    SUBJECT = 0x03,
+    CCBCC = 0x04
+};
+
+/**
+ * Custom vkb host specific to unifiededitor.
+ */
+class MsgUniEditorVkbHost: public HbStaticVkbHost
+{
+    Q_OBJECT
+    
+public:
+    MsgUniEditorVkbHost(HbWidget *target) : HbStaticVkbHost(target){}
+    
+signals:
+    /**
+     * emitted when focus changes.
+     */
+    void focusChanged();
+    
+protected:
+    /**
+     * Reimpleted from base class.
+     */
+    void refresh()
+    {
+        emit focusChanged();
+        HbStaticVkbHost::refresh();
+    }
+};
+
+/**
+ * unified editor view class.
+ */
 class UNIFIEDEDITOR_EXPORT MsgUnifiedEditorView : public MsgBaseView
     {
     Q_OBJECT
@@ -76,7 +112,6 @@
      */
     void openDraftsMessage(const QVariantList& editorData);
 
-
     /**
      * Saves the content inside editor to save
      */
@@ -89,12 +124,7 @@
      * @see MsgBaseView
      */
     bool handleKeyEvent(int key);
-
-protected:
-    /**
-     * reimplemented from base class to provide proper geometry for scrolling.
-     */
-    void resizeEvent( QGraphicsSceneResizeEvent * event );
+    
 
 private:
 
@@ -104,11 +134,6 @@
     void addMenu();
 
     /**
-     * helper method to add tool bar.
-     */
-    void addToolBar();
-
-    /**
      * Packs the content inside editor into converged message
      * @param [OUT]msg, converged message to hold editor data
      * @param isSave, flag to indicate that msg needs to be packed
@@ -122,8 +147,9 @@
      * @param messageDetails message details
      * @param draftMessage boolean for specifying draft message
      */
-    void populateContentIntoEditor(
-        const ConvergedMessage& messageDetails, bool draftMessage = false);
+    void populateContentIntoEditor(const ConvergedMessage& messageDetails, 
+                                   bool draftMessage,
+                                   bool checkForInline);
     
     /**
      * Populate the editor with the message's content
@@ -133,8 +159,8 @@
      * @param editorOperation, forward or reply or replyAll etc
      */
     void fetchMessageFromStore(ConvergedMessageId& messageId,
-        ConvergedMessage::MessageType messageType,
-        int editorOperation);
+                               ConvergedMessage::MessageType messageType,
+                               int editorOperation);
     
     /**
      * Create VCards for all the contacts available in the list
@@ -151,20 +177,6 @@
      */
     QString generateFileName(QString& suggestedName);
     
-    /**
-     * Fetch images 
-     */
-    void fetchImages();
-
-    /**
-     * Fetch contacts
-     */
-    void fetchContacts();
-
-    /**
-     * Fetch audio
-     */
-    void fetchAudio();
 
     /**
      * To hide/show chrome.
@@ -185,52 +197,18 @@
      * Removes editors temp folder.
      */
     void removeTempFolder();
-
-    /**
-     * Attachment options in TBE
-     * Row number of the TBE actions
-     */
-    enum TBE_AttachOption
-    {
-        TBE_PHOTO = 0x00, TBE_SOUND = 0x01, TBE_VCARD = 0x02
-    };
-
-    /**
-     * Enable/Disable attachment options for slide-conformance
-     * @param opt, row number of action in TBE
-     * @param isEnabled, true/false
-     */
-    void setAttachOptionEnabled(MsgUnifiedEditorView::TBE_AttachOption opt,
-            bool enable);
-
-    /**
-     * Addresses are all ok. Now parse not allowed chars away 
-	 * before giving it to MTM
-	 * @param addresses, list of ConvergedMessageAddress
-     */
-    void formatAddresses(ConvergedMessageAddressList& addresses);
     
 private slots:
 
     /**
      * slot to add subject field.
      */
-    void addSubject();
+    void addSubject(bool needFocus = false);
 
     /**
      * slot to add Cc,Bcc field.
      */
-    void addCcBcc();
-
-    /**
-     * slot to handle Cc, Bcc group-box's toggle action
-     */
-    void updateOtherRecipientCount(bool state);
-
-    /**
-     * slot to change priority.
-     */
-    void changePriority();
+    void addCcBcc(bool needFocus = false);
 
     /**
      * slot to current delete message.
@@ -253,26 +231,10 @@
     void send();
 	
     /**
-     * slot to tell view to remove the attachment's container
-     */
-    void removeAttachmentContainer();
-
-    /**
      * add attachments to the editor
      * @param files list of file paths
      */
     void addAttachments(QStringList files);
-
-    /**
-     * add an attachment to the editor
-     * @return addition operation status
-     */
-    int addAttachment(const QString& filepath);
-
-	/**
-     * called when extention item is clicked.
-     */
-    void handleViewExtnActivated(HbListWidgetItem* item);
     
     /**
      * Signal emitted when an error is generated.
@@ -314,7 +276,7 @@
     void setFocus(MsgUnifiedEditorBaseWidget* item);
     
     /**
-     * Listens to contentChanged signal of various fields.
+     * Listens to contentChanged signal for various editor fields.
      */
     void onContentChanged();
 
@@ -335,22 +297,6 @@
      * @param action selected action (yes or no).
      */
     void onDialogMmsSettings(HbAction* action);    
-	
-	/**
-     * Enable/Disable send tool button.
-     * @param true/false to enable/disable.
-     */
-     void enableSendButton(bool enable);
-     
-     /**
-      * This slot is triggered when vkb is about to be opened.
-      */
-     void vkbAboutToOpen();
-     
-     /**
-      * This slot is triggered when vkb is about to be closed.
-      */
-     void vkbAboutToClose();
      
      /** 
       * This slot is called after sound clip is 
@@ -363,38 +309,73 @@
       * @return bool, true if reply-path constraints are broken
       */
      bool isReplyPathBroken();
+     
+     /**
+      * Fetch images 
+      */
+     void fetchImages();
+
+     /**
+      * Fetch contacts
+      */
+     void fetchContacts();
+
+     /**
+      * Fetch audio
+      */
+     void fetchAudio();
+     
+     /**
+      * Enable/Disable/removes menu actions.
+      * @param opt, submenu actions.
+      * @param isEnabled, true/false
+      */
+     void enableMenuAction(int action, bool enable);
+     
+     /**
+      * Resets layout when vkb is cosed.
+      */
+     void resetLayout();     
+     
+     /**
+      * Perform layouting when vkb is opened.
+      */
+     void doLayout();
+     
+     /**
+      * Ensures visibility of editor widget in to visible area.
+      */
+     void ensureVisibility();
+     
+     /**
+      * Updates focus widget when editor gains focus.
+      */
+     void focusChanged();
+     
     
 private:
      
-    HbAction* mSubjectAction;
-    HbAction* mCcBccAction;
-    HbAction* mSendAction;
+     /**
+      * main layout of view.
+      */
     QGraphicsLinearLayout* mMainLayout;
-    MsgUnifiedEditorSubject* mSubjectField;
-    MsgUnifiedEditorAddress* mToField;
-    MsgUnifiedEditorAddress* mCcField;
-    MsgUnifiedEditorAddress* mBccField;
-    MsgUnifiedEditorBody*   mBody;
-
-    HbWidget* mContentWidget;
-
     MsgUnifiedEditorMonitor* mMsgMonitor;
-    MsgAttachmentContainer* mAttachmentContainer;
     UniEditorPluginLoader* mPluginLoader;
+    
+    /**
+     * Message id of current opened message.
+     */
     ConvergedMessageId mOpenedMessageId;
-    ConvergedMessage::MessageType mmOpenedMessageType;
+    
+    /**
+     * flag to check if message can be saved to drafts.
+     */
 	bool mCanSaveToDrafts;
-	HbAction *mAttachAction;
-    
-	/**
-	 * TBE's content widget
-	 */
-	HbListWidget* mTBExtnContentWidget;
 	
     /**
      * Instance of VKB host
      */
-	HbAbstractVkbHost* mVkbHost;
+	MsgUniEditorVkbHost* mVkbHost;
 	
 	/**
 	 * Instance of Audio Fetcher Dialog
@@ -418,8 +399,47 @@
      * Flag to tell if reply-path is available
      */
     bool mReplyPath;	
-
-	friend class MsgUnifiedEditorMonitor;
+    
+    /**
+     * Scrollable conatiner.
+     */
+    MsgUnifiedEditorScrollArea* mScrollArea;
+    
+    /**
+     * Body text editor.
+     */
+    MsgUnifiedEditorBodyEditor* mBodyEditor;
+    
+    /**
+     * Various actions.
+     */
+    HbAction* mSubjectAction;
+    HbAction* mCcBccAction;
+    HbAction* mPhotoAction;
+    HbAction* mSoundAction;
+     
+    /**
+     * Widget currently focussed.
+     */
+    QGraphicsWidget* mFocusedWidget;
+    
+    /**
+     * Min height of foucssed widget.
+     */
+    qreal mMinHeight;
+    
+    /**
+     * Max height of focussed widget.
+     */
+    qreal mMaxHeight;
+	
+#ifdef UNIEDITOR_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgUnifiedEditorView;
+#endif
+	
     };
 
 #endif //MSG_UNIFIED_EDITOR_VIEW_H