|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * Class which performs an operation for a set of entries. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CMRUTILSCMDITERATIONAO_H__ |
|
22 #define __CMRUTILSCMDITERATIONAO_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <CMRUtils.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MMRUtilsCalDbMgr; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Active object which can be used for iterating through a set of |
|
35 * calendar entries and performing an operation for each of them. |
|
36 */ |
|
37 class CMRUtilsCmdIterationAO |
|
38 : public CActive |
|
39 { |
|
40 public: // Constructors and destructors |
|
41 |
|
42 /** |
|
43 * Symbian constructor. |
|
44 * @param aDbMgr performs each cmd iteration and observes progress |
|
45 * @return instantiated object |
|
46 */ |
|
47 static CMRUtilsCmdIterationAO* NewL( MMRUtilsCalDbMgr& aDbMgr ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CMRUtilsCmdIterationAO(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Starts iterating through entries in aCalEntryArray and performs |
|
58 * the command determined by aOpCode for each of them. This method |
|
59 * handles the case of empty array. |
|
60 * Due to asynchronous nature of this task this method creates a copy |
|
61 * of the array and takes the ownership of the CCalEntry objects! |
|
62 * @param iCalEntryArray, ownership of entries is transferred |
|
63 * @param aOpCode command to perform |
|
64 */ |
|
65 void StartCmdIterationL( |
|
66 const RPointerArray<CCalEntry> aCalEntryArray, |
|
67 TInt aOpCode ); |
|
68 |
|
69 protected: // From CActive |
|
70 |
|
71 void RunL(); |
|
72 |
|
73 void DoCancel(); |
|
74 |
|
75 TInt RunError( TInt aError ); |
|
76 |
|
77 protected: // New functions |
|
78 |
|
79 /** |
|
80 * Helper which creates copies entries to iCalEntryArray and |
|
81 * transfers the ownership to that. |
|
82 */ |
|
83 void CopyToOwnArrayL(); |
|
84 |
|
85 protected: // Constructors and destructors |
|
86 |
|
87 /** |
|
88 * C++ default constructor. |
|
89 * @param aDbMgr performs each cmd iteration and observes progress |
|
90 */ |
|
91 CMRUtilsCmdIterationAO( MMRUtilsCalDbMgr& aDbMgr ); |
|
92 |
|
93 /** |
|
94 * Constructor, second phase. |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 protected: // data |
|
99 |
|
100 // Code for the utils operation being executed |
|
101 TInt iOpCode; |
|
102 |
|
103 // Calendar database reference |
|
104 MMRUtilsCalDbMgr& iDbMgr; |
|
105 |
|
106 // Array of entries, own |
|
107 RPointerArray<CCalEntry> iCalEntryArray; |
|
108 }; |
|
109 |
|
110 #endif // __CMRUTILSCMDITERATIONAO_H__ |
|
111 |
|
112 // End of File |