|
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 contact editor dialog extension. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cpmapcontacteditorextension.h" |
|
19 |
|
20 // Phonebook 2 |
|
21 #include <CPbk2UIExtensionPlugin.h> |
|
22 #include <Pbk2USimUIRes.rsg> |
|
23 #include <Pbk2UIControls.rsg> |
|
24 #include <Pbk2CommonUi.rsg> |
|
25 #include <Pbk2UIControls.hrh> |
|
26 #include <MPbk2ContactEditorControl.h> |
|
27 #include <CPbk2StoreProperty.h> |
|
28 #include <CPbk2StorePropertyArray.h> |
|
29 #include <MPbk2FieldProperty.h> |
|
30 #include <CPbk2FieldPropertyArray.h> |
|
31 #include <MPbk2ApplicationServices.h> |
|
32 #include <MPbk2AppUi.h> |
|
33 #include "CPbk2ContactEditorUIAFMField.h" |
|
34 #include <MPbk2UIField.h> |
|
35 #include <CPbk2IconInfoContainer.h> |
|
36 |
|
37 // Virtual Phonebook |
|
38 #include <MVPbkStoreContact.h> |
|
39 #include <MVPbkContactStore.h> |
|
40 #include <MVPbkContactStoreProperties.h> |
|
41 #include <TVPbkContactStoreUriPtr.h> |
|
42 #include <VPbkContactStoreUris.h> |
|
43 #include <MVPbkFieldType.h> |
|
44 #include <CVPbkFieldTypeSelector.h> |
|
45 #include <CVPbkContactManager.h> |
|
46 #include <MVPbkStoreContactField.h> |
|
47 #include <MVPbkStoreContactFieldCollection.h> |
|
48 #include <MVPbkContactFieldTextData.h> |
|
49 #include "cpmapcmd.h" |
|
50 #include "pbk2mapcommands.hrh" |
|
51 #include <CPbk2AppUiBase.h> |
|
52 #include <Pbk2Commands.hrh> |
|
53 #include <MPbk2CommandHandler.h> |
|
54 #include <MPbk2ApplicationServices.h> |
|
55 #include <Pbk2MapUIRes.rsg> |
|
56 #include <Pbk2Commands.rsg> |
|
57 #include <Pbk2UIControls.hrh> |
|
58 #include <Pbk2UIControls.rsg> |
|
59 #include <cpmapcontacteditorextension.h> |
|
60 #include <CPbk2ContactEditorDlgImpl.h> |
|
61 |
|
62 // System includes |
|
63 #include <etelmmerr.h> |
|
64 #include <gsmerror.h> |
|
65 #include <exterror.h> |
|
66 #include <eikmenub.h> |
|
67 #include <StringLoader.h> |
|
68 #include <aknnotewrappers.h> |
|
69 #include <barsread.h> |
|
70 #include <eikbtgpc.h> |
|
71 #include <charconv.h> |
|
72 #include <AiwCommon.hrh> |
|
73 #include <AiwServiceHandler.h> |
|
74 #include <mnproviderfinder.h> |
|
75 |
|
76 // Debugging headers |
|
77 #include <Pbk2Debug.h> |
|
78 |
|
79 /// Unnamed namespace for local definitions |
|
80 namespace { |
|
81 |
|
82 } /// namespace |
|
83 |
|
84 // -------------------------------------------------------------------------- |
|
85 // CPmapContactEditorExtension::CPmapContactEditorExtension |
|
86 // -------------------------------------------------------------------------- |
|
87 // |
|
88 CPmapContactEditorExtension::CPmapContactEditorExtension |
|
89 ( CVPbkContactManager& aContactManager, |
|
90 MVPbkStoreContact& aContact, |
|
91 MPbk2ContactEditorControl& aEditorControl ) : |
|
92 iContactManager( aContactManager ), |
|
93 iContact( aContact ), |
|
94 iEditorControl( aEditorControl ) |
|
95 { |
|
96 } |
|
97 |
|
98 // -------------------------------------------------------------------------- |
|
99 // CPmapContactEditorExtension::~CPmapContactEditorExtension |
|
100 // -------------------------------------------------------------------------- |
|
101 // |
|
102 CPmapContactEditorExtension::~CPmapContactEditorExtension() |
|
103 { |
|
104 if(iCmd) |
|
105 { |
|
106 delete iCmd; |
|
107 iCmd = NULL; |
|
108 } |
|
109 } |
|
110 |
|
111 // -------------------------------------------------------------------------- |
|
112 // CPmapContactEditorExtension::ConstructL |
|
113 // -------------------------------------------------------------------------- |
|
114 // |
|
115 inline void CPmapContactEditorExtension::ConstructL() |
|
116 { |
|
117 } |
|
118 |
|
119 // -------------------------------------------------------------------------- |
|
120 // CPmapContactEditorExtension::NewL |
|
121 // -------------------------------------------------------------------------- |
|
122 // |
|
123 CPmapContactEditorExtension* CPmapContactEditorExtension::NewL |
|
124 ( CVPbkContactManager& aContactManager, |
|
125 MVPbkStoreContact& aContact, |
|
126 MPbk2ContactEditorControl& aEditorControl ) |
|
127 { |
|
128 CPmapContactEditorExtension* self = |
|
129 new (ELeave) CPmapContactEditorExtension |
|
130 (aContactManager, aContact, aEditorControl); |
|
131 CleanupStack::PushL(self); |
|
132 self->ConstructL(); |
|
133 CleanupStack::Pop(self); |
|
134 return self; |
|
135 } |
|
136 |
|
137 // -------------------------------------------------------------------------- |
|
138 // CPmapContactEditorExtension::CreateEditorFieldL |
|
139 // -------------------------------------------------------------------------- |
|
140 // |
|
141 MPbk2ContactEditorField* CPmapContactEditorExtension::CreateEditorFieldL |
|
142 ( MVPbkStoreContactField& /*aField*/, |
|
143 const MPbk2FieldProperty& /*aFieldProperty*/, |
|
144 MPbk2ContactEditorUiBuilder& /*aUiBuilder*/, |
|
145 CPbk2IconInfoContainer& /*aIconInfoContainer*/ ) |
|
146 { |
|
147 MPbk2ContactEditorField* field = NULL; |
|
148 return field; |
|
149 } |
|
150 |
|
151 // -------------------------------------------------------------------------- |
|
152 // CPmapContactEditorExtension::DynInitMenuPaneL |
|
153 // -------------------------------------------------------------------------- |
|
154 // |
|
155 void CPmapContactEditorExtension::DynInitMenuPaneL |
|
156 ( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
157 { |
|
158 if ( aResourceId == R_PBK2_CONTACTEDITOR_MENUPANE ) |
|
159 { |
|
160 if ( CPmapCmd::CheckViewProviderL() ) |
|
161 { |
|
162 aMenuPane->SetItemDimmed( EPbk2ExtensionAssignFromMap, EFalse ); |
|
163 } |
|
164 } |
|
165 } |
|
166 |
|
167 // -------------------------------------------------------------------------- |
|
168 // CPmapContactEditorExtension::ProcessCommandL |
|
169 // -------------------------------------------------------------------------- |
|
170 // |
|
171 TBool CPmapContactEditorExtension::ProcessCommandL |
|
172 ( TInt aCommandId ) |
|
173 { |
|
174 switch( aCommandId ) |
|
175 { |
|
176 case EPbk2ExtensionShowOnMap: |
|
177 { |
|
178 if(iCmd) |
|
179 { |
|
180 delete iCmd; |
|
181 iCmd = NULL; |
|
182 } |
|
183 iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); |
|
184 // Execute the command |
|
185 iCmd->ExecuteLD(); |
|
186 return ETrue; |
|
187 } |
|
188 case EPbk2ExtensionAssignFromMap: |
|
189 { |
|
190 if(iCmd) |
|
191 { |
|
192 delete iCmd; |
|
193 iCmd = NULL; |
|
194 } |
|
195 iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); |
|
196 // Execute the command |
|
197 iCmd->ExecuteLD(); |
|
198 return ETrue; |
|
199 } |
|
200 default: |
|
201 { |
|
202 // Do nothing |
|
203 break; |
|
204 } |
|
205 } |
|
206 return EFalse; |
|
207 } |
|
208 |
|
209 // -------------------------------------------------------------------------- |
|
210 // CPmapContactEditorExtension::OkToDeleteContactL |
|
211 // -------------------------------------------------------------------------- |
|
212 // |
|
213 TBool CPmapContactEditorExtension::OkToDeleteContactL |
|
214 ( MPbk2ContactEditorEventObserver::TParams& /*aParams*/ ) |
|
215 { |
|
216 return ETrue; |
|
217 } |
|
218 |
|
219 // -------------------------------------------------------------------------- |
|
220 // CPmapContactEditorExtension::OkToSaveContactL |
|
221 // -------------------------------------------------------------------------- |
|
222 // |
|
223 TBool CPmapContactEditorExtension::OkToSaveContactL |
|
224 ( MPbk2ContactEditorEventObserver::TParams& /*aParams*/ ) |
|
225 { |
|
226 return ETrue; |
|
227 } |
|
228 |
|
229 // -------------------------------------------------------------------------- |
|
230 // CPmapContactEditorExtension::ModifyButtonGroupContainerL |
|
231 // -------------------------------------------------------------------------- |
|
232 // |
|
233 void CPmapContactEditorExtension::ModifyButtonGroupContainerL |
|
234 ( CEikButtonGroupContainer& /*aButtonGroupContainer*/ ) |
|
235 { |
|
236 } |
|
237 |
|
238 // -------------------------------------------------------------------------- |
|
239 // CPmapContactEditorExtension::DoRelease |
|
240 // -------------------------------------------------------------------------- |
|
241 // |
|
242 void CPmapContactEditorExtension::DoRelease() |
|
243 { |
|
244 delete this; |
|
245 } |
|
246 |
|
247 // -------------------------------------------------------------------------- |
|
248 // CPmapContactEditorExtension::ContactEditorOperationCompleted |
|
249 // -------------------------------------------------------------------------- |
|
250 // |
|
251 void CPmapContactEditorExtension::ContactEditorOperationCompleted |
|
252 ( MVPbkContactObserver::TContactOpResult /*aResult*/, |
|
253 TParams /*aParams*/ ) |
|
254 { |
|
255 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
256 ("CPmapContactEditorExtension::ContactEditorOperationCompleted")); |
|
257 |
|
258 // Do nothing |
|
259 } |
|
260 |
|
261 // -------------------------------------------------------------------------- |
|
262 // CPmapContactEditorExtension::ContactEditorOperationFailed |
|
263 // -------------------------------------------------------------------------- |
|
264 // |
|
265 void CPmapContactEditorExtension::ContactEditorOperationFailed |
|
266 ( MVPbkContactObserver::TContactOp /*aOpCode*/, |
|
267 TInt aErrorCode, TParams /*aParams*/, TFailParams& /*aFailParams*/ ) |
|
268 { |
|
269 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
270 ("CPmapContactEditorExtension::ContactEditorOperationFailed code: %d"), |
|
271 aErrorCode); |
|
272 } |
|
273 |
|
274 // -------------------------------------------------------------------------- |
|
275 // CPmapContactEditorExtension::ContactEditorExtensionExtension |
|
276 // -------------------------------------------------------------------------- |
|
277 // |
|
278 TAny* CPmapContactEditorExtension::ContactEditorExtensionExtension( |
|
279 TUid /*aExtensionUid*/ ) |
|
280 { |
|
281 return static_cast<MPbk2ContactEditorExtensionExtension*>(this); |
|
282 } |
|
283 |
|
284 // -------------------------------------------------------------------------- |
|
285 // CPmapContactEditorExtension::CreateFieldL |
|
286 // -------------------------------------------------------------------------- |
|
287 // |
|
288 MPbk2ContactEditorUIField* CPmapContactEditorExtension::CreateFieldLC |
|
289 ( MPbk2UIField& aField, |
|
290 TInt aCustomPosition, |
|
291 MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
292 const TDesC& /*aCustomText*/, CPbk2IconInfoContainer& aIconInfoContainer ) |
|
293 { |
|
294 MPbk2ContactEditorUIField* field = NULL; |
|
295 |
|
296 switch(aField.CtrlType()) |
|
297 { |
|
298 case EPbk2FieldCtrlTypeExtAssignFromMapsEditor: |
|
299 if( CPmapCmd::CheckViewProviderL() ) |
|
300 { |
|
301 field = CPbk2ContactEditorUIAFMField::NewL( |
|
302 &aField, aUiBuilder, aIconInfoContainer, aCustomPosition); |
|
303 CleanupStack::PushL(field); |
|
304 } |
|
305 break; |
|
306 } |
|
307 |
|
308 return field; |
|
309 } |
|
310 // End of File |