|
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: Execute Maps application. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDES |
|
19 #include "cpmapcmd.h" |
|
20 |
|
21 // Phonebook 2 |
|
22 #include <MPbk2ContactUiControl.h> |
|
23 #include <MPbk2CommandObserver.h> |
|
24 #include <MPbk2CommandHandler.h> |
|
25 #include <MPbk2ApplicationServices.h> |
|
26 #include <MPbk2AppUi.h> |
|
27 #include <CPbk2FieldPropertyArray.h> |
|
28 #include <Pbk2MapUIRes.rsg> |
|
29 #include <MPbk2ContactEditorControl.h> |
|
30 #include <MPbk2ContactEditorField.h> |
|
31 #include <Pbk2UIControls.hrh> |
|
32 #include <Pbk2Commands.hrh> |
|
33 #include <Pbk2UIControls.rsg> |
|
34 #include <TPbk2AddressSelectParams.h> |
|
35 #include <CPbk2AddressSelect.h> |
|
36 #include <Pbk2AddressTools.h> |
|
37 #include <Pbk2UIControls.rsg> |
|
38 #include <CPbk2ApplicationServices.h> |
|
39 #include <pbk2mapcommands.hrh> |
|
40 |
|
41 // Virtual Phonebook |
|
42 #include <MVPbkBaseContactField.h> |
|
43 #include <MVPbkStoreContact.h> |
|
44 #include <MVPbkContactAttributeManager.h> |
|
45 #include <CVPbkVoiceTagAttribute.h> |
|
46 #include <CVPbkContactManager.h> |
|
47 #include <CVPbkFieldTypeSelector.h> |
|
48 #include <CVPbkFieldFilter.h> |
|
49 #include <MVPbkStoreContactField.h> |
|
50 #include <MVPbkContactFieldData.h> |
|
51 #include <MVPbkContactFieldTextData.h> |
|
52 #include <VPbkEng.rsg> |
|
53 #include <MVPbkFieldType.h> |
|
54 #include <TVPbkFieldVersitProperty.h> |
|
55 #include <MVPbkStoreContactFieldCollection.h> |
|
56 #include <TVPbkFieldTypeParameters.h> |
|
57 #include "MPbk2ContactEditorControlExtension.h" |
|
58 #include <MVPbkContactStoreProperties.h> |
|
59 #include <MVPbkContactStore.h> |
|
60 #include <MVPbkBaseContact.h> |
|
61 #include <MVPbkViewContact.h> |
|
62 #include <MPbk2FieldProperty.h> |
|
63 |
|
64 |
|
65 |
|
66 // System includes |
|
67 #include <lbsposition.h> |
|
68 #include <AiwServiceHandler.h> |
|
69 #include <mnaiwservices.h> |
|
70 #include <mnmapview.h> |
|
71 #include <mnproviderfinder.h> |
|
72 #include <mngeocoder.h> |
|
73 #include <EPos_CPosLandmark.h> |
|
74 #include <epos_poslandmarkserialization.h> |
|
75 #include <eikclb.h> |
|
76 #include <aknPopup.h> |
|
77 #include <eiktxlbm.h> |
|
78 #include <aknnotewrappers.h> |
|
79 #include <coemain.h> |
|
80 #include <barsread.h> |
|
81 #include <avkon.rsg> |
|
82 #include <StringLoader.h> |
|
83 |
|
84 // Debugging headers |
|
85 #include <Pbk2Debug.h> |
|
86 |
|
87 _LIT( KGeoSeparator, ","); |
|
88 const TInt KGeoSeparatorLength = 1; |
|
89 const TReal32 KGeoHorizontalAccuracy = 0; |
|
90 const TInt KGeoMaxSize = 60; |
|
91 const TInt KGeoFormatWidth = 11; |
|
92 |
|
93 // -------------------------------------------------------------------------- |
|
94 // CPmapCmd::CPmapCmd |
|
95 // -------------------------------------------------------------------------- |
|
96 // |
|
97 CPmapCmd::CPmapCmd( MPbk2ContactEditorControl& aEditorControl, |
|
98 MVPbkStoreContact& aContact, TInt aCommandId ) : |
|
99 CActive( CActive::EPriorityStandard ), |
|
100 iEditorControl( &aEditorControl ), |
|
101 iContact( &aContact ), |
|
102 iCommandId( aCommandId ) |
|
103 { |
|
104 CActiveScheduler::Add( this ); |
|
105 iAddressUpdatePrompt = ETrue; |
|
106 iCurrentMapLaunchedByState = EMapNone; |
|
107 } |
|
108 |
|
109 // -------------------------------------------------------------------------- |
|
110 // CPmapCmd::CPmapCmd |
|
111 // -------------------------------------------------------------------------- |
|
112 // |
|
113 CPmapCmd::CPmapCmd( MPbk2ContactUiControl& aUiControl, TInt aCommandId ) : |
|
114 CActive( CActive::EPriorityStandard ), |
|
115 iUiControl( &aUiControl ), |
|
116 iCommandId( aCommandId ) |
|
117 { |
|
118 CActiveScheduler::Add( this ); |
|
119 iAddressUpdatePrompt = ETrue; |
|
120 iCurrentMapLaunchedByState = EMapNone; |
|
121 } |
|
122 |
|
123 // -------------------------------------------------------------------------- |
|
124 // CPmapCmd::~CPmapCmd |
|
125 // -------------------------------------------------------------------------- |
|
126 // |
|
127 CPmapCmd::~CPmapCmd() |
|
128 { |
|
129 Cancel(); |
|
130 if(iMapView) |
|
131 { |
|
132 iMapView->ResetLandmarksToShow(); |
|
133 delete iMapView; |
|
134 iMapView = NULL; |
|
135 } |
|
136 ReleaseLandmarkResources(); |
|
137 if( iUiControl ) |
|
138 { |
|
139 iUiControl->RegisterCommand( NULL ); |
|
140 } |
|
141 delete iMapViewProvider; |
|
142 } |
|
143 |
|
144 // -------------------------------------------------------------------------- |
|
145 // CPmapCmd::NewL |
|
146 // -------------------------------------------------------------------------- |
|
147 // |
|
148 CPmapCmd* CPmapCmd::NewL |
|
149 ( MPbk2ContactEditorControl& aEditorControl, |
|
150 MVPbkStoreContact& aContact, TInt aCommandId ) |
|
151 { |
|
152 CPmapCmd* self = new ( ELeave ) CPmapCmd |
|
153 ( aEditorControl, aContact, aCommandId ); |
|
154 CleanupStack::PushL( self ); |
|
155 self->ConstructL(); |
|
156 CleanupStack::Pop( self ); |
|
157 return self; |
|
158 } |
|
159 |
|
160 // -------------------------------------------------------------------------- |
|
161 // CPmapCmd::NewL |
|
162 // -------------------------------------------------------------------------- |
|
163 // |
|
164 CPmapCmd* CPmapCmd::NewL |
|
165 ( MPbk2ContactUiControl& aUiControl, TInt aCommandId ) |
|
166 { |
|
167 CPmapCmd* self = new ( ELeave ) CPmapCmd |
|
168 ( aUiControl, aCommandId ); |
|
169 CleanupStack::PushL( self ); |
|
170 self->ConstructL(); |
|
171 CleanupStack::Pop( self ); |
|
172 return self; |
|
173 } |
|
174 |
|
175 // -------------------------------------------------------------------------- |
|
176 // CPmapCmd::ConstructL |
|
177 // -------------------------------------------------------------------------- |
|
178 // |
|
179 void CPmapCmd::ConstructL() |
|
180 { |
|
181 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
182 ("CPmapCmd::ConstructL")); |
|
183 |
|
184 RPointerArray<CMnProvider> providers; |
|
185 |
|
186 MnProviderFinder::FindProvidersL( providers, CMnProvider::EServiceMapView ); |
|
187 CleanupClosePushL( providers ); |
|
188 if (providers.Count() > 0) |
|
189 { |
|
190 iMapViewProvider = providers[0]; |
|
191 providers.Remove(0); |
|
192 } |
|
193 |
|
194 providers.ResetAndDestroy(); |
|
195 CleanupStack::PopAndDestroy( &providers ); |
|
196 |
|
197 if ( !iMapViewProvider ) |
|
198 { |
|
199 User::Leave( KErrNotSupported ); |
|
200 } |
|
201 |
|
202 if( iUiControl && ! iContact ) |
|
203 { |
|
204 iContact = const_cast<MVPbkStoreContact*>(iUiControl->FocusedStoreContact()); |
|
205 if( !iContact ) |
|
206 { |
|
207 iUiControl->RegisterCommand( this ); |
|
208 const MVPbkViewContact* viewContact = iUiControl->FocusedViewContactL(); |
|
209 if( viewContact ) |
|
210 { |
|
211 viewContact->ReadL(*this); |
|
212 CActiveScheduler::Start(); |
|
213 } |
|
214 } |
|
215 } |
|
216 |
|
217 User::LeaveIfNull(iContact); |
|
218 |
|
219 |
|
220 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
221 ("CPmapCmd::ConstructL end")); |
|
222 } |
|
223 |
|
224 // -------------------------------------------------------------------------- |
|
225 // CPmapCmd::CheckViewProviderL |
|
226 // -------------------------------------------------------------------------- |
|
227 // |
|
228 TBool CPmapCmd::CheckViewProviderL() |
|
229 { |
|
230 TBool ret = EFalse; |
|
231 RPointerArray<CMnProvider> providers; |
|
232 |
|
233 MnProviderFinder::FindProvidersL( providers, CMnProvider::EServiceMapView ); |
|
234 |
|
235 CleanupClosePushL(providers); |
|
236 |
|
237 if ( providers.Count() > 0 ) |
|
238 { |
|
239 ret = ETrue; |
|
240 } |
|
241 |
|
242 providers.ResetAndDestroy(); |
|
243 CleanupStack::PopAndDestroy( &providers ); |
|
244 return ret; |
|
245 } |
|
246 |
|
247 void CPmapCmd::ExecuteLD() |
|
248 { |
|
249 ExecuteL(); |
|
250 } |
|
251 |
|
252 // -------------------------------------------------------------------------- |
|
253 // CPmapCmd::ExecuteLD |
|
254 // -------------------------------------------------------------------------- |
|
255 // |
|
256 void CPmapCmd::ExecuteL() |
|
257 { |
|
258 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
259 ("CPmapCmd::ExecuteLD")); |
|
260 |
|
261 iAddressUpdatePrompt = ETrue; |
|
262 TPbk2FieldGroupId groupId = EPbk2FieldGroupIdNone; |
|
263 if( !IsAddressInContact() ) |
|
264 { |
|
265 if( iCommandId == EPbk2ExtensionShowOnMap ) |
|
266 { |
|
267 HBufC* prompt = StringLoader::LoadLC( R_QTN_PHOB_NO_ADDRESS_DEFINE_NEW ); |
|
268 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
269 if( dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) |
|
270 { |
|
271 CleanupStack::PopAndDestroy( prompt ); |
|
272 groupId = EPbk2FieldGroupIdPostalAddress; |
|
273 iCommandId = EPbk2ExtensionAssignFromMap; |
|
274 } |
|
275 else |
|
276 { |
|
277 CleanupStack::PopAndDestroy( prompt ); |
|
278 FinishProcess(); |
|
279 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
280 ("CPmapCmd::ExecuteLD end")); |
|
281 |
|
282 return; |
|
283 } |
|
284 |
|
285 } |
|
286 else |
|
287 { |
|
288 groupId = EPbk2FieldGroupIdPostalAddress; |
|
289 } |
|
290 iAddressUpdatePrompt = EFalse; |
|
291 } |
|
292 |
|
293 if( groupId == EPbk2FieldGroupIdNone ) |
|
294 { |
|
295 groupId = GetAddressFromEditorView(); |
|
296 } |
|
297 |
|
298 if( groupId == EPbk2FieldGroupIdNone ) |
|
299 { |
|
300 groupId = GetAddressFromUiControl(); |
|
301 } |
|
302 |
|
303 if( groupId == EPbk2FieldGroupIdNone ) |
|
304 { |
|
305 groupId = GetAddressIfIsAlone(); |
|
306 } |
|
307 |
|
308 if( groupId == EPbk2FieldGroupIdNone ) |
|
309 { |
|
310 groupId = SelectAddressL(); |
|
311 } |
|
312 |
|
313 if( groupId != EPbk2FieldGroupIdNone ) |
|
314 { |
|
315 TVPbkFieldTypeParameter addressType = Pbk2AddressTools::MapAddressToVersitParam( groupId ); |
|
316 if( iCommandId == EPbk2ExtensionShowOnMap ) |
|
317 { |
|
318 EditorShowOnMapsL(addressType); |
|
319 return; // as the asynchronous request is processed next part will be executed inside RunL of this class. |
|
320 } |
|
321 else if( iCommandId == EPbk2ExtensionAssignFromMap ) |
|
322 { |
|
323 EditorAssignFromMapsL(addressType); |
|
324 return; // as the asynchronous request is processed next part will be executed inside RunL of this class. |
|
325 } |
|
326 } |
|
327 |
|
328 FinishProcess(); |
|
329 |
|
330 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
331 ("CPmapCmd::ExecuteLD end")); |
|
332 } |
|
333 |
|
334 // -------------------------------------------------------------------------- |
|
335 // CPmapCmd::GetAddressIfIsAlone |
|
336 // -------------------------------------------------------------------------- |
|
337 // |
|
338 TPbk2FieldGroupId CPmapCmd::GetAddressIfIsAlone() |
|
339 { |
|
340 TPbk2FieldGroupId grupId = EPbk2FieldGroupIdNone; |
|
341 MVPbkStoreContactFieldCollection& arrFields = iContact->Fields(); |
|
342 TInt count = arrFields.FieldCount(); |
|
343 for( TInt idx = 0; idx < count; idx++) |
|
344 { |
|
345 MVPbkStoreContactField& field = arrFields.FieldAt(idx); |
|
346 const MVPbkFieldType* type = field.BestMatchingFieldType(); |
|
347 if ( type ) |
|
348 { |
|
349 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties(); |
|
350 for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ ) |
|
351 { |
|
352 if ( arrProp[idx2].Name() == EVPbkVersitNameADR ) |
|
353 { |
|
354 if ( arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME ) ) |
|
355 { |
|
356 if ( grupId == EPbk2FieldGroupIdNone ) |
|
357 { |
|
358 grupId = EPbk2FieldGroupIdHomeAddress; |
|
359 } |
|
360 else if ( grupId != EPbk2FieldGroupIdHomeAddress ) |
|
361 { |
|
362 return EPbk2FieldGroupIdNone; |
|
363 } |
|
364 } |
|
365 else if ( arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ) ) |
|
366 { |
|
367 if ( grupId == EPbk2FieldGroupIdNone ) |
|
368 { |
|
369 grupId = EPbk2FieldGroupIdCompanyAddress; |
|
370 } |
|
371 else if ( grupId != EPbk2FieldGroupIdCompanyAddress ) |
|
372 { |
|
373 return EPbk2FieldGroupIdNone; |
|
374 } |
|
375 } |
|
376 else |
|
377 { |
|
378 if ( grupId == EPbk2FieldGroupIdNone ) |
|
379 { |
|
380 grupId = EPbk2FieldGroupIdPostalAddress; |
|
381 } |
|
382 else if ( grupId != EPbk2FieldGroupIdPostalAddress ) |
|
383 { |
|
384 return EPbk2FieldGroupIdNone; |
|
385 } |
|
386 } |
|
387 } |
|
388 } |
|
389 } |
|
390 } |
|
391 |
|
392 return grupId; |
|
393 } |
|
394 |
|
395 // -------------------------------------------------------------------------- |
|
396 // CPmapCmd::GetAddressFromEditorView |
|
397 // -------------------------------------------------------------------------- |
|
398 // |
|
399 TPbk2FieldGroupId CPmapCmd::GetAddressFromEditorView() |
|
400 { |
|
401 TPbk2FieldGroupId grupId = EPbk2FieldGroupIdNone; |
|
402 if( ControlExtension() ) |
|
403 { |
|
404 grupId = Pbk2AddressTools::MapCtrlTypeToAddress( ControlExtension()->FocusedControlType() ); |
|
405 } |
|
406 |
|
407 if( iEditorControl && grupId == EPbk2FieldGroupIdNone ) |
|
408 { |
|
409 TInt countControls = iEditorControl->NumberOfControls(); |
|
410 for ( TInt idx = 0; idx < countControls; idx++ ) |
|
411 { |
|
412 MPbk2ContactEditorField& field = iEditorControl->EditorField( idx ); |
|
413 |
|
414 grupId = field.FieldProperty().GroupId(); |
|
415 if( grupId == EPbk2FieldGroupIdPostalAddress || |
|
416 grupId == EPbk2FieldGroupIdHomeAddress || |
|
417 grupId == EPbk2FieldGroupIdCompanyAddress ) |
|
418 { |
|
419 iAddressView = ETrue; |
|
420 break; |
|
421 } |
|
422 } |
|
423 } |
|
424 |
|
425 return grupId; |
|
426 } |
|
427 |
|
428 // -------------------------------------------------------------------------- |
|
429 // CPmapCmd::GetAddressFromUiControl |
|
430 // -------------------------------------------------------------------------- |
|
431 // |
|
432 TPbk2FieldGroupId CPmapCmd::GetAddressFromUiControl() |
|
433 { |
|
434 TPbk2FieldGroupId ret = EPbk2FieldGroupIdNone; |
|
435 const MVPbkBaseContactField* field = NULL; |
|
436 if( iUiControl ) |
|
437 { |
|
438 field = iUiControl->FocusedField(); |
|
439 } |
|
440 if( field ) |
|
441 { |
|
442 const MVPbkFieldType* type = field->BestMatchingFieldType(); |
|
443 if( type ) |
|
444 { |
|
445 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties(); |
|
446 for( TInt idx = 0; idx < arrProp.Count(); idx++) |
|
447 { |
|
448 if( arrProp[idx].Name() != EVPbkVersitNameADR ) |
|
449 { |
|
450 continue; |
|
451 } |
|
452 |
|
453 if( arrProp[idx].Parameters().Contains( |
|
454 Pbk2AddressTools::MapAddressToVersitParam( EPbk2FieldGroupIdHomeAddress ) ) ) |
|
455 { |
|
456 ret = EPbk2FieldGroupIdHomeAddress; |
|
457 break; |
|
458 } |
|
459 else if( arrProp[idx].Parameters().Contains( |
|
460 Pbk2AddressTools::MapAddressToVersitParam( EPbk2FieldGroupIdCompanyAddress ) ) ) |
|
461 { |
|
462 ret = EPbk2FieldGroupIdCompanyAddress; |
|
463 break; |
|
464 } |
|
465 else |
|
466 { |
|
467 ret = EPbk2FieldGroupIdPostalAddress; |
|
468 break; |
|
469 } |
|
470 } |
|
471 } |
|
472 } |
|
473 |
|
474 return ret; |
|
475 } |
|
476 |
|
477 // -------------------------------------------------------------------------- |
|
478 // CPmapCmd::SelectAddressL |
|
479 // -------------------------------------------------------------------------- |
|
480 // |
|
481 TPbk2FieldGroupId CPmapCmd::SelectAddressL() |
|
482 { |
|
483 TPbk2FieldGroupId ret = EPbk2FieldGroupIdNone; |
|
484 |
|
485 TResourceReader resReader; |
|
486 CCoeEnv::Static()->CreateResourceReaderLC |
|
487 (resReader, R_PBK2_ADDRESS_SELECT); |
|
488 |
|
489 CPbk2ApplicationServices* appServices = |
|
490 CPbk2ApplicationServices::InstanceLC(); |
|
491 |
|
492 TPbk2AddressSelectParams params( |
|
493 *iContact, |
|
494 appServices->ContactManager(), |
|
495 appServices->NameFormatter(), |
|
496 appServices->FieldProperties(), |
|
497 resReader ); |
|
498 if ( iCommandId == EPbk2ExtensionShowOnMap ) |
|
499 { |
|
500 params.iCommMethod = VPbkFieldTypeSelectorFactory::EFindOnMapSelector; |
|
501 } |
|
502 else |
|
503 { |
|
504 params.iCommMethod = VPbkFieldTypeSelectorFactory::EAssignFromMapSelector; |
|
505 } |
|
506 |
|
507 CleanupStack::PopAndDestroy( appServices ); |
|
508 CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( params ); |
|
509 MVPbkStoreContactField* selectedField = addressSelect->ExecuteLD(); |
|
510 CleanupStack::PopAndDestroy(); // resReader |
|
511 |
|
512 if ( selectedField ) |
|
513 { |
|
514 CleanupDeletePushL( selectedField ); |
|
515 ret = GetFieldGroupL( *selectedField ); |
|
516 CleanupStack::PopAndDestroy( selectedField ); |
|
517 } |
|
518 |
|
519 return ret; |
|
520 } |
|
521 |
|
522 // -------------------------------------------------------------------------- |
|
523 // CPmapCmd::ControlExtension |
|
524 // -------------------------------------------------------------------------- |
|
525 // |
|
526 MPbk2ContactEditorControlExtension* CPmapCmd::ControlExtension() |
|
527 { |
|
528 if(iEditorControl && iEditorControl->ContactEditorControlExtension(TUid::Null())) |
|
529 { |
|
530 return static_cast<MPbk2ContactEditorControlExtension*> |
|
531 (iEditorControl->ContactEditorControlExtension(TUid::Null())); |
|
532 } |
|
533 return NULL; |
|
534 } |
|
535 |
|
536 // -------------------------------------------------------------------------- |
|
537 // CPmapCmd::AddObserver |
|
538 // -------------------------------------------------------------------------- |
|
539 // |
|
540 void CPmapCmd::AddObserver( MPbk2CommandObserver& aObserver ) |
|
541 { |
|
542 iObserver = &aObserver; |
|
543 } |
|
544 |
|
545 // -------------------------------------------------------------------------- |
|
546 // CPmapCmd::ResetUiControl |
|
547 // -------------------------------------------------------------------------- |
|
548 // |
|
549 void CPmapCmd::ResetUiControl( MPbk2ContactUiControl& aUiControl ) |
|
550 { |
|
551 if (iUiControl == &aUiControl) |
|
552 { |
|
553 iUiControl = NULL; |
|
554 } |
|
555 } |
|
556 |
|
557 // -------------------------------------------------------------------------- |
|
558 // CPmapCmd::FinishProcess |
|
559 // -------------------------------------------------------------------------- |
|
560 // |
|
561 void CPmapCmd::FinishProcess() |
|
562 { |
|
563 if (iObserver) |
|
564 { |
|
565 iObserver->CommandFinished( *this ); |
|
566 } |
|
567 } |
|
568 |
|
569 // -------------------------------------------------------------------------- |
|
570 // CPmapCmd::EditorShowMapL |
|
571 // -------------------------------------------------------------------------- |
|
572 // |
|
573 void CPmapCmd::EditorShowOnMapsL( TVPbkFieldTypeParameter aAddressType ) |
|
574 { |
|
575 iAddressType = aAddressType; |
|
576 |
|
577 RPointerArray<CPosLandmark> landmarks; |
|
578 CleanupClosePushL( landmarks ); |
|
579 |
|
580 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
581 CleanupStack::PushL( landmark ); |
|
582 |
|
583 FillGeoLandmarkL( *landmark, aAddressType ); |
|
584 FillLandmarkL( *landmark, aAddressType ); |
|
585 SetLandmarkNameL(*landmark); |
|
586 |
|
587 TLocality locality; |
|
588 if ( landmark->NumOfAvailablePositionFields() > 0 |
|
589 || landmark->GetPosition( locality ) == KErrNone ) |
|
590 { |
|
591 landmarks.AppendL( landmark ); |
|
592 } |
|
593 |
|
594 if ( landmark->GetPosition( locality ) == KErrNone ) |
|
595 { |
|
596 if(iMapView) |
|
597 { |
|
598 delete iMapView; |
|
599 iMapView = NULL; |
|
600 } |
|
601 iMapView = CMnMapView::NewL( *iMapViewProvider ); |
|
602 iMapView->AddLandmarksToShowL( landmarks ); |
|
603 iMapView->ShowMapL(); |
|
604 CleanupStack::PopAndDestroy( landmark ); |
|
605 CleanupStack::PopAndDestroy( &landmarks ); |
|
606 delete iMapView; |
|
607 iMapView = NULL; |
|
608 FinishProcess(); |
|
609 } |
|
610 else |
|
611 { |
|
612 if(iMapView) |
|
613 { |
|
614 delete iMapView; |
|
615 iMapView = NULL; |
|
616 } |
|
617 iMapView = CMnMapView::NewChainedL( *iMapViewProvider ); |
|
618 iMapView->AddLandmarksToShowL( landmarks ); |
|
619 iMapView->SelectFromMapL( iStatus ); |
|
620 iCurrentMapLaunchedByState = EMapShowOnMaps; |
|
621 SetActive(); |
|
622 CleanupStack::PopAndDestroy( landmark ); |
|
623 CleanupStack::PopAndDestroy( &landmarks ); |
|
624 } |
|
625 } |
|
626 |
|
627 // -------------------------------------------------------------------------- |
|
628 // CPmapCmd::FillLandmarkL |
|
629 // -------------------------------------------------------------------------- |
|
630 // |
|
631 void CPmapCmd::FillLandmarkL(CPosLandmark& aLandmark, TVPbkFieldTypeParameter aAddressType) |
|
632 { |
|
633 if( iAddressView && iEditorControl ) |
|
634 { |
|
635 TInt count = iEditorControl->NumberOfControls(); |
|
636 for( TInt idx1 = 0; idx1 < count; idx1++) |
|
637 { |
|
638 MPbk2ContactEditorField& field = iEditorControl->EditorField(idx1); |
|
639 HBufC* uiData = field.ControlTextL(); |
|
640 if( !uiData || !uiData->Length() ) |
|
641 continue; |
|
642 |
|
643 CleanupStack::PushL(uiData); |
|
644 TArray<TVPbkFieldVersitProperty> arrProp = field.FieldProperty().FieldType().VersitProperties(); |
|
645 for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++) |
|
646 { |
|
647 if( arrProp[idx2].Name() == EVPbkVersitNameADR ) |
|
648 { |
|
649 |
|
650 if( arrProp[idx2].SubField() == EVPbkVersitSubFieldCountry ) |
|
651 { |
|
652 aLandmark.SetPositionFieldL( EPositionFieldCountry, uiData->Des() ); |
|
653 continue; |
|
654 } |
|
655 else if( arrProp[idx2].SubField() == EVPbkVersitSubFieldLocality ) |
|
656 { |
|
657 aLandmark.SetPositionFieldL( EPositionFieldCity, uiData->Des() ); |
|
658 continue; |
|
659 } |
|
660 else if( arrProp[idx2].SubField() == EVPbkVersitSubFieldStreet ) |
|
661 { |
|
662 aLandmark.SetPositionFieldL( EPositionFieldStreet, uiData->Des() ); |
|
663 continue; |
|
664 } |
|
665 else if( arrProp[idx2].SubField() == EVPbkVersitSubFieldPostalCode ) |
|
666 { |
|
667 aLandmark.SetPositionFieldL( EPositionFieldPostalCode, uiData->Des() ); |
|
668 continue; |
|
669 } |
|
670 } |
|
671 } |
|
672 CleanupStack::PopAndDestroy(uiData); |
|
673 } |
|
674 } |
|
675 else |
|
676 { |
|
677 MVPbkStoreContactFieldCollection& arrFields = iContact->Fields(); |
|
678 TInt count = arrFields.FieldCount(); |
|
679 for( TInt idx = 0; idx < count; idx++) |
|
680 { |
|
681 MVPbkStoreContactField& field = arrFields.FieldAt(idx); |
|
682 const MVPbkContactFieldData& fieldData = field.FieldData(); |
|
683 if( fieldData.DataType() != EVPbkFieldStorageTypeText ) |
|
684 { |
|
685 continue; |
|
686 } |
|
687 const TDesC& dataText = MVPbkContactFieldTextData::Cast( fieldData ).Text(); |
|
688 |
|
689 if( !dataText.Length() ) |
|
690 { |
|
691 continue; |
|
692 } |
|
693 const MVPbkFieldType* type = field.BestMatchingFieldType(); |
|
694 if ( type ) |
|
695 { |
|
696 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties(); |
|
697 for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ ) |
|
698 { |
|
699 if ( arrProp[idx2].Name() == EVPbkVersitNameADR |
|
700 && (arrProp[idx2].Parameters().Contains( aAddressType ) |
|
701 || (aAddressType == EVPbkVersitParamPREF |
|
702 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME ) |
|
703 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ))) ) |
|
704 { |
|
705 if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldCountry ) |
|
706 { |
|
707 aLandmark.SetPositionFieldL( EPositionFieldCountry, dataText ); |
|
708 continue; |
|
709 } |
|
710 else if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldLocality ) |
|
711 { |
|
712 aLandmark.SetPositionFieldL( EPositionFieldCity, dataText ); |
|
713 continue; |
|
714 } |
|
715 else if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldStreet ) |
|
716 { |
|
717 aLandmark.SetPositionFieldL( EPositionFieldStreet, dataText ); |
|
718 continue; |
|
719 } |
|
720 else if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldPostalCode ) |
|
721 { |
|
722 aLandmark.SetPositionFieldL( EPositionFieldPostalCode, dataText ); |
|
723 continue; |
|
724 } |
|
725 } |
|
726 } |
|
727 } |
|
728 } |
|
729 } |
|
730 } |
|
731 |
|
732 void CPmapCmd::SetLandmarkNameL(CPosLandmark& aLandmark) |
|
733 { |
|
734 _LIT(KComma, ","); |
|
735 _LIT(KSpace, " "); |
|
736 |
|
737 TInt length = 0; |
|
738 TPtrC street; |
|
739 if( aLandmark.IsPositionFieldAvailable( EPositionFieldStreet ) ) |
|
740 { |
|
741 aLandmark.GetPositionField( EPositionFieldStreet, street ); |
|
742 length += street.Length(); |
|
743 } |
|
744 |
|
745 TPtrC city; |
|
746 if( aLandmark.IsPositionFieldAvailable( EPositionFieldCity ) ) |
|
747 { |
|
748 aLandmark.GetPositionField( EPositionFieldCity, city ); |
|
749 if( length ) |
|
750 { |
|
751 length += KComma().Length() + KSpace().Length(); |
|
752 } |
|
753 length += city.Length(); |
|
754 } |
|
755 |
|
756 TPtrC country; |
|
757 if( aLandmark.IsPositionFieldAvailable( EPositionFieldCountry ) ) |
|
758 { |
|
759 aLandmark.GetPositionField( EPositionFieldCountry, country ); |
|
760 if( length ) |
|
761 { |
|
762 length += KComma().Length() + KSpace().Length(); |
|
763 } |
|
764 length += country.Length(); |
|
765 } |
|
766 |
|
767 RBuf newAddr; |
|
768 newAddr.CreateL( length ); |
|
769 CleanupClosePushL( newAddr ); |
|
770 |
|
771 if( street.Length() ) |
|
772 { |
|
773 newAddr += street; |
|
774 } |
|
775 |
|
776 if( city.Length() ) |
|
777 { |
|
778 if( newAddr.Length() > 0 ) |
|
779 { |
|
780 newAddr += KComma(); |
|
781 newAddr += KSpace(); |
|
782 } |
|
783 newAddr += city; |
|
784 } |
|
785 |
|
786 if( country.Length() ) |
|
787 { |
|
788 if( newAddr.Length() > 0 ) |
|
789 { |
|
790 newAddr += KComma(); |
|
791 newAddr += KSpace(); |
|
792 } |
|
793 newAddr += country; |
|
794 } |
|
795 if(length) |
|
796 aLandmark.SetLandmarkNameL(newAddr); |
|
797 |
|
798 CleanupStack::PopAndDestroy( &newAddr ); |
|
799 } |
|
800 |
|
801 // -------------------------------------------------------------------------- |
|
802 // CPmapCmd::FillGeoLandmarkL |
|
803 // -------------------------------------------------------------------------- |
|
804 // |
|
805 TBool CPmapCmd::FillGeoLandmarkL( |
|
806 CPosLandmark& aLandmark, TVPbkFieldTypeParameter aAddressType ) |
|
807 { |
|
808 TBool result = EFalse; |
|
809 MVPbkStoreContactFieldCollection& arrFields = iContact->Fields(); |
|
810 TInt count = arrFields.FieldCount(); |
|
811 for( TInt idx = 0; idx < count; idx++ ) |
|
812 { |
|
813 MVPbkStoreContactField& field = arrFields.FieldAt( idx ); |
|
814 const MVPbkContactFieldData& fieldData = field.FieldData(); |
|
815 if( fieldData.DataType() != EVPbkFieldStorageTypeText ) |
|
816 { |
|
817 continue; |
|
818 } |
|
819 const TDesC& dataText = |
|
820 MVPbkContactFieldTextData::Cast( fieldData ).Text(); |
|
821 const MVPbkFieldType* type = field.BestMatchingFieldType(); |
|
822 if ( type ) |
|
823 { |
|
824 TInt countProps = type->VersitProperties().Count(); |
|
825 TArray<TVPbkFieldVersitProperty> props = type->VersitProperties(); |
|
826 for (TInt idx2 = 0; idx2 < countProps; idx2++ ) |
|
827 { |
|
828 if ( (props[idx2].Parameters().Contains( EVPbkVersitParamHOME ) |
|
829 && aAddressType == EVPbkVersitParamHOME) |
|
830 || (props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) |
|
831 && aAddressType == EVPbkVersitParamWORK) |
|
832 || (!props[idx2].Parameters().Contains( EVPbkVersitParamHOME ) |
|
833 && !props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) |
|
834 && aAddressType == EVPbkVersitParamPREF) ) |
|
835 { |
|
836 result = DoFillGeoLandmarkL( aLandmark, dataText ); |
|
837 break; |
|
838 } |
|
839 } |
|
840 } |
|
841 } |
|
842 return result; |
|
843 } |
|
844 |
|
845 // -------------------------------------------------------------------------- |
|
846 // CPmapCmd::DoFillGeoLandmarkL |
|
847 // -------------------------------------------------------------------------- |
|
848 // |
|
849 TBool CPmapCmd::DoFillGeoLandmarkL( |
|
850 CPosLandmark& aLandmark, const TDesC& aDataText ) |
|
851 { |
|
852 TBool result = EFalse; |
|
853 TInt separator = aDataText.Find( KGeoSeparator ); |
|
854 if ( separator != KErrNotFound ) |
|
855 { |
|
856 TReal64 latitude = 0; |
|
857 TReal64 logitude = 0; |
|
858 TLex lexLatitude( aDataText.Left( separator ) ); |
|
859 TLex lexLogitude( aDataText.Right( aDataText.Length() |
|
860 - separator - KGeoSeparatorLength ) ); |
|
861 if ( lexLatitude.Val( latitude ) == KErrNone |
|
862 && lexLogitude.Val( logitude ) == KErrNone ) |
|
863 { |
|
864 TLocality loc( TCoordinate( latitude, logitude ), |
|
865 KGeoHorizontalAccuracy ); |
|
866 aLandmark.SetPositionL( loc ); |
|
867 TInt separator2 = aDataText.Right( aDataText.Length() - separator - KGeoSeparatorLength ).Find( KGeoSeparator ); |
|
868 if(separator2 != KErrNotFound) |
|
869 { |
|
870 separator += separator2; |
|
871 aLandmark.SetPositionFieldL(EPositionFieldCountryCode,aDataText.Right( aDataText.Length() - separator - (KGeoSeparatorLength * 2) )); |
|
872 } |
|
873 result = ETrue; |
|
874 } |
|
875 } |
|
876 return result; |
|
877 } |
|
878 |
|
879 // -------------------------------------------------------------------------- |
|
880 // CPmapCmd::EditorAssignFromMapsL |
|
881 // -------------------------------------------------------------------------- |
|
882 // |
|
883 void CPmapCmd::EditorAssignFromMapsL(TVPbkFieldTypeParameter aAddressType) |
|
884 { |
|
885 if(iMapView) |
|
886 { |
|
887 delete iMapView; |
|
888 iMapView = NULL; |
|
889 } |
|
890 |
|
891 iMapView = CMnMapView::NewChainedL( *iMapViewProvider ); |
|
892 iAddressType = aAddressType; |
|
893 |
|
894 RPointerArray<CPosLandmark> landmarks; |
|
895 CleanupClosePushL( landmarks ); |
|
896 |
|
897 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
898 CleanupStack::PushL( landmark ); |
|
899 |
|
900 if ( !FillGeoLandmarkL( *landmark, aAddressType ) ) |
|
901 { |
|
902 FillLandmarkL( *landmark, aAddressType ); |
|
903 } |
|
904 TLocality locality; |
|
905 iNoAddress = ETrue; |
|
906 if( landmark->NumOfAvailablePositionFields() > 0 || landmark->GetPosition( locality ) == KErrNone ) |
|
907 { |
|
908 landmarks.AppendL( landmark ); |
|
909 iMapView->AddLandmarksToShowL( landmarks ); |
|
910 iNoAddress = EFalse; |
|
911 } |
|
912 |
|
913 |
|
914 iMapView->SelectFromMapL( iStatus ); |
|
915 iCurrentMapLaunchedByState = EMapAssignFromMaps; |
|
916 SetActive(); |
|
917 CleanupStack::PopAndDestroy( landmark ); |
|
918 CleanupStack::PopAndDestroy( &landmarks ); |
|
919 } |
|
920 |
|
921 // -------------------------------------------------------------------------- |
|
922 // CPmapCmd::UpdateCoordsL |
|
923 // -------------------------------------------------------------------------- |
|
924 // |
|
925 void CPmapCmd::UpdateCoordsL( |
|
926 const CPosLandmark& aLandmark, |
|
927 TVPbkFieldTypeParameter aAddressType ) |
|
928 { |
|
929 TLocality locality; |
|
930 aLandmark.GetPosition(locality); |
|
931 TReal64 latitude = locality.Latitude(); |
|
932 TReal64 longitude = locality.Longitude(); |
|
933 RBuf geoData; |
|
934 RBuf textNumber; |
|
935 CleanupClosePushL( geoData ); |
|
936 CleanupClosePushL( textNumber ); |
|
937 geoData.CreateL( KGeoMaxSize ); |
|
938 textNumber.CreateL( KGeoMaxSize ); |
|
939 TRealFormat format( KGeoFormatWidth ); |
|
940 textNumber.Num( latitude, format ); |
|
941 geoData = textNumber; |
|
942 geoData += KGeoSeparator(); |
|
943 textNumber.Num( longitude, format ); |
|
944 geoData += textNumber; |
|
945 |
|
946 if(aLandmark.IsPositionFieldAvailable( EPositionFieldCountryCode )) |
|
947 { |
|
948 TPtrC countryCode; |
|
949 aLandmark.GetPositionField(EPositionFieldCountryCode,countryCode); |
|
950 geoData += KGeoSeparator(); |
|
951 geoData += countryCode; |
|
952 } |
|
953 CleanupStack::PopAndDestroy( &textNumber ); |
|
954 |
|
955 TBool updated = EFalse; |
|
956 MVPbkStoreContactFieldCollection& arrFields = iContact->Fields(); |
|
957 TInt count = arrFields.FieldCount(); |
|
958 for( TInt idx = 0; idx < count; idx++) |
|
959 { |
|
960 MVPbkStoreContactField& field = arrFields.FieldAt(idx); |
|
961 const MVPbkFieldType* type = field.BestMatchingFieldType(); |
|
962 if ( type ) |
|
963 { |
|
964 TInt countProps = type->VersitProperties().Count(); |
|
965 TArray<TVPbkFieldVersitProperty> props = type->VersitProperties(); |
|
966 for (TInt idx2 = 0; idx2 < countProps; idx2++ ) |
|
967 { |
|
968 if ( props[idx2].Name() == EVPbkVersitNameGEO |
|
969 && ((props[idx2].Parameters().Contains( EVPbkVersitParamHOME ) |
|
970 && aAddressType == EVPbkVersitParamHOME) |
|
971 || (props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) |
|
972 && aAddressType == EVPbkVersitParamWORK) |
|
973 || (!props[idx2].Parameters().Contains( EVPbkVersitParamHOME ) |
|
974 && !props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) |
|
975 && aAddressType == EVPbkVersitParamPREF)) ) |
|
976 { |
|
977 MVPbkContactFieldData& fieldData = field.FieldData(); |
|
978 MVPbkContactFieldTextData& data = |
|
979 MVPbkContactFieldTextData::Cast( fieldData ); |
|
980 data.SetTextL( geoData ); |
|
981 updated = ETrue; |
|
982 break; |
|
983 } |
|
984 } |
|
985 } |
|
986 } |
|
987 |
|
988 if( !updated ) |
|
989 { |
|
990 MVPbkContactStore& storeContact = iContact->ContactStore(); |
|
991 const MVPbkContactStoreProperties& storeProp = storeContact.StoreProperties(); |
|
992 const MVPbkFieldTypeList& fieldList = storeProp.SupportedFields(); |
|
993 TInt count = fieldList.FieldTypeCount(); |
|
994 for( TInt idx = 0; idx < count; idx++) |
|
995 { |
|
996 const MVPbkFieldType& fieldType = fieldList.FieldTypeAt( idx ); |
|
997 TInt countProps = fieldType.VersitProperties().Count(); |
|
998 TArray<TVPbkFieldVersitProperty> props = |
|
999 fieldType.VersitProperties(); |
|
1000 for ( TInt idx2 = 0; idx2 < countProps; idx2++ ) |
|
1001 { |
|
1002 if ( props[ idx2 ].Name() == EVPbkVersitNameGEO && |
|
1003 ( ( props[ idx2 ].Parameters().Contains( EVPbkVersitParamHOME ) && |
|
1004 aAddressType == EVPbkVersitParamHOME ) || |
|
1005 ( props[ idx2 ].Parameters().Contains( EVPbkVersitParamWORK ) && |
|
1006 aAddressType == EVPbkVersitParamWORK ) || |
|
1007 ( !props[ idx2 ].Parameters().Contains( EVPbkVersitParamHOME ) && |
|
1008 !props[ idx2 ].Parameters().Contains( EVPbkVersitParamWORK ) && |
|
1009 aAddressType == EVPbkVersitParamPREF ) ) ) |
|
1010 { |
|
1011 MVPbkStoreContactField* contactField = iContact->CreateFieldLC( fieldType ); |
|
1012 if( contactField ) |
|
1013 { |
|
1014 MVPbkContactFieldData& fieldData = contactField->FieldData(); |
|
1015 if( fieldData.DataType() == EVPbkFieldStorageTypeText ) |
|
1016 { |
|
1017 MVPbkContactFieldTextData& data = |
|
1018 MVPbkContactFieldTextData::Cast( fieldData ); |
|
1019 data.SetTextL( geoData ); |
|
1020 iContact->AddFieldL( contactField ); |
|
1021 } |
|
1022 CleanupStack::Pop( contactField ); |
|
1023 } |
|
1024 break; |
|
1025 } |
|
1026 } |
|
1027 } |
|
1028 } |
|
1029 CleanupStack::PopAndDestroy( &geoData ); |
|
1030 } |
|
1031 |
|
1032 // -------------------------------------------------------------------------- |
|
1033 // CPmapCmd::UpdateFieldL |
|
1034 // -------------------------------------------------------------------------- |
|
1035 // |
|
1036 void CPmapCmd::UpdateFieldL( |
|
1037 const CPosLandmark& aLandmark, |
|
1038 _TPositionFieldId aPositionField, |
|
1039 TVPbkSubFieldType aVersitSubField, |
|
1040 TVPbkFieldTypeParameter aAddressType ) |
|
1041 { |
|
1042 TBool updated = EFalse; |
|
1043 TPtrC textData; |
|
1044 if ( aPositionField != EPositionFieldNone && aLandmark.IsPositionFieldAvailable( aPositionField ) ) |
|
1045 { |
|
1046 aLandmark.GetPositionField( aPositionField, textData ); |
|
1047 } |
|
1048 |
|
1049 if( iAddressView && iEditorControl ) |
|
1050 { |
|
1051 TInt countControls = iEditorControl->NumberOfControls(); |
|
1052 for ( TInt i = 0; i < countControls; ++i ) |
|
1053 { |
|
1054 TArray<TVPbkFieldVersitProperty> props = iEditorControl->EditorField( i ).FieldProperty().FieldType().VersitProperties(); |
|
1055 TInt countProperties = props.Count(); |
|
1056 for ( TInt ii = 0; ii < countProperties; ++ii ) |
|
1057 { |
|
1058 if( props[ ii ].Name() == EVPbkVersitNameADR && props[ ii ].SubField() == aVersitSubField ) |
|
1059 { |
|
1060 if ( aLandmark.IsPositionFieldAvailable( aPositionField ) ) |
|
1061 { |
|
1062 iEditorControl->EditorField( i ).Control()->SetTextL( &textData ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 iEditorControl->EditorField( i ).Control()->SetTextL( &KNullDesC() ); |
|
1067 } |
|
1068 |
|
1069 iEditorControl->EditorField( i ).SaveFieldL(); |
|
1070 updated = ETrue; |
|
1071 continue; |
|
1072 } |
|
1073 } |
|
1074 } |
|
1075 } |
|
1076 else |
|
1077 { |
|
1078 MVPbkStoreContactFieldCollection& arrFields = iContact->Fields(); |
|
1079 TInt count = arrFields.FieldCount(); |
|
1080 for( TInt idx = 0; idx < count; idx++) |
|
1081 { |
|
1082 MVPbkStoreContactField& field = arrFields.FieldAt(idx); |
|
1083 const MVPbkFieldType* type = field.BestMatchingFieldType(); |
|
1084 if ( type ) |
|
1085 { |
|
1086 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties(); |
|
1087 for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ ) |
|
1088 { |
|
1089 if ( arrProp[idx2].Name() == EVPbkVersitNameADR |
|
1090 && arrProp[idx2].SubField() == aVersitSubField |
|
1091 && (arrProp[idx2].Parameters().Contains( aAddressType ) |
|
1092 || (aAddressType == EVPbkVersitParamPREF |
|
1093 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME ) |
|
1094 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ))) ) |
|
1095 { |
|
1096 MVPbkContactFieldData& fieldData = field.FieldData(); |
|
1097 if ( fieldData.DataType() != EVPbkFieldStorageTypeText ) |
|
1098 { |
|
1099 continue; |
|
1100 } |
|
1101 MVPbkContactFieldTextData& data = |
|
1102 MVPbkContactFieldTextData::Cast( fieldData ); |
|
1103 if ( aLandmark.IsPositionFieldAvailable( aPositionField ) ) |
|
1104 { |
|
1105 data.SetTextL( textData ); |
|
1106 } |
|
1107 else |
|
1108 { |
|
1109 data.SetTextL( KNullDesC() ); |
|
1110 } |
|
1111 |
|
1112 updated = ETrue; |
|
1113 continue; |
|
1114 } |
|
1115 } |
|
1116 } |
|
1117 } |
|
1118 } |
|
1119 |
|
1120 if( !updated && aLandmark.IsPositionFieldAvailable( aPositionField ) ) |
|
1121 { |
|
1122 MVPbkContactStore& storeContact = iContact->ContactStore(); |
|
1123 const MVPbkContactStoreProperties& storeProp = storeContact.StoreProperties(); |
|
1124 const MVPbkFieldTypeList& fieldList = storeProp.SupportedFields(); |
|
1125 TInt count = fieldList.FieldTypeCount(); |
|
1126 for( TInt idx = 0; idx < count; idx++) |
|
1127 { |
|
1128 const MVPbkFieldType& fieldType = fieldList.FieldTypeAt( idx ); |
|
1129 TArray<TVPbkFieldVersitProperty> arrProp = fieldType.VersitProperties(); |
|
1130 for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++) |
|
1131 { |
|
1132 if( arrProp[idx2].Name() == EVPbkVersitNameADR && |
|
1133 arrProp[idx2].SubField() == aVersitSubField && |
|
1134 ( arrProp[idx2].Parameters().Contains(aAddressType) || |
|
1135 ( aAddressType == EVPbkVersitParamPREF && |
|
1136 !arrProp[idx2].Parameters().Contains(EVPbkVersitParamHOME) && |
|
1137 !arrProp[idx2].Parameters().Contains(EVPbkVersitParamWORK) ) ) ) |
|
1138 { |
|
1139 MVPbkStoreContactField* contactField = iContact->CreateFieldLC( fieldType ); |
|
1140 if( contactField ) |
|
1141 { |
|
1142 MVPbkContactFieldData& fieldData = contactField->FieldData(); |
|
1143 if( fieldData.DataType() == EVPbkFieldStorageTypeText ) |
|
1144 { |
|
1145 MVPbkContactFieldTextData& data = |
|
1146 MVPbkContactFieldTextData::Cast( fieldData ); |
|
1147 data.SetTextL(textData); |
|
1148 iContact->AddFieldL( contactField ); |
|
1149 } |
|
1150 CleanupStack::Pop(contactField); |
|
1151 } |
|
1152 break; |
|
1153 } |
|
1154 } |
|
1155 } |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 // -------------------------------------------------------------------------- |
|
1160 // CPmapCmd::IsAddressInContact |
|
1161 // -------------------------------------------------------------------------- |
|
1162 // |
|
1163 TBool CPmapCmd::IsAddressInContact() |
|
1164 { |
|
1165 MVPbkStoreContactFieldCollection& arrFields = iContact->Fields(); |
|
1166 TInt count = arrFields.FieldCount(); |
|
1167 for( TInt idx = 0; idx < count; idx++) |
|
1168 { |
|
1169 MVPbkStoreContactField& field = arrFields.FieldAt(idx); |
|
1170 const MVPbkFieldType* type = field.BestMatchingFieldType(); |
|
1171 if ( type ) |
|
1172 { |
|
1173 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties(); |
|
1174 for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++) |
|
1175 { |
|
1176 if( arrProp[idx2].Name() == EVPbkVersitNameADR ) |
|
1177 { |
|
1178 return ETrue; |
|
1179 } |
|
1180 } |
|
1181 } |
|
1182 } |
|
1183 return EFalse; |
|
1184 } |
|
1185 |
|
1186 // -------------------------------------------------------------------------- |
|
1187 // CPmapCmd::GetFieldGroupL |
|
1188 // -------------------------------------------------------------------------- |
|
1189 // |
|
1190 TPbk2FieldGroupId CPmapCmd::GetFieldGroupL( |
|
1191 MVPbkStoreContactField& aField ) |
|
1192 { |
|
1193 TPbk2FieldGroupId ret = EPbk2FieldGroupIdNone; |
|
1194 |
|
1195 const MVPbkFieldType* type = aField.BestMatchingFieldType(); |
|
1196 if( type ) |
|
1197 { |
|
1198 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties(); |
|
1199 for( TInt idx = 0; idx < arrProp.Count(); idx++) |
|
1200 { |
|
1201 if( arrProp[idx].Name() != EVPbkVersitNameADR ) |
|
1202 { |
|
1203 continue; |
|
1204 } |
|
1205 |
|
1206 if( arrProp[idx].Parameters().Contains( |
|
1207 Pbk2AddressTools::MapAddressToVersitParam( |
|
1208 EPbk2FieldGroupIdHomeAddress ) ) ) |
|
1209 { |
|
1210 ret = EPbk2FieldGroupIdHomeAddress; |
|
1211 break; |
|
1212 } |
|
1213 else if( arrProp[idx].Parameters().Contains( |
|
1214 Pbk2AddressTools::MapAddressToVersitParam( |
|
1215 EPbk2FieldGroupIdCompanyAddress ) ) ) |
|
1216 { |
|
1217 ret = EPbk2FieldGroupIdCompanyAddress; |
|
1218 break; |
|
1219 } |
|
1220 else |
|
1221 { |
|
1222 ret = EPbk2FieldGroupIdPostalAddress; |
|
1223 break; |
|
1224 } |
|
1225 } |
|
1226 } |
|
1227 |
|
1228 return ret; |
|
1229 } |
|
1230 |
|
1231 // -------------------------------------------------------------------------- |
|
1232 // CPmapCmd::ContactOperationCompleted |
|
1233 // -------------------------------------------------------------------------- |
|
1234 // |
|
1235 void CPmapCmd::ContactOperationCompleted |
|
1236 (TContactOpResult aResult) |
|
1237 { |
|
1238 if (aResult.iStoreContact) |
|
1239 { |
|
1240 iContact = aResult.iStoreContact; |
|
1241 } |
|
1242 |
|
1243 CActiveScheduler::Stop(); |
|
1244 } |
|
1245 |
|
1246 // -------------------------------------------------------------------------- |
|
1247 // CPmapCmd::HandleSelectiOnAssignFromMapsL |
|
1248 // -------------------------------------------------------------------------- |
|
1249 // |
|
1250 void CPmapCmd::HandleSelectiOnAssignFromMapsL() |
|
1251 { |
|
1252 TBool update = EFalse; |
|
1253 TBool geocoordsExist = EFalse; |
|
1254 |
|
1255 TLocality locality; |
|
1256 CPosLandmark* result = NULL; |
|
1257 TInt currentstatus = iStatus.Int(); |
|
1258 if ( iStatus.Int() == KErrNone && iMapView) |
|
1259 { |
|
1260 result = iMapView->RetrieveSelectionResultL(); |
|
1261 // Get the location name if available |
|
1262 //-----------------Emulator Hack------------------------------- |
|
1263 // result->SetLandmarkNameL(_L("Jupiter Tech Park")); |
|
1264 // result->SetPositionFieldL(EPositionFieldCity, _L("Bangalore")); |
|
1265 // result->SetPositionFieldL(EPositionFieldCountry, _L("India")); |
|
1266 //------------------------------------------------------------- |
|
1267 if(result->GetPosition( locality ) == KErrNone ) |
|
1268 { |
|
1269 geocoordsExist = ETrue; |
|
1270 } |
|
1271 |
|
1272 if( result->IsPositionFieldAvailable( EPositionFieldStreet ) || |
|
1273 result->IsPositionFieldAvailable( EPositionFieldCity ) || |
|
1274 result->IsPositionFieldAvailable( EPositionFieldCountry ) ) |
|
1275 { |
|
1276 update= ETrue; |
|
1277 } |
|
1278 } |
|
1279 delete iMapView; |
|
1280 iMapView = NULL; |
|
1281 if( result ) |
|
1282 { |
|
1283 CleanupStack::PushL( result ); |
|
1284 } |
|
1285 |
|
1286 if( update ) |
|
1287 { |
|
1288 if( iAddressUpdatePrompt && !iNoAddress ) |
|
1289 { |
|
1290 const TInt KGranularity = 4; |
|
1291 CDesCArrayFlat* arrFields = new ( ELeave ) CDesCArrayFlat |
|
1292 ( KGranularity ); |
|
1293 CleanupStack::PushL(arrFields); |
|
1294 |
|
1295 HBufC* addrLebel = NULL; |
|
1296 |
|
1297 switch( iAddressType ) |
|
1298 { |
|
1299 case EVPbkVersitParamPREF: |
|
1300 addrLebel = StringLoader::LoadLC(R_QTN_PHOB_HEADER_ADDRESS ); |
|
1301 break; |
|
1302 case EVPbkVersitParamHOME: |
|
1303 addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_HOME ); |
|
1304 break; |
|
1305 case EVPbkVersitParamWORK: |
|
1306 addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_WORK ); |
|
1307 break; |
|
1308 default: |
|
1309 User::Leave(KErrArgument); |
|
1310 } |
|
1311 arrFields->AppendL( addrLebel->Des() ); |
|
1312 |
|
1313 _LIT(KComma, ","); |
|
1314 _LIT(KSpace, " "); |
|
1315 |
|
1316 TInt lenght = 0; |
|
1317 TPtrC street; |
|
1318 if( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) |
|
1319 { |
|
1320 result->GetPositionField( EPositionFieldStreet, street ); |
|
1321 lenght += street.Length(); |
|
1322 } |
|
1323 |
|
1324 TPtrC city; |
|
1325 if( result->IsPositionFieldAvailable( EPositionFieldCity ) ) |
|
1326 { |
|
1327 result->GetPositionField( EPositionFieldCity, city ); |
|
1328 if( lenght ) |
|
1329 { |
|
1330 lenght += KComma().Length() + KSpace().Length(); |
|
1331 } |
|
1332 lenght += city.Length(); |
|
1333 } |
|
1334 |
|
1335 TPtrC country; |
|
1336 if( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) |
|
1337 { |
|
1338 result->GetPositionField( EPositionFieldCountry, country ); |
|
1339 if( lenght ) |
|
1340 { |
|
1341 lenght += KComma().Length() + KSpace().Length(); |
|
1342 } |
|
1343 lenght += country.Length(); |
|
1344 } |
|
1345 |
|
1346 RBuf newAddr; |
|
1347 newAddr.CreateL( lenght ); |
|
1348 CleanupClosePushL( newAddr ); |
|
1349 |
|
1350 if( street.Length() ) |
|
1351 { |
|
1352 newAddr += street; |
|
1353 } |
|
1354 |
|
1355 if( city.Length() ) |
|
1356 { |
|
1357 if( newAddr.Length() > 0 ) |
|
1358 { |
|
1359 newAddr += KComma(); |
|
1360 newAddr += KSpace(); |
|
1361 } |
|
1362 newAddr += city; |
|
1363 } |
|
1364 |
|
1365 if( country.Length() ) |
|
1366 { |
|
1367 if( newAddr.Length() > 0 ) |
|
1368 { |
|
1369 newAddr += KComma(); |
|
1370 newAddr += KSpace(); |
|
1371 } |
|
1372 newAddr += country; |
|
1373 } |
|
1374 |
|
1375 arrFields->AppendL( newAddr ); |
|
1376 HBufC* prompt = StringLoader::LoadLC( R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); |
|
1377 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
1378 if( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) |
|
1379 { |
|
1380 update = EFalse; |
|
1381 } |
|
1382 CleanupStack::PopAndDestroy( prompt ); |
|
1383 CleanupStack::PopAndDestroy( &newAddr ); |
|
1384 CleanupStack::PopAndDestroy( addrLebel ); |
|
1385 CleanupStack::PopAndDestroy( arrFields ); |
|
1386 } |
|
1387 |
|
1388 if( update ) |
|
1389 { |
|
1390 if ( !iEditorControl ) |
|
1391 { |
|
1392 iContact->LockL( *this ); |
|
1393 CActiveScheduler::Start(); |
|
1394 } |
|
1395 UpdateFieldL( *result, EPositionFieldCountry, |
|
1396 EVPbkVersitSubFieldCountry, iAddressType ); |
|
1397 UpdateFieldL( *result, EPositionFieldCity, |
|
1398 EVPbkVersitSubFieldLocality, iAddressType ); |
|
1399 UpdateFieldL( *result, EPositionFieldStreet, |
|
1400 EVPbkVersitSubFieldStreet, iAddressType ); |
|
1401 UpdateFieldL( *result, EPositionFieldPostalCode, |
|
1402 EVPbkVersitSubFieldPostalCode, iAddressType ); |
|
1403 UpdateFieldL( *result, EPositionFieldLocality, |
|
1404 EVPbkVersitSubFieldRegion, iAddressType ); |
|
1405 UpdateFieldL( *result, EPositionFieldNone, |
|
1406 EVPbkVersitSubFieldPostOfficeAddress, iAddressType ); |
|
1407 UpdateFieldL( *result, EPositionFieldNone, |
|
1408 EVPbkVersitSubFieldExtendedAddress, iAddressType ); |
|
1409 |
|
1410 if( geocoordsExist ) |
|
1411 { |
|
1412 UpdateCoordsL( *result, iAddressType); |
|
1413 } |
|
1414 if ( !iEditorControl ) |
|
1415 { |
|
1416 iContact->CommitL( *this ); |
|
1417 CActiveScheduler::Start(); |
|
1418 } |
|
1419 if( ControlExtension() ) |
|
1420 { |
|
1421 ControlExtension()->UpdateControlsL(); |
|
1422 } |
|
1423 |
|
1424 HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); |
|
1425 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
1426 note->ExecuteLD( *text ); |
|
1427 CleanupStack::PopAndDestroy( text ); |
|
1428 } |
|
1429 } |
|
1430 |
|
1431 if( result ) |
|
1432 { |
|
1433 CleanupStack::PopAndDestroy( result ); |
|
1434 } |
|
1435 } |
|
1436 |
|
1437 // -------------------------------------------------------------------------- |
|
1438 // CPmapCmd::HandleSelectiOnAssignFromMapsL |
|
1439 // -------------------------------------------------------------------------- |
|
1440 // |
|
1441 void CPmapCmd::HandleSelectiOnShowOnMapsL() |
|
1442 { |
|
1443 TBool update = EFalse; |
|
1444 TBool geocoordsExist = EFalse; |
|
1445 |
|
1446 TLocality locality; |
|
1447 CPosLandmark* result = NULL; |
|
1448 if ( iStatus.Int() == KErrNone && iMapView) |
|
1449 { |
|
1450 result = iMapView->RetrieveSelectionResultL(); |
|
1451 if ( result->GetPosition( locality ) == KErrNone ) |
|
1452 { |
|
1453 geocoordsExist = ETrue; |
|
1454 } |
|
1455 if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) |
|
1456 || result->IsPositionFieldAvailable( EPositionFieldCity ) |
|
1457 || result->IsPositionFieldAvailable( EPositionFieldCountry ) ) |
|
1458 { |
|
1459 update = ETrue; |
|
1460 } |
|
1461 |
|
1462 } |
|
1463 |
|
1464 delete iMapView; |
|
1465 iMapView = NULL; |
|
1466 if ( result ) |
|
1467 { |
|
1468 CleanupStack::PushL( result ); |
|
1469 } |
|
1470 |
|
1471 if ( update ) |
|
1472 { |
|
1473 |
|
1474 const TInt KGranularity = 4; |
|
1475 CDesCArrayFlat* arrFields = new (ELeave) CDesCArrayFlat( |
|
1476 KGranularity ); |
|
1477 CleanupStack::PushL( arrFields ); |
|
1478 HBufC* addrLebel = NULL; |
|
1479 |
|
1480 switch ( iAddressType ) |
|
1481 { |
|
1482 case EVPbkVersitParamPREF: |
|
1483 addrLebel = StringLoader::LoadLC( |
|
1484 R_QTN_PHOB_HEADER_ADDRESS ); |
|
1485 break; |
|
1486 case EVPbkVersitParamHOME: |
|
1487 addrLebel = StringLoader::LoadLC( |
|
1488 R_QTN_PHOB_HEADER_ADDRESS_HOME ); |
|
1489 break; |
|
1490 case EVPbkVersitParamWORK: |
|
1491 addrLebel = StringLoader::LoadLC( |
|
1492 R_QTN_PHOB_HEADER_ADDRESS_WORK ); |
|
1493 break; |
|
1494 default: |
|
1495 User::Leave( KErrArgument ); |
|
1496 } |
|
1497 arrFields->AppendL( addrLebel->Des() ); |
|
1498 _LIT(KComma, ","); |
|
1499 _LIT(KSpace, " "); |
|
1500 TInt lenght = 0; |
|
1501 TPtrC street; |
|
1502 if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) |
|
1503 { |
|
1504 result->GetPositionField( EPositionFieldStreet, street ); |
|
1505 lenght += street.Length(); |
|
1506 } |
|
1507 |
|
1508 TPtrC city; |
|
1509 if ( result->IsPositionFieldAvailable( EPositionFieldCity ) ) |
|
1510 { |
|
1511 result->GetPositionField( EPositionFieldCity, city ); |
|
1512 if ( lenght ) |
|
1513 { |
|
1514 lenght += KComma().Length() + KSpace().Length(); |
|
1515 } |
|
1516 lenght += city.Length(); |
|
1517 } |
|
1518 |
|
1519 TPtrC country; |
|
1520 if ( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) |
|
1521 { |
|
1522 result->GetPositionField( EPositionFieldCountry, country ); |
|
1523 if ( lenght ) |
|
1524 { |
|
1525 lenght += KComma().Length() + KSpace().Length(); |
|
1526 } |
|
1527 lenght += country.Length(); |
|
1528 } |
|
1529 |
|
1530 RBuf newAddr; |
|
1531 newAddr.CreateL( lenght ); |
|
1532 CleanupClosePushL( newAddr ); |
|
1533 |
|
1534 if ( street.Length() ) |
|
1535 { |
|
1536 newAddr += street; |
|
1537 } |
|
1538 |
|
1539 if ( city.Length() ) |
|
1540 { |
|
1541 if ( newAddr.Length() > 0 ) |
|
1542 { |
|
1543 newAddr += KComma(); |
|
1544 newAddr += KSpace(); |
|
1545 } |
|
1546 newAddr += city; |
|
1547 } |
|
1548 |
|
1549 if ( country.Length() ) |
|
1550 { |
|
1551 if ( newAddr.Length() > 0 ) |
|
1552 { |
|
1553 newAddr += KComma(); |
|
1554 newAddr += KSpace(); |
|
1555 } |
|
1556 newAddr += country; |
|
1557 } |
|
1558 |
|
1559 arrFields->AppendL( newAddr ); |
|
1560 HBufC* prompt = StringLoader::LoadLC( |
|
1561 R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); |
|
1562 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
1563 if ( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) |
|
1564 { |
|
1565 update = EFalse; |
|
1566 } |
|
1567 CleanupStack::PopAndDestroy( prompt ); |
|
1568 CleanupStack::PopAndDestroy( &newAddr ); |
|
1569 CleanupStack::PopAndDestroy( addrLebel ); |
|
1570 CleanupStack::PopAndDestroy( arrFields ); |
|
1571 |
|
1572 } |
|
1573 if ( update ) |
|
1574 { |
|
1575 if ( !iEditorControl ) |
|
1576 { |
|
1577 iContact->LockL( *this ); |
|
1578 CActiveScheduler::Start(); |
|
1579 } |
|
1580 UpdateFieldL( *result, EPositionFieldCountry, |
|
1581 EVPbkVersitSubFieldCountry, iAddressType ); |
|
1582 UpdateFieldL( *result, EPositionFieldCity, |
|
1583 EVPbkVersitSubFieldLocality, iAddressType ); |
|
1584 UpdateFieldL( *result, EPositionFieldStreet, |
|
1585 EVPbkVersitSubFieldStreet, iAddressType ); |
|
1586 UpdateFieldL( *result, EPositionFieldPostalCode, |
|
1587 EVPbkVersitSubFieldPostalCode, iAddressType ); |
|
1588 UpdateFieldL( *result, EPositionFieldLocality, |
|
1589 EVPbkVersitSubFieldRegion, iAddressType ); |
|
1590 UpdateFieldL( *result, EPositionFieldNone, |
|
1591 EVPbkVersitSubFieldPostOfficeAddress, iAddressType ); |
|
1592 UpdateFieldL( *result, EPositionFieldNone, |
|
1593 EVPbkVersitSubFieldExtendedAddress, iAddressType ); |
|
1594 |
|
1595 if ( geocoordsExist ) |
|
1596 { |
|
1597 UpdateCoordsL( *result, iAddressType ); |
|
1598 } |
|
1599 if ( !iEditorControl ) |
|
1600 { |
|
1601 iContact->CommitL( *this ); |
|
1602 CActiveScheduler::Start(); |
|
1603 } |
|
1604 if ( ControlExtension() ) |
|
1605 { |
|
1606 ControlExtension()->UpdateControlsL(); |
|
1607 } |
|
1608 |
|
1609 HBufC* text = StringLoader::LoadLC( |
|
1610 R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); |
|
1611 CAknInformationNote* note = new (ELeave) CAknInformationNote( |
|
1612 ETrue ); |
|
1613 note->ExecuteLD( *text ); |
|
1614 CleanupStack::PopAndDestroy( text ); |
|
1615 } |
|
1616 |
|
1617 if ( result ) |
|
1618 { |
|
1619 CleanupStack::PopAndDestroy( result ); |
|
1620 } |
|
1621 } |
|
1622 |
|
1623 // -------------------------------------------------------------------------- |
|
1624 // CPmapCmd::ContactOperationFailed |
|
1625 // -------------------------------------------------------------------------- |
|
1626 // |
|
1627 void CPmapCmd::ContactOperationFailed |
|
1628 (TContactOp /*aOpCode*/, TInt /*aErrorCode*/, TBool /*aErrorNotified*/) |
|
1629 { |
|
1630 CActiveScheduler::Stop(); |
|
1631 } |
|
1632 |
|
1633 // ---------------------------------------------------------------------------- |
|
1634 // CPmapCmd::RunL |
|
1635 // RunL method to handle the user selection |
|
1636 // (other items were commented in a header). |
|
1637 // ---------------------------------------------------------------------------- |
|
1638 // |
|
1639 void CPmapCmd::RunL() |
|
1640 { |
|
1641 // request is completed, inform observer |
|
1642 TInt maperror = iStatus.Int(); |
|
1643 if(iStatus.Int() == KErrNone) |
|
1644 { |
|
1645 switch(iCurrentMapLaunchedByState) |
|
1646 { |
|
1647 case EMapAssignFromMaps: |
|
1648 { |
|
1649 HandleSelectiOnAssignFromMapsL(); |
|
1650 } |
|
1651 break; |
|
1652 case EMapShowOnMaps: |
|
1653 { |
|
1654 HandleSelectiOnShowOnMapsL(); |
|
1655 } |
|
1656 break; |
|
1657 default: |
|
1658 break; |
|
1659 } |
|
1660 } |
|
1661 FinishProcess(); |
|
1662 |
|
1663 if(!iUiControl) |
|
1664 { |
|
1665 // delete this; |
|
1666 } |
|
1667 iCurrentMapLaunchedByState = EMapNone; |
|
1668 } |
|
1669 |
|
1670 // ---------------------------------------------------------------------------- |
|
1671 // CPmapCmd::RunError |
|
1672 // Function to handle any errors in async request |
|
1673 // (other items were commented in a header). |
|
1674 // ---------------------------------------------------------------------------- |
|
1675 // |
|
1676 TInt CPmapCmd::RunError( TInt /*aError*/ ) |
|
1677 { |
|
1678 Reset(); |
|
1679 return KErrNone; |
|
1680 } |
|
1681 |
|
1682 // ---------------------------------------------------------------------------- |
|
1683 // CPmapCmd::DoCancel |
|
1684 // Cancel method to handle the user selection |
|
1685 // (other items were commented in a header). |
|
1686 // ---------------------------------------------------------------------------- |
|
1687 // |
|
1688 void CPmapCmd::DoCancel() |
|
1689 { |
|
1690 if ( IsActive() && iMapView ) |
|
1691 { |
|
1692 iMapView->Cancel(); |
|
1693 } |
|
1694 Reset(); |
|
1695 } |
|
1696 |
|
1697 // ---------------------------------------------------------------------------- |
|
1698 // CPmapCmd::Reset |
|
1699 // Disconnects from provider, when operation is completed |
|
1700 // (other items were commented in a header). |
|
1701 // ---------------------------------------------------------------------------- |
|
1702 // |
|
1703 void CPmapCmd::Reset() |
|
1704 { |
|
1705 if(iMapView) |
|
1706 { |
|
1707 iMapView->ResetLandmarksToShow(); |
|
1708 delete iMapView; |
|
1709 iMapView = NULL; |
|
1710 } |
|
1711 ReleaseLandmarkResources(); |
|
1712 } |
|
1713 |
|
1714 // End of File |