messagingapp/msgui/conversationview/inc/msgconversationview.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:Message chat View for the messaging application.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_CONVERSATION_VIEW_H
       
    19 #define MSG_CONVERSATION_VIEW_H
       
    20 
       
    21 // INCLUDES
       
    22 #include "msgbaseview.h"
       
    23 
       
    24 //Forward declarations
       
    25 class HbListView;
       
    26 class HbAbstractViewItem;
       
    27 class MsgUiUtilsManager;
       
    28 class ConvergedMessage;
       
    29 class QStandardItemModel;
       
    30 class MsgEditorWidget;
       
    31 class MsgContactCardWidget;
       
    32 
       
    33 /**
       
    34  * This class provides the message chat view for the messaging application.
       
    35  * Data source for this view is the conversation model.
       
    36  */
       
    37 class MsgConversationView : public MsgBaseView
       
    38 {
       
    39 Q_OBJECT
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Constructor
       
    45      */
       
    46     MsgConversationView(MsgContactCardWidget *contactCardWidget,
       
    47         QGraphicsItem *parent = 0);
       
    48 
       
    49     /**
       
    50      * Destructor
       
    51      */
       
    52     ~MsgConversationView();
       
    53 
       
    54     /**
       
    55      * Set message data
       
    56      * @param message converged message
       
    57      */
       
    58     void setMessageData(const ConvergedMessage &message);
       
    59 
       
    60     /**
       
    61      * Clear editors
       
    62      * clear message and address editors
       
    63      */
       
    64     void clearEditors();
       
    65 
       
    66     /**
       
    67      * Save the content inside editor to drafts
       
    68      * @return true if save is success else false.
       
    69      */
       
    70     bool saveContentToDrafts();
       
    71 
       
    72 public:
       
    73 
       
    74     /**
       
    75      * View initialization function.
       
    76      */
       
    77     void setupView();
       
    78 
       
    79     /**
       
    80      * Creates view menu items.
       
    81      */
       
    82     void addMenu();
       
    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 
       
   115     /**
       
   116      * Populates ConvergedMessage for sending.
       
   117      * @param ConvergedMessage to be populated
       
   118      * @see ConvergedMessage::MessageType
       
   119      */
       
   120     void populateForSending(ConvergedMessage &message);
       
   121 
       
   122 public slots:
       
   123     /**
       
   124      * Refreshes all widgets in the conversation view according to latest model
       
   125      * data
       
   126      */
       
   127     void refreshView();
       
   128 
       
   129     /**
       
   130      * Effect finish handler
       
   131      * data
       
   132      */
       
   133     void effectFinished(const HbEffect::EffectStatus &status);
       
   134     
       
   135 private slots:
       
   136 
       
   137     /**
       
   138      * Utility method to scroll the list to show the bottom most item
       
   139      */
       
   140     void scrollToBottom();
       
   141 
       
   142     /**
       
   143      * Handler for long tap of a list item.
       
   144      * @param viewItem  Long tapped view item
       
   145      * @param point X and Y co-ordinates of long tap
       
   146      */
       
   147     void longPressed(HbAbstractViewItem* viewItem, const QPointF& point);
       
   148 
       
   149     /**
       
   150      * Handler for short tap/direct touch of a list item.
       
   151      * @param index index of the item activated/touched
       
   152      */
       
   153     void openItem(const QModelIndex & index);
       
   154 
       
   155     /**
       
   156      * Sends the message
       
   157      */
       
   158     void send();
       
   159 
       
   160     // ----------------------------- View Specific Menu Slots--------------------//
       
   161 
       
   162     /**
       
   163      * Deletes all the conversations
       
   164      */
       
   165     void deleteAll();
       
   166 
       
   167     /*
       
   168      * Get the photos and launch editor
       
   169      */
       
   170     void imagesFetched(const QVariant& result );
       
   171 
       
   172     /*
       
   173      * Get audio files from audio-fetcher and launch editor
       
   174      */
       
   175     void audiosFetched(const QVariant& result );
       
   176 
       
   177     /*
       
   178      * Adds other recipients to editor
       
   179      */
       
   180     void addRecipients();
       
   181 
       
   182     /*
       
   183      * Adds subject file to editor.
       
   184      */
       
   185     void addSubject();
       
   186 
       
   187     /**
       
   188      * Launches help
       
   189      */
       
   190     void launchHelp();
       
   191 
       
   192     /**
       
   193      * Exits the application
       
   194      */
       
   195     void exitApp();
       
   196 
       
   197     //----------------------Item Specific menu slots ---------------------//
       
   198 
       
   199     /**
       
   200      * Forwards the message
       
   201      */
       
   202     void forwardMessage();
       
   203 
       
   204     /**
       
   205      * Deletes the item
       
   206      */
       
   207     void deleteItem();
       
   208 
       
   209     /**
       
   210      * Open the item
       
   211      */
       
   212     void openItem();
       
   213 
       
   214     /**
       
   215      * Set model to the view 
       
   216      */    
       
   217     void populateConversationsView();
       
   218 
       
   219     /**
       
   220      * Save ringing tone
       
   221      */
       
   222     void saveRingingTone();
       
   223     
       
   224 signals:
       
   225     /**
       
   226      * Signal emitted to inform close the conversation view.
       
   227      * When Conversation view has opened in send mode, after sending
       
   228      * the message, this signal is emitted.
       
   229      */
       
   230     void closeConversationView();
       
   231 
       
   232     /**
       
   233      * Emitted when editor is tapped to reply.
       
   234      */
       
   235     void replyStarted();
       
   236 
       
   237 private:
       
   238     /**
       
   239      * launch editor when attachment is inserted
       
   240      * @params eflag Editor content to be shown
       
   241      * @params attachment file attachment for editor
       
   242      */
       
   243     void launchUniEditor(const int editorFields, QString& attachment);
       
   244 
       
   245 private:
       
   246 
       
   247     /**
       
   248      * List to hold the conversations
       
   249      * Owned
       
   250      */
       
   251     HbListView *mConversationList;
       
   252 
       
   253     /**
       
   254      * Model to facilitate filtering and sorting
       
   255      * Owned
       
   256      */
       
   257     QStandardItemModel *mMessageModel;
       
   258 
       
   259     /**
       
   260      * Instance of messaged editor widget.
       
   261      */
       
   262     MsgEditorWidget *mEditorWidget;
       
   263 
       
   264     /**
       
   265      * Instance of Contact Card widget.
       
   266      */
       
   267     MsgContactCardWidget* mContactCardWidget;
       
   268 
       
   269     /**
       
   270      * Utils Manager instance
       
   271      */
       
   272     MsgUiUtilsManager* mUiUtilsManager;
       
   273 };
       
   274 
       
   275 #endif // MSG_CONVERSATION_VIEW_H
       
   276 // EOF