messagingapp/msgui/appengine/inc/conversationlistchangehandler.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:  This Class handles Add, Delete & Modify conversation list client events.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CONVERSATIONSLIST_CHANGEHANDLER_H
       
    19 #define CONVERSATIONSLIST_CHANGEHANDLER_H
       
    20 
       
    21 // SYSTEM INCLUDE
       
    22 #include <mcsconversationlistchangeobserver.h>
       
    23 
       
    24 // USER INCLUDE
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class ConversationsSummaryModel;
       
    28 class ConversationsEnginePrivate;
       
    29 
       
    30 /**
       
    31  *  This Class handles Add, Delete & Modify conversation list client events.
       
    32  *
       
    33  *  @code
       
    34  *  @endcode
       
    35  *
       
    36  *  @since S60 v10.1
       
    37  */
       
    38 class ConversationsListChangeHandler : public CActive,
       
    39         public MCsConversationListChangeObserver
       
    40 {
       
    41 
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Default constructor.
       
    46      */
       
    47     explicit ConversationsListChangeHandler(
       
    48         ConversationsEnginePrivate* convEnginePrivate,
       
    49         ConversationsSummaryModel* conversationsSummaryModel);
       
    50 
       
    51     /**
       
    52      * Destructor.
       
    53      */
       
    54     ~ConversationsListChangeHandler();
       
    55 
       
    56 public:
       
    57     // CActive callbacks
       
    58 
       
    59     /**
       
    60      * RunL.
       
    61      */
       
    62     void RunL();
       
    63 
       
    64     /**
       
    65      * DoCancel.
       
    66      */
       
    67     void DoCancel();
       
    68 
       
    69     /**
       
    70      * ConversationList
       
    71      * This is for handling GetEntryList results asynchronusly
       
    72      * from the server.
       
    73      * 
       
    74      * @param aClientConversationList List of client conversations
       
    75      * returned by server.
       
    76      */
       
    77     void ConversationListL(
       
    78         RPointerArray<CCsClientConversation>& aClientConversationList);
       
    79 
       
    80 public:
       
    81 
       
    82     // -------------From MCsConversationListChangeObserver-----------------------
       
    83 
       
    84     /**  
       
    85      * AddConversationList
       
    86      * This is for handling new conversation event
       
    87      * asynchronusly from the server 
       
    88      * 
       
    89      * @param aClientConversation client conversation 
       
    90      */
       
    91     void AddConversationList(const CCsClientConversation& aClientConversation);
       
    92 
       
    93     /**  
       
    94      * DeleteConversationList
       
    95      * This is for handling delete conversation event
       
    96      * asynchronusly from the server 
       
    97      * 
       
    98      * @param aClientConversation client conversation 
       
    99      */
       
   100     void DeleteConversationList(
       
   101         const CCsClientConversation& aClientConversation);
       
   102 
       
   103     /**  
       
   104      * ModifyConversationList
       
   105      * This is for handling modify conversation asynchronusly
       
   106      * from the server 
       
   107      * 
       
   108      * @param aClientConversation client conversation 
       
   109      */
       
   110 
       
   111     void ModifyConversationList(
       
   112         const CCsClientConversation& aClientConversation);
       
   113     
       
   114 	/**
       
   115 	 * PartialDeleteConversationList
       
   116 	 * This is for handling the partial delete of conversation event from server
       
   117 	 * @param aClientConversation CCsClientConversation& - reference to client conversation
       
   118 	 */
       
   119     void PartialDeleteConversationList(
       
   120             const CCsClientConversation& aClientConversation);
       
   121     /**
       
   122      * RefreshConversationList
       
   123      * This is for handling refresh asynchronusly from the server.
       
   124      */
       
   125     void RefreshConversationList();
       
   126 
       
   127 private:
       
   128 
       
   129     /**
       
   130      * IssueRequest
       
   131      * Make the active object alive
       
   132      */
       
   133     void IssueRequest();
       
   134 
       
   135     /** 
       
   136      * Handles Conversation List received from server and updates into model
       
   137      */
       
   138     void HandleConversationListL();
       
   139     
       
   140     /**
       
   141      * CompareByConvTimeStamp
       
   142      * Helper method to compare conversations by timestamp
       
   143      * 
       
   144      * @param aObj1  CCsConversation object
       
   145      * @param aObj2  CCsConversation object
       
   146      * @return value based of timestamp comparison
       
   147      */
       
   148     static TInt CompareByConvTimeStamp(const CCsClientConversation& aObj1,
       
   149             const CCsClientConversation& aObj2);
       
   150    
       
   151 private:
       
   152     // data
       
   153 
       
   154     enum ConvListChangeHandlerStates
       
   155     {
       
   156         EInit = 200, 
       
   157         EInitialCache, 
       
   158         EListenToEvents
       
   159     };
       
   160 
       
   161     /**
       
   162      * mCurrentState
       
   163      * Holds Current state
       
   164      */
       
   165     ConvListChangeHandlerStates mCurrentState;
       
   166     
       
   167     /**
       
   168      * First list of conversation List entires updated
       
   169      * Own.
       
   170      */    
       
   171     TBool mFirstWindowCached;
       
   172     
       
   173     /**
       
   174      * Current entry being processed
       
   175      * Own.
       
   176      */       
       
   177     TInt mCurrentIndex;    
       
   178 
       
   179     /**
       
   180      * ConversationsSummaryModel object
       
   181      * Not Own.
       
   182      */
       
   183     ConversationsSummaryModel* mConvSummaryModel;
       
   184 
       
   185     /**
       
   186      * ConversationsEnginePrivate object
       
   187      * Not Own.
       
   188      */
       
   189     ConversationsEnginePrivate* mConvEnginePrivate;
       
   190 
       
   191     /**
       
   192      * List of CCsClientConversation entries
       
   193      * Own.
       
   194      */    
       
   195     RPointerArray<CCsClientConversation> mClientConversationList;
       
   196 
       
   197 };
       
   198 
       
   199 #endif // CONVERSATIONSLIST_CHANGEHANDLER_H
       
   200 // EOF