messagingapp/msgui/appengine/inc/conversationchangehandler.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     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:  ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CONVERSATIONS_CHANGEHANDLER_H
       
    19 #define CONVERSATIONS_CHANGEHANDLER_H
       
    20 
       
    21 //SYSTEM INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <e32std.h>  
       
    24 #include <badesca.h>
       
    25 #include <mcsconversationchangeobserver.h>
       
    26 
       
    27 // USER INCLUDE
       
    28 
       
    29 //FORWARD DECLARATIONS
       
    30 class ConversationsModel;
       
    31 class ConversationsEnginePrivate;
       
    32 
       
    33 /**
       
    34  *  Handles the change events (add/modify/delete) related to conversations 
       
    35  *  form the server
       
    36  *
       
    37  *  @code
       
    38  *  @endcode
       
    39  *
       
    40  *  @since S60 v10.1
       
    41  */
       
    42 class ConversationsChangeHandler : public CActive,
       
    43         public MCsConversationChangeObserver
       
    44 {
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Default constructor.
       
    49      */
       
    50     explicit ConversationsChangeHandler(
       
    51         ConversationsEnginePrivate* convEnginePrivate,
       
    52         ConversationsModel* conversationsModel);
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~ConversationsChangeHandler();
       
    58 
       
    59     /**
       
    60      * Starts fetching remaining conversations
       
    61      */
       
    62     void restartHandleConversations();
       
    63 
       
    64 public:// CActive
       
    65 
       
    66     /**
       
    67      * RunL.
       
    68      */
       
    69     void RunL();
       
    70 
       
    71     /**
       
    72      * DoCancel
       
    73      */
       
    74     void DoCancel();
       
    75 
       
    76 public:
       
    77 
       
    78     /**
       
    79      * Conversations
       
    80      * This is for handling GetConversation results asynchronusly
       
    81      * from the server.
       
    82      * 
       
    83      * @param aConversationEntryList List of conversation entries
       
    84      * returned by server.
       
    85      * @param aTotalCount total number of conversation entries
       
    86      */
       
    87 
       
    88     void ConversationsL(
       
    89         RPointerArray<CCsConversationEntry>& aConversationEntryList,
       
    90         TInt& aTotalCount);
       
    91     
       
    92     /**
       
    93      * ResetValuesForNewConversation
       
    94      * Resets the values of flags, and indexes for a new conversation
       
    95      */
       
    96     void ResetValuesForNewConversation();
       
    97 
       
    98 public://MCsConversationChangeObserver
       
    99     /**  
       
   100      * AddConversation
       
   101      * This is for handling addition of new conversation entry in
       
   102      * conversation view asynchronusly from the server.
       
   103      * 
       
   104      * @param aConversationEntry  Conversation Entry
       
   105      */
       
   106     void AddConversation(const CCsConversationEntry& aConversationEntry);
       
   107 
       
   108     /**  
       
   109      * ModifyConversation
       
   110      * This is for handling modification of existing
       
   111      * conversation entry in conversation view 
       
   112      * asynchronusly from the server.
       
   113      * 
       
   114      * @param aConversationEntry  Conversation Entry
       
   115      */
       
   116     void ModifyConversation(const CCsConversationEntry& aConversationEntry);
       
   117 
       
   118     /**  
       
   119      * DeleteConversation
       
   120      * This is for handling deletion of existing
       
   121      * conversation entry from conversation view 
       
   122      * asynchronusly from the server.
       
   123      * 
       
   124      * @param aConversationEntry  Conversation Entry
       
   125      */
       
   126     void DeleteConversation(const CCsConversationEntry& aConversationEntry);
       
   127 
       
   128     /**
       
   129      * RefreshConversation
       
   130      * This is for handling refresh asynchronusly from the server.
       
   131      */
       
   132     void RefreshConversation();
       
   133 
       
   134 private:
       
   135 
       
   136     /**
       
   137      * Make the active object alive
       
   138      */
       
   139     void IssueRequest();
       
   140 
       
   141     /**
       
   142      * Handles Conversations received from server and updates into model
       
   143      */    
       
   144     void HandleConversationsL();
       
   145     
       
   146     /**
       
   147      * Fetch remaning conversations from Server Cache
       
   148      * @param aCount - count of conversations added to entry list
       
   149      */
       
   150     void FetchRemainingConversations(TInt aCount);
       
   151     
       
   152 private:
       
   153     // Data
       
   154 
       
   155     /**
       
   156      * ConversationsChangeHandler Internal States
       
   157      */
       
   158     enum ConvChangeHandlerStates
       
   159     {
       
   160         EInit = 500, 
       
   161         EInitialCache, 
       
   162         EFetchMoreConversations,
       
   163         EListenToEvents
       
   164     };
       
   165 
       
   166     /**
       
   167      * mCurrentState
       
   168      * Holds Current state
       
   169      */
       
   170     ConvChangeHandlerStates mCurrentState;
       
   171 
       
   172     /**
       
   173      * First list of conversations updated
       
   174      * Own.
       
   175      */    
       
   176     TBool mFirstWindowCached;
       
   177 
       
   178     /**
       
   179      * Current entry being processed
       
   180      * Own.
       
   181      */
       
   182     TInt mCurrentIndex;
       
   183     
       
   184     /**
       
   185      * Total count of conversation entries in the Conversation
       
   186      * Own
       
   187      */
       
   188     TInt mTotalCount;
       
   189     /**
       
   190      * ConversationsModel Object
       
   191      * Not Own.
       
   192      */
       
   193     ConversationsModel* mConversationsModel;
       
   194 
       
   195     /**
       
   196      * ConversationsEnginePrivate object
       
   197      * Not Own.
       
   198      */
       
   199     ConversationsEnginePrivate* mConvEnginePrivate;
       
   200 
       
   201     /**
       
   202      * List of CCsConversationEntry entries
       
   203      * Own.
       
   204      */
       
   205     RPointerArray<CCsConversationEntry> mConversationEntryList;
       
   206 };
       
   207 
       
   208 #endif // CONVERSATIONS_CHANGEHANDLER_H