messagingapp/msgui/appengine/inc/conversationsengine_p.h
changeset 31 ebfee66fde93
child 44 36f374c67aa8
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 /*
       
     2 * Copyright (c) 2008 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CONVERSATIONS_ENGINE_PRIVATE_H
       
    20 #define CONVERSATIONS_ENGINE_PRIVATE_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <ccsrequesthandler.h>
       
    24 #include <mcsresultsobserver.h>
       
    25 #include <msvstd.h>
       
    26 // USER INCLUDES
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCsClientConversation;
       
    30 class ConversationsSummaryModel;
       
    31 class ConversationsModel;
       
    32 class ConversationMsgStoreHandler;
       
    33 class ConversationsChangeHandler;
       
    34 class ConversationsListChangeHandler;
       
    35 
       
    36 /**
       
    37  *  This Class reads the initial conversation list and conversations.
       
    38  *
       
    39  *  @code
       
    40  *
       
    41  *  @endcode
       
    42  *  @since S60 v10.1
       
    43  */
       
    44 class ConversationsEnginePrivate :public MCsResultsObserver
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Default constructor.
       
    51      */
       
    52     explicit ConversationsEnginePrivate(
       
    53         ConversationMsgStoreHandler* conversationMsgStoreHandler,
       
    54         ConversationsSummaryModel* conversationsSummaryModel,
       
    55         ConversationsModel* conversationsModel
       
    56         );
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     virtual ~ConversationsEnginePrivate();
       
    62     
       
    63     /**
       
    64      * Adds ConversationListChange Observer
       
    65      */    
       
    66     void registerForConversationListUpdatesL();
       
    67     
       
    68     /**
       
    69      * getConversationsL
       
    70      * Initiates a call to conversation server to get all the
       
    71      * conversations for a conversation entry.
       
    72      * 
       
    73      * @param aConversationId
       
    74      */
       
    75     void getConversationsL( TInt aConversationId);
       
    76     
       
    77     /**
       
    78      * Delete all conversations.
       
    79      * @param conversationId, conversationId
       
    80      */
       
    81     void deleteConversationL(TInt aConversationId);
       
    82     
       
    83     /**
       
    84      * Delete all messages.
       
    85      * @param msgIdList, message list.
       
    86      */ 
       
    87     void deleteMessages(RArray<TInt>& aIdArray);
       
    88 
       
    89     /**
       
    90      * Delete all draft messages.
       
    91      */
       
    92     void deleteAllDraftMessagesL();
       
    93 
       
    94     /**
       
    95      * Marks the unread conversations as read
       
    96      * @param conversationId, conversationId
       
    97      */
       
    98     void markConversationReadL(TInt aConversationId);
       
    99     
       
   100     /**
       
   101      * Mark messages as read.
       
   102      * @param msgIdList, message list.
       
   103      */
       
   104     void markMessagesReadL(RArray<TInt>& aIdArray);
       
   105     
       
   106     /**
       
   107      * Get current conversation id.
       
   108      */  
       
   109     TInt getConversationCurrentId();
       
   110     
       
   111     /**
       
   112      * Clear all conversations
       
   113      */
       
   114     void clearConversationsL();
       
   115     
       
   116     /**
       
   117      *  Adds ConversationChange Observer
       
   118      */
       
   119     void registerForConversationUpdatesL();
       
   120     
       
   121     /**
       
   122      *  Fetch ConversationId from contactId
       
   123      *  @param contactId , contactId
       
   124      *  @return conversationId
       
   125      */
       
   126     TInt getConversationIdFromContactIdL(TInt contactId);    
       
   127     
       
   128     /**
       
   129      *  Fetch ConversationId from contact address
       
   130      *  @param contactAddress , contact Address
       
   131      *  @return conversationId
       
   132      */
       
   133     TInt getConversationIdFromAddressL(TDesC& contactAddress);
       
   134 
       
   135     /**
       
   136      *  Starts fetching remaing conversations
       
   137      */
       
   138     void fetchMoreConversations();
       
   139 
       
   140     
       
   141     /**
       
   142      *  Resend a failed message
       
   143 	 * @param messageId TMsvId The msv id of the entry to resend
       
   144 	 * @return bool true if success
       
   145      */
       
   146     bool resendMessage(TMsvId messageId);
       
   147     
       
   148     /**
       
   149      * Download a specified message
       
   150      * @param aId TMsvId of the message 
       
   151      * @return KErrNone if Download request is successful, 
       
   152      *         KErrNotFound if settings are not available,
       
   153      *         KErrGeneral for other cases
       
   154      */
       
   155     TInt downloadMessage(TMsvId messageId);
       
   156     
       
   157     /**
       
   158      * Query if the download operation be performed for
       
   159      * a message notification entry
       
   160      * @param aId, message notification id
       
   161      * @return true if download operation is possible
       
   162      */
       
   163     bool downloadOperationSupported(TMsvId messageId);
       
   164     
       
   165 public: // From MCsResultsObserver
       
   166 
       
   167     /**
       
   168      * ConversationList
       
   169      * This is for handling GetEntryList results asynchronusly
       
   170      * from the server.
       
   171      * 
       
   172      * @param aClientConversationList List of client conversations
       
   173      * returned by server.
       
   174      */
       
   175     void ConversationList(
       
   176             RPointerArray<CCsClientConversation>& aClientConversationList);
       
   177     /**
       
   178      * Conversations
       
   179      * This is for handling GetConversation results asynchronusly
       
   180      * from the server.
       
   181      * 
       
   182      * @param aConversationEntryList List of conversation entries
       
   183      * returned by server.
       
   184      */
       
   185 
       
   186     void Conversations(
       
   187             RPointerArray<CCsConversationEntry>& aConversationEntryList);
       
   188          
       
   189 private:
       
   190 
       
   191     /**
       
   192      * Initializes the ConversationReader class.
       
   193      */
       
   194     void initL();
       
   195     
       
   196 
       
   197 private: // data
       
   198 
       
   199     /**
       
   200      * mServer
       
   201      * Ptr to conversation server.
       
   202      */
       
   203     CCSRequestHandler* mServer;
       
   204     
       
   205     /**
       
   206      * mClientConv
       
   207      * Current Client Conversation selected.
       
   208      * Own.
       
   209      */
       
   210     CCsClientConversation* mClientConv;
       
   211 
       
   212     /**
       
   213      * MsgStore Handler
       
   214      * Not Owned
       
   215      */        
       
   216     ConversationMsgStoreHandler* mConversationMsgStoreHandler;
       
   217 
       
   218     /**
       
   219      * Conversations Summary Model
       
   220      * Not Owned
       
   221      */        
       
   222     ConversationsSummaryModel *mConversationsSummaryModel;
       
   223 
       
   224     /**
       
   225      * Conversations Model
       
   226      * Not Owned
       
   227      */    
       
   228     ConversationsModel *mConversationsModel;    
       
   229 
       
   230     /**
       
   231      * Conversations Change Handler
       
   232      * Owned
       
   233      */
       
   234     ConversationsChangeHandler *mConvChangeHandler;
       
   235 
       
   236     /**
       
   237      * Conversations List Change Handler
       
   238      * Owned
       
   239      */
       
   240     ConversationsListChangeHandler *mConvListChangeHandler;
       
   241 
       
   242     };
       
   243 
       
   244 #endif // CONVERSATIONS_ENGINE_PRIVATE_H
       
   245 
       
   246 //EOF
       
   247