messagingapp/msgappfw/server/inc/ccsconversationmarkreadhandler.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     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:  CS Server Mark Read Handler
       
    15 *
       
    16 */
       
    17 #ifndef __C_CS_CONVERSATION_MARK_READ_HANDLER_H__
       
    18 #define __C_CS_CONVERSATION_MARK_READ_HANDLER_H__
       
    19 
       
    20 // SYSTEM INCLUDE FILES
       
    21 #include <msvapi.h>
       
    22 
       
    23 // FORWARD DECLARATIONS
       
    24 class CMsvSession;
       
    25 class MMsvSessionObserver;
       
    26 class CConversationCache;
       
    27 class CCsConversationEntry;
       
    28 class MCsConversationMarkReadObserver;
       
    29 
       
    30 /**
       
    31  * Mark read handler states
       
    32  */
       
    33 enum TMarkReadHandlerState
       
    34     {
       
    35     EMarkReadIdle = 0,
       
    36     EMarkReadStart,
       
    37     EMarkReadNext,
       
    38     EMarkReadComplete
       
    39     };
       
    40 
       
    41 /**
       
    42  * This class handles mark read of messages from messaging store.
       
    43  */
       
    44 class CCsConversationMarkReadHandler : public CActive, 
       
    45 public MMsvSessionObserver 
       
    46     {
       
    47 public:
       
    48     /**
       
    49      * Two phase construction
       
    50      */
       
    51     static CCsConversationMarkReadHandler* NewL(CCsConversationCache* aCache,
       
    52             MCsConversationMarkReadObserver* aObserver);
       
    53 
       
    54     /**
       
    55      * Destructor
       
    56      */
       
    57     virtual ~CCsConversationMarkReadHandler();
       
    58     
       
    59     /**
       
    60      * From MMsvSessionObserver, HandleSessionEventL.
       
    61      */
       
    62     virtual void HandleSessionEventL(TMsvSessionEvent /*aEvent*/, 
       
    63             TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) {};
       
    64     
       
    65     /**
       
    66      * Mark a set of messages as read
       
    67      * @param aConversationId. The conversation id.
       
    68      */
       
    69     void MarkReadL(TInt aConversationId);
       
    70     
       
    71 public: // From CActive
       
    72     void RunL();
       
    73     void DoCancel();
       
    74 
       
    75 private:    
       
    76     CCsConversationMarkReadHandler();
       
    77     void ConstructL(CCsConversationCache* aCache,
       
    78             MCsConversationMarkReadObserver* aObserver);
       
    79     void IssueRequest();
       
    80     void MarkReadOneMessageL();
       
    81     
       
    82 private:
       
    83     /**
       
    84      * Own. Msv Session.
       
    85      */
       
    86     CMsvSession* iSession;
       
    87     
       
    88     /**
       
    89      * iObserver
       
    90      * Own.
       
    91     */
       
    92     MCsConversationMarkReadObserver* iObserver;
       
    93     
       
    94     /**
       
    95      * State
       
    96      */
       
    97     TMarkReadHandlerState iState;
       
    98     
       
    99     /**
       
   100      * Not own. Cache.
       
   101      */
       
   102     CCsConversationCache* iCache;
       
   103     
       
   104     /**
       
   105      * Own. List of message entries to be mark read.
       
   106      */
       
   107     RPointerArray<CCsConversationEntry>*  iConversationEntryList;
       
   108     
       
   109     /**
       
   110      * Mark read message count
       
   111      */
       
   112     TInt iMarkReadCount;
       
   113     };
       
   114 
       
   115 #endif // __C_CS_CONVERSATION_DELETE_HANDLER_H__