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