messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.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 Delete Handler
       
    15 *
       
    16 */
       
    17 #ifndef __C_CS_CONVERSATION_DELETE_HANDLER_H__
       
    18 #define __C_CS_CONVERSATION_DELETE_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 MCsConversationDeleteObserver;
       
    29 
       
    30 /**
       
    31  * Delete handler states
       
    32  */
       
    33 enum TDeleteHandlerState
       
    34     {
       
    35     EIdle = 0,
       
    36     EDeleteStart,
       
    37     EDeleteNext,
       
    38     EDeleteComplete
       
    39     };
       
    40 
       
    41 /**
       
    42  * This class handles deletion of messages from messaging store.
       
    43  */
       
    44 class CCsConversationDeleteHandler : public CActive, 
       
    45 public MMsvSessionObserver 
       
    46     {
       
    47 public:
       
    48     /**
       
    49      * Two phase construction
       
    50      */
       
    51     static CCsConversationDeleteHandler* NewL(CCsConversationCache* aCache,
       
    52             MCsConversationDeleteObserver* aObserver);
       
    53 
       
    54     /**
       
    55      * Destructor
       
    56      */
       
    57     virtual ~CCsConversationDeleteHandler();
       
    58     
       
    59     /**
       
    60      * From MMsvSessionObserver, HandleSessionEventL.
       
    61      */
       
    62     virtual void HandleSessionEventL(TMsvSessionEvent /*aEvent*/, 
       
    63             TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) {};
       
    64     
       
    65     /**
       
    66      * Delete a set of messages
       
    67      * @param aConversationId. The conversation id.
       
    68      */
       
    69     void DeleteL(TInt aConversationId);
       
    70     
       
    71 public: // From CActive
       
    72     void RunL();
       
    73     void DoCancel();
       
    74 
       
    75 private:    
       
    76     CCsConversationDeleteHandler();
       
    77     void ConstructL(CCsConversationCache* aCache,
       
    78             MCsConversationDeleteObserver* aObserver);
       
    79     void IssueRequest();
       
    80     void DeleteOneMessageL();
       
    81     
       
    82 private:
       
    83     /**
       
    84      * Own. Msv Session.
       
    85      */
       
    86     CMsvSession* iSession;
       
    87     
       
    88     /**
       
    89      * iObserverList
       
    90      * List of observers
       
    91      * Own.
       
    92     */
       
    93     MCsConversationDeleteObserver* iObserver;
       
    94     
       
    95     /**
       
    96      * State
       
    97      */
       
    98     TDeleteHandlerState iState;
       
    99     
       
   100     /**
       
   101      * Not own. Cache.
       
   102      */
       
   103     CCsConversationCache* iCache;
       
   104     
       
   105     /**
       
   106      * Own. List of message entries to be deleted.
       
   107      */
       
   108     RPointerArray<CCsConversationEntry>*  iConversationEntryList;
       
   109     
       
   110     /**
       
   111      * Deleted message count
       
   112      */
       
   113     TInt iDeletedCount;
       
   114 
       
   115     /**
       
   116      * Conversation Id currently being deleted.
       
   117      */
       
   118     TInt iConversationId;
       
   119     };
       
   120 
       
   121 #endif // __C_CS_CONVERSATION_DELETE_HANDLER_H__