23 #include <MPbk2CommandObserver.h> |
23 #include <MPbk2CommandObserver.h> |
24 #include <MPbk2CommandHandler.h> |
24 #include <MPbk2CommandHandler.h> |
25 #include <MPbk2ApplicationServices.h> |
25 #include <MPbk2ApplicationServices.h> |
26 #include <MPbk2AppUi.h> |
26 #include <MPbk2AppUi.h> |
27 #include <CPbk2FieldPropertyArray.h> |
27 #include <CPbk2FieldPropertyArray.h> |
28 #include <Pbk2MapUIRes.rsg> |
28 #include <pbk2mapuires.rsg> |
29 #include <MPbk2ContactEditorControl.h> |
29 #include <MPbk2ContactEditorControl.h> |
30 #include <MPbk2ContactEditorField.h> |
30 #include <MPbk2ContactEditorField.h> |
31 #include <Pbk2UIControls.hrh> |
31 #include <Pbk2UIControls.hrh> |
32 #include <Pbk2Commands.hrh> |
32 #include <Pbk2Commands.hrh> |
33 #include <Pbk2UIControls.rsg> |
33 #include <pbk2uicontrols.rsg> |
34 #include <TPbk2AddressSelectParams.h> |
34 #include <TPbk2AddressSelectParams.h> |
35 #include <CPbk2AddressSelect.h> |
35 #include <CPbk2AddressSelect.h> |
36 #include <Pbk2AddressTools.h> |
36 #include <Pbk2AddressTools.h> |
37 #include <Pbk2UIControls.rsg> |
|
38 #include <CPbk2ApplicationServices.h> |
37 #include <CPbk2ApplicationServices.h> |
39 #include <pbk2mapcommands.hrh> |
38 #include <pbk2mapcommands.hrh> |
|
39 #include <MPbk2DialogEliminator.h> |
40 |
40 |
41 // Virtual Phonebook |
41 // Virtual Phonebook |
42 #include <MVPbkBaseContactField.h> |
42 #include <MVPbkBaseContactField.h> |
43 #include <MVPbkStoreContact.h> |
43 #include <MVPbkStoreContact.h> |
44 #include <MVPbkContactAttributeManager.h> |
44 #include <MVPbkContactAttributeManager.h> |
47 #include <CVPbkFieldTypeSelector.h> |
47 #include <CVPbkFieldTypeSelector.h> |
48 #include <CVPbkFieldFilter.h> |
48 #include <CVPbkFieldFilter.h> |
49 #include <MVPbkStoreContactField.h> |
49 #include <MVPbkStoreContactField.h> |
50 #include <MVPbkContactFieldData.h> |
50 #include <MVPbkContactFieldData.h> |
51 #include <MVPbkContactFieldTextData.h> |
51 #include <MVPbkContactFieldTextData.h> |
52 #include <VPbkEng.rsg> |
52 #include <vpbkeng.rsg> |
53 #include <MVPbkFieldType.h> |
53 #include <MVPbkFieldType.h> |
54 #include <TVPbkFieldVersitProperty.h> |
54 #include <TVPbkFieldVersitProperty.h> |
55 #include <MVPbkStoreContactFieldCollection.h> |
55 #include <MVPbkStoreContactFieldCollection.h> |
56 #include <TVPbkFieldTypeParameters.h> |
56 #include <TVPbkFieldTypeParameters.h> |
57 #include "MPbk2ContactEditorControlExtension.h" |
57 #include "MPbk2ContactEditorControlExtension.h" |
124 // CPmapCmd::~CPmapCmd |
124 // CPmapCmd::~CPmapCmd |
125 // -------------------------------------------------------------------------- |
125 // -------------------------------------------------------------------------- |
126 // |
126 // |
127 CPmapCmd::~CPmapCmd() |
127 CPmapCmd::~CPmapCmd() |
128 { |
128 { |
|
129 if ( iAddressSelectEliminator ) |
|
130 { |
|
131 iAddressSelectEliminator->ForceExit(); |
|
132 } |
|
133 |
129 Cancel(); |
134 Cancel(); |
130 if(iMapView) |
135 if(iMapView) |
131 { |
136 { |
132 iMapView->ResetLandmarksToShow(); |
137 iMapView->ResetLandmarksToShow(); |
133 delete iMapView; |
138 delete iMapView; |
137 if( iUiControl ) |
142 if( iUiControl ) |
138 { |
143 { |
139 iUiControl->RegisterCommand( NULL ); |
144 iUiControl->RegisterCommand( NULL ); |
140 } |
145 } |
141 delete iMapViewProvider; |
146 delete iMapViewProvider; |
|
147 |
|
148 //Indication that the object has been deleted. |
|
149 if ( iThisPtrDestroyed ) |
|
150 { |
|
151 *iThisPtrDestroyed = ETrue; |
|
152 } |
|
153 |
142 } |
154 } |
143 |
155 |
144 // -------------------------------------------------------------------------- |
156 // -------------------------------------------------------------------------- |
145 // CPmapCmd::NewL |
157 // CPmapCmd::NewL |
146 // -------------------------------------------------------------------------- |
158 // -------------------------------------------------------------------------- |
256 void CPmapCmd::ExecuteL() |
268 void CPmapCmd::ExecuteL() |
257 { |
269 { |
258 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
270 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
259 ("CPmapCmd::ExecuteLD")); |
271 ("CPmapCmd::ExecuteLD")); |
260 |
272 |
|
273 TBool amIDestroyed( EFalse ); |
|
274 iThisPtrDestroyed = &amIDestroyed; |
|
275 |
261 iAddressUpdatePrompt = ETrue; |
276 iAddressUpdatePrompt = ETrue; |
262 TPbk2FieldGroupId groupId = EPbk2FieldGroupIdNone; |
277 TPbk2FieldGroupId groupId = EPbk2FieldGroupIdNone; |
263 if( !IsAddressInContact() ) |
278 if( !IsAddressInContact() ) |
264 { |
279 { |
265 if( iCommandId == EPbk2ExtensionShowOnMap ) |
280 if( iCommandId == EPbk2ExtensionShowOnMap ) |
307 |
322 |
308 if( groupId == EPbk2FieldGroupIdNone ) |
323 if( groupId == EPbk2FieldGroupIdNone ) |
309 { |
324 { |
310 groupId = SelectAddressL(); |
325 groupId = SelectAddressL(); |
311 } |
326 } |
|
327 |
|
328 //This object could have been deleted because of some external activity |
|
329 //Dont proceed if this object is destroyed |
|
330 if ( amIDestroyed ) |
|
331 { |
|
332 return; |
|
333 } |
|
334 |
|
335 iThisPtrDestroyed = NULL; |
312 |
336 |
313 if( groupId != EPbk2FieldGroupIdNone ) |
337 if( groupId != EPbk2FieldGroupIdNone ) |
314 { |
338 { |
315 TVPbkFieldTypeParameter addressType = Pbk2AddressTools::MapAddressToVersitParam( groupId ); |
339 TVPbkFieldTypeParameter addressType = Pbk2AddressTools::MapAddressToVersitParam( groupId ); |
316 if( iCommandId == EPbk2ExtensionShowOnMap ) |
340 if( iCommandId == EPbk2ExtensionShowOnMap ) |
504 params.iCommMethod = VPbkFieldTypeSelectorFactory::EAssignFromMapSelector; |
528 params.iCommMethod = VPbkFieldTypeSelectorFactory::EAssignFromMapSelector; |
505 } |
529 } |
506 |
530 |
507 CleanupStack::PopAndDestroy( appServices ); |
531 CleanupStack::PopAndDestroy( appServices ); |
508 CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( params ); |
532 CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( params ); |
|
533 |
|
534 // Execute |
|
535 iAddressSelectEliminator = addressSelect; |
|
536 iAddressSelectEliminator->ResetWhenDestroyed |
|
537 ( &iAddressSelectEliminator ); |
|
538 |
509 MVPbkStoreContactField* selectedField = addressSelect->ExecuteLD(); |
539 MVPbkStoreContactField* selectedField = addressSelect->ExecuteLD(); |
510 CleanupStack::PopAndDestroy(); // resReader |
540 CleanupStack::PopAndDestroy(); // resReader |
511 |
541 |
512 if ( selectedField ) |
542 if ( selectedField ) |
513 { |
543 { |