messagingapp/msgappfw/server/inc/ccsconversationmarkreadhandler.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 14:56:15 +0300
changeset 23 238255e8b033
child 25 84d9eb65b26f
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  CS Server Mark Read Handler
*
*/
#ifndef __C_CS_CONVERSATION_MARK_READ_HANDLER_H__
#define __C_CS_CONVERSATION_MARK_READ_HANDLER_H__

// SYSTEM INCLUDE FILES
#include <msvapi.h>

// FORWARD DECLARATIONS
class CMsvSession;
class MMsvSessionObserver;
class CConversationCache;
class CCsConversationEntry;
class MCsConversationMarkReadObserver;

/**
 * Mark read handler states
 */
enum TMarkReadHandlerState
    {
    EMarkReadIdle = 0,
    EMarkReadStart,
    EMarkReadNext,
    EMarkReadComplete
    };

/**
 * This class handles mark read of messages from messaging store.
 */
class CCsConversationMarkReadHandler : public CActive, 
public MMsvSessionObserver 
    {
public:
    /**
     * Two phase construction
     */
    static CCsConversationMarkReadHandler* NewL(CCsConversationCache* aCache,
            MCsConversationMarkReadObserver* aObserver);

    /**
     * Destructor
     */
    virtual ~CCsConversationMarkReadHandler();
    
    /**
     * From MMsvSessionObserver, HandleSessionEventL.
     */
    virtual void HandleSessionEventL(TMsvSessionEvent /*aEvent*/, 
            TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) {};
    
    /**
     * Mark a set of messages as read
     * @param aConversationId. The conversation id.
     */
    void MarkReadL(TInt aConversationId);
    
public: // From CActive
    void RunL();
    void DoCancel();

private:    
    CCsConversationMarkReadHandler();
    void ConstructL(CCsConversationCache* aCache,
            MCsConversationMarkReadObserver* aObserver);
    void IssueRequest();
    void MarkReadOneMessageL();
    
private:
    /**
     * Own. Msv Session.
     */
    CMsvSession* iSession;
    
    /**
     * iObserver
     * Own.
    */
    MCsConversationMarkReadObserver* iObserver;
    
    /**
     * State
     */
    TMarkReadHandlerState iState;
    
    /**
     * Not own. Cache.
     */
    CCsConversationCache* iCache;
    
    /**
     * Own. List of message entries to be mark read.
     */
    RPointerArray<CCsConversationEntry>*  iConversationEntryList;
    
    /**
     * Mark read message count
     */
    TInt iMarkReadCount;
    };

#endif // __C_CS_CONVERSATION_DELETE_HANDLER_H__