|
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 copy contacts command. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2COPYCONTACTSCMD_H |
|
20 #define CPBK2COPYCONTACTSCMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <MPbk2Command.h> |
|
24 #include <MPbk2ProcessDecorator.h> |
|
25 #include <MVPbkBatchOperationObserver.h> |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 #include <e32base.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CPbk2DriveSpaceCheck; |
|
31 class MPbk2ProcessDecorator; |
|
32 class MPbk2ContactUiControl; |
|
33 class CVPbkContactStoreUriArray; |
|
34 class CVPbkContactLinkArray; |
|
35 class CVPbkContactCopier; |
|
36 class MVPbkContactOperationBase; |
|
37 class MVPbkContactLinkArray; |
|
38 class MVPbkContactStore; |
|
39 class MVPbkContactBookmark; |
|
40 class CPbk2ApplicationServices; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * Phonebook 2 copy contacts command. |
|
46 */ |
|
47 NONSHARABLE_CLASS(CPbk2CopyContactsCmd) : |
|
48 public CActive, |
|
49 public MPbk2Command, |
|
50 private MVPbkBatchOperationObserver, |
|
51 private MPbk2ProcessDecoratorObserver, |
|
52 private MVPbkSingleContactOperationObserver |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 /** |
|
56 * Creates a new instance of this class. |
|
57 * |
|
58 * @param aUiControl UI control. |
|
59 * @return A new instance of this class. |
|
60 */ |
|
61 static CPbk2CopyContactsCmd* NewL( |
|
62 MPbk2ContactUiControl& aUiControl ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CPbk2CopyContactsCmd(); |
|
68 |
|
69 private: // From CActive |
|
70 void RunL(); |
|
71 void DoCancel(); |
|
72 TInt RunError( TInt aError ); |
|
73 |
|
74 public: // From MPbk2Command |
|
75 void ExecuteLD(); |
|
76 void AddObserver( MPbk2CommandObserver& aObserver ); |
|
77 void ResetUiControl(MPbk2ContactUiControl& aUiControl); |
|
78 |
|
79 private: // From MVPbkBatchOperationObserver |
|
80 void StepComplete( |
|
81 MVPbkContactOperationBase& aOperation, |
|
82 TInt aStepSize ); |
|
83 TBool StepFailed( |
|
84 MVPbkContactOperationBase& aOperation, |
|
85 TInt aStepSize, |
|
86 TInt aError ); |
|
87 void OperationComplete( |
|
88 MVPbkContactOperationBase& aOperation ); |
|
89 |
|
90 private: // From MPbk2ProcessDecoratorObserver |
|
91 void ProcessDismissed( |
|
92 TInt aCancelCode ); |
|
93 |
|
94 private: // From MVPbkSingleContactOperationObserver |
|
95 void VPbkSingleContactOperationComplete( |
|
96 MVPbkContactOperationBase& aOperation, |
|
97 MVPbkStoreContact* aContact ); |
|
98 void VPbkSingleContactOperationFailed( |
|
99 MVPbkContactOperationBase& aOperation, |
|
100 TInt aError ); |
|
101 |
|
102 private: // Implementation |
|
103 CPbk2CopyContactsCmd( |
|
104 MPbk2ContactUiControl& aUiControl ); |
|
105 void ConstructL(); |
|
106 void IssueRequest(); |
|
107 void InitL(); |
|
108 void RetrieveL(); |
|
109 void StartCopyL(); |
|
110 void ShowResultsL(); |
|
111 void FinishCommandL(); |
|
112 void CreateLinkArrayL( |
|
113 MVPbkContactLinkArray& aSelection ); |
|
114 void ShowSelectedContactsInfoNoteL(); |
|
115 void HandleError( TInt aError ); |
|
116 |
|
117 private: // Data |
|
118 /// Ref: Store control |
|
119 MPbk2ContactUiControl* iStoreUiControl; |
|
120 /// Ref: UI control |
|
121 MPbk2ContactUiControl* iNameListUiControl; |
|
122 /// Ref: Observer for the completion of the command |
|
123 MPbk2CommandObserver* iCommandObserver; |
|
124 /// Ref: The target store for the contacts |
|
125 MVPbkContactStore* iTargetStore; |
|
126 /// Own: Selected contacts |
|
127 CVPbkContactLinkArray* iContactLinks; |
|
128 /// Own: An operation for retrieving the contact |
|
129 MVPbkContactOperationBase* iRetrieveOperation; |
|
130 /// Own: Contact when copying one contact |
|
131 MVPbkStoreContact* iContact; |
|
132 /// Own: Virtual Phonebook copy operation |
|
133 MVPbkContactOperationBase* iCopyOperation; |
|
134 /// Own: Decorator for the process |
|
135 MPbk2ProcessDecorator* iDecorator; |
|
136 /// Own: Indicator for succesfully copied contacts |
|
137 TInt iCopiedSuccessfully; |
|
138 /// Own: The internal state of the command |
|
139 TInt iState; |
|
140 /// Own: The virtual phonebook contact copier |
|
141 CVPbkContactCopier* iCopier; |
|
142 /// Own: An array for copy results |
|
143 CVPbkContactLinkArray* iCopiedContacts; |
|
144 /// Own: Flash File System space checker |
|
145 CPbk2DriveSpaceCheck* iDriveSpaceCheck; |
|
146 /// Own: The focus must kept during the copy |
|
147 MVPbkContactBookmark* iFocusedContactBookmark; |
|
148 /// Own: Application Services pointer |
|
149 CPbk2ApplicationServices* iAppServices; |
|
150 }; |
|
151 |
|
152 #endif // CPBK2COPYCONTACTSCMD_H |
|
153 |
|
154 // End of File |