|
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: Phonebook 2 Group UI Extension delete group command. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPGUDELETEGROUPCMD_H |
|
20 #define CPGUDELETEGROUPCMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MPbk2Command.h> |
|
25 #include <MPbk2ProcessDecorator.h> |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 #include <MVPbkBatchOperationObserver.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CAknProgressDialog; |
|
31 class CEikProgressInfo; |
|
32 class MPbk2ContactNameFormatter; |
|
33 class MPbk2ContactUiControl; |
|
34 class CVPbkContactManager; |
|
35 class MVPbkContactLink; |
|
36 class MVPbkContactLinkArray; |
|
37 class MVPbkStoreContact; |
|
38 class MVPbkContactGroup; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Phonebook 2 Group UI Extension delete group command. |
|
44 */ |
|
45 class CPguDeleteGroupCmd : |
|
46 public CActive, |
|
47 public MPbk2Command, |
|
48 private MVPbkSingleContactOperationObserver, |
|
49 private MVPbkBatchOperationObserver, |
|
50 private MPbk2ProcessDecoratorObserver |
|
51 { |
|
52 public: // Construction and destruction |
|
53 /** |
|
54 * Creates a new instance of this class. |
|
55 * |
|
56 * @param aUiControl Contact UI control. |
|
57 * @return A new instance of this class. |
|
58 */ |
|
59 static CPguDeleteGroupCmd* NewL( |
|
60 MPbk2ContactUiControl& aUiControl ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 ~CPguDeleteGroupCmd(); |
|
66 |
|
67 public: // From MPbk2Command |
|
68 void ExecuteLD(); |
|
69 void AddObserver( MPbk2CommandObserver& aObserver ); |
|
70 void ResetUiControl(MPbk2ContactUiControl& aUiControl); |
|
71 |
|
72 private: // From CActive |
|
73 void DoCancel(); |
|
74 void RunL(); |
|
75 TInt RunError( TInt aError ); |
|
76 |
|
77 private: // From MVPbkSingleContactOperationObserver |
|
78 void VPbkSingleContactOperationComplete( |
|
79 MVPbkContactOperationBase& aOperation, |
|
80 MVPbkStoreContact* aContact ); |
|
81 void VPbkSingleContactOperationFailed( |
|
82 MVPbkContactOperationBase& aOperation, |
|
83 TInt aError ); |
|
84 |
|
85 private: // From MVPbkBatchOperationObserver |
|
86 void StepComplete( |
|
87 MVPbkContactOperationBase& aOperation, |
|
88 TInt aStepSize ); |
|
89 TBool StepFailed( |
|
90 MVPbkContactOperationBase& aOperation, |
|
91 TInt aStepSize, |
|
92 TInt aError ); |
|
93 void OperationComplete( |
|
94 MVPbkContactOperationBase& aOperation ); |
|
95 |
|
96 private: // From MPbk2ProcessDecoratorObserver |
|
97 void ProcessDismissed( |
|
98 TInt aCancelCode ); |
|
99 |
|
100 private: // Data structures |
|
101 /// Process states |
|
102 enum TProcessState |
|
103 { |
|
104 ERetrieving, |
|
105 EConfirming, |
|
106 EStarting, |
|
107 EDeleting, |
|
108 EStopping, |
|
109 ECanceling |
|
110 }; |
|
111 |
|
112 private: // Implementation |
|
113 CPguDeleteGroupCmd( |
|
114 MPbk2ContactUiControl& aUiControl ); |
|
115 void ConstructL(); |
|
116 void RetrieveContactL( |
|
117 const MVPbkContactLink& aContactLink ); |
|
118 TInt FilterErrors( |
|
119 TInt aErrorCode ); |
|
120 void IssueRequest(); |
|
121 void IssueStopRequest( |
|
122 TProcessState aState ); |
|
123 void ConfirmDeletionL(); |
|
124 void DoDeleteContactsL(); |
|
125 |
|
126 private: // Data |
|
127 /// Ref: UI control |
|
128 MPbk2ContactUiControl* iUiControl; |
|
129 /// Own: Decorator for the process |
|
130 MPbk2ProcessDecorator* iDecorator; |
|
131 /// Own: Links to the contacts to delete |
|
132 MVPbkContactLinkArray* iContactLinkArray; |
|
133 /// Own: Retrieve operation |
|
134 MVPbkContactOperationBase* iRetrieveOperation; |
|
135 /// Own: Delete operation |
|
136 MVPbkContactOperationBase* iDeleteOperation; |
|
137 /// Own: The group to delete |
|
138 MVPbkContactGroup* iContactGroup; |
|
139 /// Ref: Command observer |
|
140 MPbk2CommandObserver* iCommandObserver; |
|
141 /// Own: Current state of process |
|
142 TProcessState iState; |
|
143 }; |
|
144 |
|
145 #endif // CPGUDELETEGROUPCMD_H |
|
146 |
|
147 // End of File |