messagingapp/msgappfw/msghistory/inc/msghistoryprivate.h
branchRCL_3
changeset 26 ebe688cedc25
equal deleted inserted replaced
25:fa1df4b99609 26:ebe688cedc25
       
     1 /*
       
     2  * Copyright (c) 2007 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:  Private object for message history.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef __MSG_HISTORY_PRIVATE__
       
    19 #define __MSG_HISTORY_PRIVATE__
       
    20 
       
    21 #include "mcsresultsobserver.h"
       
    22 #include "mcsconversationchangeobserver.h"
       
    23 
       
    24 class CCSRequestHandler;
       
    25 class CCsConversationEntry;
       
    26 class CCsClientConversation;
       
    27 class MsgHistoryImpl;
       
    28 class MsgItem;
       
    29 
       
    30 class MsgHistoryPrivate : public CBase,
       
    31 public CActive,
       
    32 public MCsResultsObserver,
       
    33 public MCsConversationChangeObserver
       
    34     {
       
    35 public:
       
    36     /*
       
    37      * Constructor
       
    38      */
       
    39     MsgHistoryPrivate(MsgHistoryImpl* ptr);
       
    40     
       
    41     /*
       
    42      * Destructor
       
    43      */
       
    44     ~MsgHistoryPrivate();
       
    45 
       
    46 public:// CActive
       
    47 
       
    48     /**
       
    49      * RunL.
       
    50      */
       
    51     void RunL();
       
    52 
       
    53     /**
       
    54      * DoCancel
       
    55      */
       
    56     void DoCancel();
       
    57 
       
    58 public:   
       
    59     /*
       
    60      * GetMessagingHistory
       
    61      * @param aContactId, contactId
       
    62      */
       
    63     TBool GetMessagingHistory( TInt aContactId , TInt aKnownIndex = 0 );
       
    64     
       
    65     /*
       
    66      * ClearMessagingHistory
       
    67      * @param aContactId, contactId
       
    68      * @return
       
    69      */
       
    70     TBool ClearMessagingHistory( TInt aContactId );
       
    71     
       
    72     /*
       
    73      * MarkReadMessagingHistory
       
    74      * @param aContactId, contactId
       
    75      * @return
       
    76      */
       
    77     TBool MarkReadMessagingHistory( TInt aContactId );
       
    78     
       
    79     /*
       
    80      * Subscribe
       
    81      * @param aContactId, contactId
       
    82      * @return
       
    83      */
       
    84     TBool Subscribe( TInt aContactId );
       
    85     
       
    86     /*
       
    87      * UnSubscribe
       
    88      * @param aContactId, contactId
       
    89      * @return
       
    90      */
       
    91     TBool UnSubscribe ( TInt aContactId );
       
    92     
       
    93 public: // From MCsResultsObserver
       
    94 
       
    95     /**
       
    96      * ConversationList
       
    97      * This is for handling GetEntryList results asynchronusly
       
    98      * from the server.
       
    99      * 
       
   100      * @param aClientConversationList List of client conversations
       
   101      * returned by server.
       
   102      */
       
   103     void ConversationList(
       
   104             RPointerArray<CCsClientConversation>& aClientConversationList);
       
   105     /**
       
   106      * Conversations
       
   107      * This is for handling GetConversation results asynchronusly
       
   108      * from the server.
       
   109      * 
       
   110      * @param aConversationEntryList List of conversation entries
       
   111      * returned by server.
       
   112      * @param aTotalCount total number of conversaitons entries in the conversation
       
   113      */
       
   114 
       
   115     void Conversations(
       
   116             RPointerArray<CCsConversationEntry>& aConversationEntryList,
       
   117             TInt& aTotalCount);
       
   118   
       
   119 public://MCsConversationChangeObserver
       
   120     
       
   121     /**  
       
   122      * AddConversation
       
   123      * This is for handling addition of new conversation entry in
       
   124      * conversation view asynchronusly from the server.
       
   125      * 
       
   126      * @param aConversationEntry  Conversation Entry
       
   127      */
       
   128     void AddConversation(
       
   129             const CCsConversationEntry& aConversationEntry);
       
   130 
       
   131     /**  
       
   132      * ModifyConversation
       
   133      * This is for handling modification of existing
       
   134      * conversation entry in conversation view 
       
   135      * asynchronusly from the server.
       
   136      * 
       
   137      * @param aConversationEntry  Conversation Entry
       
   138      */
       
   139     void ModifyConversation(
       
   140             const CCsConversationEntry& aConversationEntry);
       
   141 
       
   142     /**  
       
   143      * DeleteConversation
       
   144      * This is for handling deletion of existing
       
   145      * conversation entry from conversation view 
       
   146      * asynchronusly from the server.
       
   147      * 
       
   148      * @param aConversationEntry  Conversation Entry
       
   149      */
       
   150     void DeleteConversation(
       
   151             const CCsConversationEntry& aConversationEntry);
       
   152     
       
   153     /**
       
   154      * RefreshConversation
       
   155      * This is for handling refresh asynchronusly from the server.
       
   156      */
       
   157     void RefreshConversation();
       
   158 
       
   159     /*
       
   160      * Populate MsgItem
       
   161      * @param item, MsgItem
       
   162      * @param entry, CCsConversationEntry
       
   163      */
       
   164     void PopulateMsgItem
       
   165     (MsgItem& item, const CCsConversationEntry& entry);
       
   166     
       
   167     /*
       
   168      * Set MsgItem Attributes
       
   169      * @param item, MsgItem
       
   170      * @param entry, CCsConversationEntry
       
   171      */   
       
   172     void SetMsgAttributes
       
   173     (MsgItem& item, const CCsConversationEntry& entry);
       
   174 
       
   175 private :
       
   176     /**
       
   177      * Make the active object alive
       
   178      */
       
   179     void IssueRequest();
       
   180     
       
   181 private: 
       
   182     
       
   183     /**
       
   184      * Msghistory Internal States
       
   185      */
       
   186     enum MsgHistoryStates
       
   187         {
       
   188         EInit = 500, 
       
   189         EFetchMoreConversations
       
   190         };
       
   191     /**
       
   192      * MsgHistoryStates
       
   193      * Own
       
   194      */
       
   195     MsgHistoryStates currentState;
       
   196 
       
   197     /**
       
   198      * Current entry being processed
       
   199      * Own.
       
   200      */
       
   201     TInt mCurrentIndex;
       
   202 
       
   203     /*
       
   204      * MsgHistoryImpl
       
   205      * Not Own
       
   206      */
       
   207     MsgHistoryImpl* q_ptr;
       
   208 
       
   209     /*
       
   210      * CCSRequestHandler
       
   211      * Own
       
   212      */
       
   213     CCSRequestHandler* handler;
       
   214     /*
       
   215      * List of MsgItem's
       
   216      * Own
       
   217      */
       
   218     QList<MsgItem> msgs;
       
   219     
       
   220     /*
       
   221      * Contact Id
       
   222      * Own
       
   223      */
       
   224     TInt contactId;
       
   225     };
       
   226 
       
   227 #endif // __MSG_HISTORY_PRIVATE__