|
1 /* |
|
2 * Copyright (c) 2005-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: An operation that deletes a contact from the (U)SIM using ETel |
|
15 * RMobilePhoneStore Delete |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef VPBKSIMSTOREIMPL_CDELETECMD_H |
|
22 #define VPBKSIMSTOREIMPL_CDELETECMD_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "METelStoreNotificationObserver.h" |
|
26 #include <MVPbkSimCommandObserver.h> |
|
27 #include <MVPbkSimStoreOperation.h> |
|
28 #include <e32base.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MVPbkSimContactObserver; |
|
32 class RVPbkStreamedIntArray; |
|
33 |
|
34 namespace VPbkSimStoreImpl { |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CStoreBase; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * An operation that deletes a contact from the (U)SIM. |
|
43 * |
|
44 */ |
|
45 NONSHARABLE_CLASS(CDeleteCmd) : public CActive, |
|
46 public MVPbkSimStoreOperation, |
|
47 private METelStoreNotificationObserver, |
|
48 private MVPbkSimCommandObserver |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * |
|
55 * @param aStore the store from which the contact is deleted |
|
56 * @param aSimIndex the index of the contact to be deleted |
|
57 * @param aObserver an observer to notify after command is done |
|
58 * @return a new instance of this class |
|
59 */ |
|
60 static CDeleteCmd* NewL( CStoreBase& aStore, |
|
61 RVPbkStreamedIntArray& aIndexArray, |
|
62 MVPbkSimContactObserver& aObserver ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CDeleteCmd(); |
|
68 |
|
69 public: // New functions |
|
70 |
|
71 /** |
|
72 * Starts this operation |
|
73 */ |
|
74 void Execute(); |
|
75 |
|
76 public: // Functions from base classes |
|
77 |
|
78 /** |
|
79 * From CActive |
|
80 */ |
|
81 void RunL(); |
|
82 |
|
83 /** |
|
84 * From CActive |
|
85 */ |
|
86 void DoCancel(); |
|
87 |
|
88 /** |
|
89 * From CActive |
|
90 */ |
|
91 TInt RunError( TInt aError ); |
|
92 |
|
93 private: // Functions from base classes |
|
94 |
|
95 /** |
|
96 * From METelStoreNotificationObserver |
|
97 */ |
|
98 TBool ETelStoreChanged( TInt aSimIndex, TUint32 aEvents ); |
|
99 |
|
100 /** |
|
101 * From METelStoreNotificationObserver |
|
102 */ |
|
103 TBool ETelStoreChangeError( TInt aError ); |
|
104 |
|
105 /** |
|
106 * From MVPbkSimCommandObserver |
|
107 */ |
|
108 void CommandDone( MVPbkSimCommand& aCommand ); |
|
109 |
|
110 /** |
|
111 * From MVPbkSimCommandObserver |
|
112 */ |
|
113 void CommandError( MVPbkSimCommand& aCommand, TInt aError ); |
|
114 |
|
115 private: // Construction |
|
116 |
|
117 /** |
|
118 * C++ constructor. |
|
119 */ |
|
120 CDeleteCmd( CStoreBase& aStore, |
|
121 MVPbkSimContactObserver& aObserver ); |
|
122 |
|
123 /** |
|
124 * By default Symbian 2nd phase constructor is private. |
|
125 */ |
|
126 void ConstructL( RVPbkStreamedIntArray& aIndexArray ); |
|
127 |
|
128 private: // New functions |
|
129 /// Starts deleting next contact or completes |
|
130 void DeleteNextL(); |
|
131 /// Starts deleting contact in aSimIndex |
|
132 void DeleteNextL( TInt aSimIndex ); |
|
133 /// Returns the index of next contact to delete |
|
134 TInt NextContactIndex(); |
|
135 /// Completes the active object with aRequestResult |
|
136 void CompleteRequest( TInt aRequestResult ); |
|
137 /// Called to complete this command |
|
138 void CompleteCommand(); |
|
139 /// Handles error case |
|
140 void HandleError( TInt aError ); |
|
141 /// Removes this instance from the ETel notification |
|
142 void RemoveNotificationObserver(); |
|
143 |
|
144 private: // Data |
|
145 /// the store from which the contact is deleted |
|
146 CStoreBase& iStore; |
|
147 /// sim indexes of the contacts to be deleted |
|
148 RArray<TInt> iIndexArray; |
|
149 /// the sim index that is deleted currently |
|
150 TInt iCurSimIndex; |
|
151 /// An observer for the error case |
|
152 MVPbkSimContactObserver& iObserver; |
|
153 /// Own: the update command to execute |
|
154 MVPbkSimCommand* iUpdateCommand; |
|
155 }; |
|
156 } // namespace VPbkSimStoreImpl |
|
157 #endif // VPBKSIMSTOREIMPL_CDELETECMD_H |
|
158 |
|
159 // End of File |