|
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 from Phonebook to SIM command object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPSU2COPYFROMPBKCMD_H |
|
20 #define CPSU2COPYFROMPBKCMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MPbk2Command.h> |
|
25 #include <MPbk2FetchDlgObserver.h> |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 #include <MVPbkContactObserver.h> |
|
28 #include <MPbk2ProcessDecorator.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MVPbkContactStore; |
|
32 class MVPbkContactOperationBase; |
|
33 class MVPbkStoreContact; |
|
34 class MVPbkStoreContactField; |
|
35 class MVPbkBaseContact; |
|
36 class CPsu2CopyToSimFieldInfoArray; |
|
37 class MVPbkBaseContactField; |
|
38 class MVPbkFieldType; |
|
39 class MPbk2DialogEliminator; |
|
40 class MPbk2ContactUiControl; |
|
41 class CPsu2UIExtensionPlugin; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Phonebook 2 copy from Phonebook to SIM command object. |
|
47 * Responsible for displaying a fetch and address select so that |
|
48 * the user selects one contact field from Phonebook. Responsible |
|
49 * copying that contact field to SIM memory. |
|
50 */ |
|
51 class CPsu2CopyFromPbkCmd : |
|
52 public CActive, |
|
53 public MPbk2Command, |
|
54 public MPbk2FetchDlgObserver, |
|
55 public MVPbkSingleContactOperationObserver, |
|
56 public MVPbkContactObserver, |
|
57 private MPbk2ProcessDecoratorObserver |
|
58 { |
|
59 public: // Constructors and destructor |
|
60 |
|
61 /** |
|
62 * Creates a new instance of this class. |
|
63 * |
|
64 * @param aTargetStore The target store for copied contacts. |
|
65 * @param aUiControl Contact UI control. |
|
66 * @return A new instance of this class. |
|
67 */ |
|
68 static CPsu2CopyFromPbkCmd* NewL( |
|
69 MVPbkContactStore& aTargetStore, |
|
70 MPbk2ContactUiControl& aUiControl, |
|
71 CPsu2UIExtensionPlugin* aPsu2UIExensionPlugin ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 ~CPsu2CopyFromPbkCmd(); |
|
77 |
|
78 public: // From MPbk2Command |
|
79 void ExecuteLD(); |
|
80 void AddObserver(MPbk2CommandObserver& aObserver); |
|
81 void ResetUiControl(MPbk2ContactUiControl& aUiControl); |
|
82 |
|
83 |
|
84 private: // From CActive |
|
85 void RunL(); |
|
86 void DoCancel(); |
|
87 TInt RunError( |
|
88 TInt aError ); |
|
89 |
|
90 private: // From MPbk2FetchDlgObserver |
|
91 TPbk2FetchAcceptSelection AcceptFetchSelectionL( |
|
92 TInt aNumMarkedEntries, |
|
93 MVPbkContactLink& aLastSelection ); |
|
94 void FetchCompletedL( |
|
95 MVPbkContactLinkArray* aMarkedEntries ); |
|
96 void FetchCanceled(); |
|
97 void FetchAborted(); |
|
98 TBool FetchOkToExit(); |
|
99 |
|
100 private: // From MVPbkSingleContactOperationObserver |
|
101 void VPbkSingleContactOperationComplete( |
|
102 MVPbkContactOperationBase& aOperation, |
|
103 MVPbkStoreContact* aContact ); |
|
104 void VPbkSingleContactOperationFailed( |
|
105 MVPbkContactOperationBase& aOperation, |
|
106 TInt aError ); |
|
107 |
|
108 private: // From MVPbkContactObserver |
|
109 void ContactOperationCompleted( |
|
110 TContactOpResult aResult ); |
|
111 void ContactOperationFailed( |
|
112 TContactOp aOpCode, |
|
113 TInt aErrorCode, |
|
114 TBool aErrorNotified ); |
|
115 |
|
116 private: // From MPbk2ProcessDecoratorObserver |
|
117 void ProcessDismissed( TInt aCancelCode ); |
|
118 |
|
119 private: // Implementation |
|
120 CPsu2CopyFromPbkCmd( |
|
121 MVPbkContactStore& aTargetStore, |
|
122 MPbk2ContactUiControl& aUiControl, |
|
123 CPsu2UIExtensionPlugin* aPsu2UIExensionPlugin ); |
|
124 void ConstructL(); |
|
125 void QueryContactL(); |
|
126 void QueryAddressL(); |
|
127 void CopyContactL(); |
|
128 void IssueRequest(); |
|
129 TBool AddNameL( |
|
130 MVPbkBaseContact& aSource, |
|
131 MVPbkStoreContact& aTarget); |
|
132 TBool AppendSupportedFieldL( |
|
133 MVPbkStoreContactField& aSource, |
|
134 MVPbkStoreContact& aTarget); |
|
135 TBool CopyFieldL( |
|
136 const MVPbkBaseContactField& aFieldToCopy, |
|
137 MVPbkStoreContact& aTarget, |
|
138 const MVPbkFieldType& aSimType ); |
|
139 TBool QueryNameL( |
|
140 TDes& aName, |
|
141 TInt aMaxDataLength ); |
|
142 TBool QueryNumberL( |
|
143 TInt aPromptResourceId, |
|
144 TDes& aData, |
|
145 TInt aMaxDataLength, |
|
146 TInt aMaxEditorLength ); |
|
147 void ShowWaitNoteL(); |
|
148 void SetTitlePaneTextL( const TDesC& aText ); |
|
149 HBufC* GetTitlePaneTextL(); |
|
150 |
|
151 private: // Data |
|
152 /// Ref: Command observer |
|
153 MPbk2CommandObserver* iCommandObserver; |
|
154 /// Ref: Target store |
|
155 MVPbkContactStore& iTargetStore; |
|
156 /// Own: Copy contact operation |
|
157 MVPbkContactOperationBase* iCopyOperation; |
|
158 /// Own: Next task to be handled |
|
159 TInt iNextTask; |
|
160 /// Own: Store contact retrieve operation |
|
161 MVPbkContactOperationBase* iRetrieveOperation; |
|
162 /// Own: Source contact |
|
163 MVPbkStoreContact* iSourceStoreContact; |
|
164 /// Own: Target contact |
|
165 MVPbkStoreContact* iTargetStoreContact; |
|
166 /// Own: Chosen contact field |
|
167 MVPbkStoreContactField* iStoreContactField; |
|
168 /// Own: SIM field infos |
|
169 CPsu2CopyToSimFieldInfoArray* iSimFieldInfos; |
|
170 /// Ref: Fetch dialog eliminator |
|
171 MPbk2DialogEliminator* iFetchDialogEliminator; |
|
172 /// Ref: Contact UI control |
|
173 MPbk2ContactUiControl* iUiControl; |
|
174 /// Own: Decorator for the wait note process |
|
175 MPbk2ProcessDecorator* iDecorator; |
|
176 /// Own: Help variable for querying name length |
|
177 TBool iLengthQuery; |
|
178 /// Own: Last error code |
|
179 TInt iLastError; |
|
180 /// Own: Original title pane text |
|
181 HBufC* iTitlePaneText; |
|
182 /// Own: Psu2 UI extension plugin |
|
183 CPsu2UIExtensionPlugin* iPsu2UIExensionPlugin; |
|
184 }; |
|
185 |
|
186 #endif // CPSU2COPYFROMPBKCMD_H |
|
187 |
|
188 // End of File |