messagingapp/msgui/conversationview/inc/msgconversationview.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
    18 #ifndef MSG_CONVERSATION_VIEW_H
    18 #ifndef MSG_CONVERSATION_VIEW_H
    19 #define MSG_CONVERSATION_VIEW_H
    19 #define MSG_CONVERSATION_VIEW_H
    20 
    20 
    21 // INCLUDES
    21 // INCLUDES
    22 #include "msgbaseview.h"
    22 #include "msgbaseview.h"
       
    23 #include "convergedmessage.h"
    23 
    24 
    24 //Forward declarations
    25 //Forward declarations
    25 class HbListView;
    26 class HbListView;
    26 class HbAbstractViewItem;
    27 class HbAbstractViewItem;
    27 class MsgUiUtilsManager;
    28 class MsgSendUtil;
    28 class ConvergedMessage;
       
    29 class QStandardItemModel;
    29 class QStandardItemModel;
    30 class MsgEditorWidget;
    30 class MsgEditorWidget;
    31 class MsgContactCardWidget;
    31 class MsgContactCardWidget;
       
    32 class MsgConversationViewItem;
       
    33 class HbStaticVkbHost;
       
    34 class QGraphicsLinearLayout;
       
    35 
       
    36 //Defines
       
    37 #define INVALID_MSG_ID -1
    32 
    38 
    33 /**
    39 /**
    34  * This class provides the message chat view for the messaging application.
    40  * This class provides the message chat view for the messaging application.
    35  * Data source for this view is the conversation model.
    41  * Data source for this view is the conversation model.
    36  */
    42  */
    49     /**
    55     /**
    50      * Destructor
    56      * Destructor
    51      */
    57      */
    52     ~MsgConversationView();
    58     ~MsgConversationView();
    53 
    59 
    54     /**
       
    55      * Set message data
       
    56      * @param message converged message
       
    57      */
       
    58     void setMessageData(const ConvergedMessage &message);
       
    59 
    60 
    60     /**
    61     /**
    61      * Clear editors
    62      * Clear editors
    62      * clear message and address editors
    63      * clear message and address editors
    63      */
    64      */
    67      * Save the content inside editor to drafts
    68      * Save the content inside editor to drafts
    68      * @return true if save is success else false.
    69      * @return true if save is success else false.
    69      */
    70      */
    70     bool saveContentToDrafts();
    71     bool saveContentToDrafts();
    71 
    72 
    72 public:
    73 private slots:
       
    74 
       
    75     /**
       
    76      * Slot is called when menu is about to be shown.
       
    77      * Populates the menu with relevant actions.
       
    78      */
       
    79     void menuAboutToShow();
       
    80 
       
    81 private:
    73 
    82 
    74     /**
    83     /**
    75      * View initialization function.
    84      * View initialization function.
    76      */
    85      */
    77     void setupView();
    86     void setupView();
    78 
    87 
    79     /**
    88     /**
    80      * Creates view menu items.
    89      * Setup view menu items.
    81      */
    90      */
    82     void addMenu();
    91     void setupMenu();
    83 
       
    84 public slots:
       
    85 
       
    86     /**
       
    87      * Slot to receive error sign.
       
    88      * @param error The error as a string to be displayed on the screen.
       
    89      */
       
    90 
       
    91     void serviceError(const QString& error);
       
    92    
       
    93 private:
       
    94     /**
       
    95      * Load command plugin
       
    96      * @return true if plugin is loaded successfully else false
       
    97      */
       
    98     bool loadCommandPlugin();
       
    99 
       
   100     /**
       
   101      * This function shall parse the service Id and check for
       
   102      * type of client
       
   103      * @param serviceId string reference to service id
       
   104      * @return String type the server name
       
   105      */
       
   106     QString parseServiceId(const QString &serviceId);
       
   107 
       
   108     /**
       
   109      * Returns the current message type selected in editor.
       
   110      * @return returns message type
       
   111      * @see ConvergedMessage::MessageType
       
   112      */
       
   113     int currentMessageType();
       
   114 
    92 
   115     /**
    93     /**
   116      * Populates ConvergedMessage for sending.
    94      * Populates ConvergedMessage for sending.
   117      * @param ConvergedMessage to be populated
    95      * @param ConvergedMessage to be populated
   118      * @see ConvergedMessage::MessageType
    96      * @see ConvergedMessage::MessageType
   119      */
    97      */
   120     void populateForSending(ConvergedMessage &message);
    98     void populateForSending(ConvergedMessage &message);
       
    99     
       
   100     /**
       
   101      * Adds context menu entries to context menu
       
   102      * @param HbMenu context menu
       
   103      * @param int sendingstate.
       
   104      * @see ConvergedMessage::MessageType
       
   105      */
       
   106     void setContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
       
   107 	
       
   108     /**
       
   109      * Adds context menu entry to context menu for Opening items
       
   110 	 * @param MsgConversationViewItem* item whose information is needed.
       
   111      * @param HbMenu context menu
       
   112      * @param int sendingstate.
       
   113      * @see ConvergedMessage::MessageType
       
   114      */
       
   115     void addOpenItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
       
   116 
       
   117     /**
       
   118      * Adds context menu entry to context menu for Resending items
       
   119      * @param MsgConversationViewItem* item whose information is needed.
       
   120      * @param HbMenu context menu
       
   121      * @param int sendingstate.
       
   122      * @see ConvergedMessage::MessageType
       
   123      */  
       
   124     void addResendItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
       
   125 
       
   126     /**
       
   127      * Adds context menu entry to context menu for Forwarding items
       
   128 	 * @param MsgConversationViewItem* item whose information is needed.
       
   129      * @param HbMenu context menu
       
   130      * @param int sendingstate.
       
   131      * @see ConvergedMessage::MessageType
       
   132      */
       
   133     void addForwardItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
       
   134 
       
   135     /**
       
   136      * Adds context menu entry to context menu for Deleting items
       
   137 	 * @param MsgConversationViewItem* item whose information is needed.
       
   138      * @param HbMenu context menu
       
   139      * @param int sendingstate.
       
   140      * @see ConvergedMessage::MessageType
       
   141      */
       
   142     void addDeleteItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
       
   143 
       
   144     /**
       
   145      * Adds context menu entry to context menu for Downloading items
       
   146      * @param MsgConversationViewItem* item whose information is needed.
       
   147      * @param HbMenu context menu    
       
   148      * @see ConvergedMessage::MessageType
       
   149      */
       
   150     void addDownloadItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu);
       
   151     
       
   152     /**
       
   153      * Validates if message can be forwarded
       
   154      * @param messageType
       
   155      * @param messageId
       
   156      * @return true if message can be forwarded
       
   157      *         false if message cant be forwarded
       
   158      */
       
   159     bool validateMsgForForward(int &messageType,qint32 &messageId);
       
   160 
       
   161     /**
       
   162      * Launches the BT message display service.
       
   163      * @param index Index of the item activated/touched
       
   164      */
       
   165     void launchBtDisplayService(const QModelIndex & index);
   121 
   166 
   122 public slots:
   167 public slots:
   123     /**
   168     /**
   124      * Refreshes all widgets in the conversation view according to latest model
   169      * Refreshes all widgets in the conversation view according to latest model
   125      * data
   170      * data
   126      */
   171      */
   127     void refreshView();
   172     void refreshView();
   128 
       
   129     /**
       
   130      * Effect finish handler
       
   131      * data
       
   132      */
       
   133     void effectFinished(const HbEffect::EffectStatus &status);
       
   134     
   173     
   135 private slots:
   174 private slots:
   136 
   175 
   137     /**
   176     /**
   138      * Utility method to scroll the list to show the bottom most item
   177      * Utility method to scroll the list to show the bottom most item
   157      */
   196      */
   158     void send();
   197     void send();
   159 
   198 
   160     // ----------------------------- View Specific Menu Slots--------------------//
   199     // ----------------------------- View Specific Menu Slots--------------------//
   161 
   200 
   162     /**
   201    
   163      * Deletes all the conversations
   202     /**
   164      */
   203      * Fetch images 
   165     void deleteAll();
   204      */
       
   205     void fetchImages();
       
   206 
       
   207     /**
       
   208      * Fectch conatcts
       
   209      */
       
   210     void fetchContacts();
       
   211 
       
   212     /**
       
   213      * Fectch audio
       
   214      */
       
   215     void fetchAudio();
   166 
   216 
   167     /*
   217     /*
   168      * Get the photos and launch editor
   218      * Get the photos and launch editor
   169      */
   219      */
   170     void imagesFetched(const QVariant& result );
   220     void imagesFetched(const QVariant& result );
       
   221     
       
   222     /**
       
   223      * slot to receive fetched contacts for addition
       
   224      */
       
   225     void contactsFetched(const QVariant& value);
   171 
   226 
   172     /*
   227     /*
   173      * Get audio files from audio-fetcher and launch editor
   228      * Get audio files from audio-fetcher and launch editor
   174      */
   229      */
   175     void audiosFetched(const QVariant& result );
   230     void audiosFetched(const QVariant& result );
   176 
   231     
   177     /*
   232     /**
   178      * Adds other recipients to editor
   233      * slot to receive fetched contacts for vcard addition
   179      */
   234      */
   180     void addRecipients();
   235     void contactsFetchedForVCards(const QVariant& value);
   181 
   236     
   182     /*
   237     /*
   183      * Adds subject file to editor.
   238      * Adds subject file to editor.
   184      */
   239      */
   185     void addSubject();
   240     void addSubject();
   186 
   241 
   187     /**
       
   188      * Launches help
       
   189      */
       
   190     void launchHelp();
       
   191 
       
   192     /**
       
   193      * Exits the application
       
   194      */
       
   195     void exitApp();
       
   196 
   242 
   197     //----------------------Item Specific menu slots ---------------------//
   243     //----------------------Item Specific menu slots ---------------------//
   198 
   244 
   199     /**
   245     /**
   200      * Forwards the message
   246      * Forwards the message
   203 
   249 
   204     /**
   250     /**
   205      * Deletes the item
   251      * Deletes the item
   206      */
   252      */
   207     void deleteItem();
   253     void deleteItem();
       
   254     
       
   255     /**
       
   256      * Resends the item. This is only valid in the failed message case.
       
   257      */
       
   258     void resendMessage();
       
   259 
       
   260     /**
       
   261      * Download the specified message
       
   262      */
       
   263     void downloadMessage();
   208 
   264 
   209     /**
   265     /**
   210      * Open the item
   266      * Open the item
   211      */
   267      */
   212     void openItem();
   268     void openItem();
   217     void populateConversationsView();
   273     void populateConversationsView();
   218 
   274 
   219     /**
   275     /**
   220      * Save ringing tone
   276      * Save ringing tone
   221      */
   277      */
   222     void saveRingingTone();
   278     void saveRingingTone();   
       
   279     
       
   280     /**
       
   281      * Launch Editor since sms character limit reached
       
   282      */
       
   283     void handleSmsCharLimitReached();   
   223     
   284     
   224 signals:
   285 signals:
   225     /**
   286     /**
   226      * Signal emitted to inform close the conversation view.
   287      * Signal emitted to inform close the conversation view.
   227      * When Conversation view has opened in send mode, after sending
   288      * When Conversation view has opened in send mode, after sending
   231 
   292 
   232     /**
   293     /**
   233      * Emitted when editor is tapped to reply.
   294      * Emitted when editor is tapped to reply.
   234      */
   295      */
   235     void replyStarted();
   296     void replyStarted();
   236 
   297     
       
   298 	/**
       
   299 	* This signal is emitted when vkb is open.
       
   300 	*/
       
   301     void hideChrome(bool);
       
   302 
       
   303 private slots:
       
   304     /**
       
   305      * Resizes the view when VKB is opened.
       
   306      * This slot is triggered when user taps on the CV editor
       
   307      */
       
   308     void vkbOpened();
       
   309 
       
   310     /**
       
   311      * Resizes the view when VKB is closed.
       
   312      * This slot is triggered when VKB focus is lost.
       
   313      */
       
   314     void vkbClosed();
       
   315     
   237 private:
   316 private:
   238     /**
   317     /**
   239      * launch editor when attachment is inserted
   318      * launch editor when attachment is inserted
   240      * @params eflag Editor content to be shown
   319      * @params data used for launching editor with pre-populated content
   241      * @params attachment file attachment for editor
   320      */
   242      */
   321     void launchUniEditor(const QVariantList& data);
   243     void launchUniEditor(const int editorFields, QString& attachment);
   322     
       
   323     /**
       
   324      * Signal emitted when an error is generated.
       
   325      * @param errorCode Error code.
       
   326      * @param errorMessage Error description.
       
   327      */
       
   328     void serviceRequestError(int errorCode, const QString& errorMessage);
       
   329     
       
   330     /**
       
   331      * Activate Input Blocker
       
   332      */
       
   333     void activateInputBlocker();
       
   334 
       
   335     /**
       
   336      * Deactivate Input Blocker
       
   337      */
       
   338     void deactivateInputBlocker();
   244 
   339 
   245 private:
   340 private:
   246 
   341 
   247     /**
   342     /**
   248      * List to hold the conversations
   343      * List to hold the conversations
   263 
   358 
   264     /**
   359     /**
   265      * Instance of Contact Card widget.
   360      * Instance of Contact Card widget.
   266      */
   361      */
   267     MsgContactCardWidget* mContactCardWidget;
   362     MsgContactCardWidget* mContactCardWidget;
   268 
   363     
   269     /**
   364     /**
   270      * Utils Manager instance
   365      * Send utils instance
   271      */
   366      */
   272     MsgUiUtilsManager* mUiUtilsManager;
   367     MsgSendUtil *mSendUtil;
       
   368  
       
   369     /**
       
   370      * Instance of the main layout.
       
   371      */
       
   372     QGraphicsLinearLayout *mMainLayout;
       
   373 
       
   374 	/**
       
   375 	 * Flag to track if item has been long pressed.
       
   376 	 */
       
   377     bool mItemLongPressed;
       
   378     /*
       
   379      * Instance of VKB 
       
   380      */
       
   381     HbStaticVkbHost* mVkbHost;
       
   382     
       
   383     /**
       
   384      * Flag to check it vkb is open.
       
   385      */
       
   386     bool mVkbopened;
       
   387 
   273 };
   388 };
   274 
   389 
   275 #endif // MSG_CONVERSATION_VIEW_H
   390 #endif // MSG_CONVERSATION_VIEW_H
   276 // EOF
   391 // EOF