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