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