|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: Declaration of CPushMtmGcOperation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PUSHMTMGCOPERATION_H |
|
21 #define PUSHMTMGCOPERATION_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 |
|
25 #include "PushMtmOperation.h" |
|
26 #include <e32base.h> |
|
27 #include <e32std.h> |
|
28 #include <Msvstd.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 class CMsvSession; |
|
33 class CPushMtmUtil; |
|
34 class CMsvEntrySelection; |
|
35 class CSIPushMsgEntry; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Garbage collection operation. It removes some or all expired SIs from the |
|
41 * Message Server. |
|
42 */ |
|
43 class CPushMtmGcOperation : public CPushMtmOperation |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. Leaves on failure. |
|
49 * @param aSession Message server session to be used by this operation. |
|
50 * @param aFolderId aFolderId Garbage collection is made in this folder. |
|
51 * If it's KMsvNullIndexEntryId, then gc is made in all the |
|
52 * folders that may contain push messages. |
|
53 * @param aObserverRequestStatus Observer's status. |
|
54 * @return The constructed operation. |
|
55 */ |
|
56 static CPushMtmGcOperation* NewL( CMsvSession& aSession, |
|
57 TMsvId aFolderId, |
|
58 TRequestStatus& aObserverRequestStatus ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CPushMtmGcOperation(); |
|
64 |
|
65 public: // New functions |
|
66 |
|
67 /** |
|
68 * Do the garbage collection synchronously. |
|
69 */ |
|
70 void DoSyncL(); |
|
71 |
|
72 protected: // Constructors |
|
73 |
|
74 /** |
|
75 * Constructor. |
|
76 * @param aSession Message server session to be used by this operation. |
|
77 * @param aFolderId Garbage collection is made in this folder. |
|
78 * @param aObserverRequestStatus Observer's status. |
|
79 */ |
|
80 CPushMtmGcOperation( CMsvSession& aSession, |
|
81 TMsvId aFolderId, |
|
82 TRequestStatus& aObserverRequestStatus ); |
|
83 |
|
84 /** |
|
85 * Symbian OS constructor. |
|
86 */ |
|
87 void ConstructL(); |
|
88 |
|
89 protected: // New functions |
|
90 |
|
91 /** |
|
92 * Initialize the operation. Creates an array of SI messages. |
|
93 */ |
|
94 void InitL(); |
|
95 |
|
96 /** |
|
97 * Delete the current entry if it is expired. |
|
98 */ |
|
99 void GcCurrentL(); |
|
100 |
|
101 protected: // Functions from base classes |
|
102 |
|
103 /** |
|
104 * Do garbage collection. Initializes an array of SI messages |
|
105 * and check the expiration state: one check per one RunL shot. |
|
106 */ |
|
107 void RunL(); |
|
108 |
|
109 /** |
|
110 * Cancel protocol implementation. CPushMtmOperation::DoCancel() is |
|
111 * called. |
|
112 */ |
|
113 void DoCancel(); |
|
114 |
|
115 /** |
|
116 * Leave handler protocol implementation: it is called when |
|
117 * RunL leaves. It continues the operation if the current entry is not |
|
118 * found, otherwise it is stopped. |
|
119 */ |
|
120 TInt RunError( TInt aError ); |
|
121 |
|
122 protected: // Data members |
|
123 |
|
124 enum TState |
|
125 { |
|
126 EInit, |
|
127 EGarbageCollecting |
|
128 }; |
|
129 |
|
130 TState iState; ///< Operation state. |
|
131 TMsvId iFolderId; /**< Gc is done only in this specific folder, |
|
132 * if it is not KMsvNullIndexEntryId. */ |
|
133 CPushMtmUtil* iUtil; ///< Utility class. Owned. |
|
134 CMsvEntrySelection* iEntrySel; ///< Selection of entries to be deleted. Owned. |
|
135 CSIPushMsgEntry* iEntryWrapper; ///< Msg class. Owned. |
|
136 TInt iCount; ///< Count of the selection. |
|
137 TInt iCurrentIndex; ///< Index of the current entry in the selection. |
|
138 }; |
|
139 |
|
140 #endif // PUSHMTMGCOPERATION_H |
|
141 |
|
142 // End of file. |