236 |
226 |
237 // Remove empty status pane |
227 // Remove empty status pane |
238 if (iNaviContainer) |
228 if (iNaviContainer) |
239 { |
229 { |
240 iNaviContainer->Pop(); |
230 iNaviContainer->Pop(); |
241 TRAP_IGNORE(RestorePrevNaviDecoratorL()); |
231 TRAP_IGNORE(RestorePrevNaviDecoratorL()); |
242 } |
232 } |
243 |
233 |
244 delete iStoreContact; |
234 delete iStoreContact; |
245 delete iFieldFactory; |
235 delete iFieldFactory; |
246 delete iPbk2BaseCommand; |
236 delete iPbk2BaseCommand; |
247 delete iEditorExtension; |
237 delete iEditorExtension; |
248 delete iUiFieldArray; |
238 delete iUiFieldArray; |
249 Release(iExtensionManager); |
239 Release(iExtensionManager); |
250 delete iTitleText; |
240 delete iTitleText; |
251 iTitleText = NULL; |
241 iTitleText = NULL; |
252 delete iStoredTitlePaneText; |
242 delete iStoredTitlePaneText; |
253 iStoredTitlePaneText = NULL; |
243 iStoredTitlePaneText = NULL; |
254 |
244 |
255 delete iConverter; |
245 delete iConverter; |
256 delete iDelayDelete; |
|
257 |
|
258 // The if-expression is used here to Exit Phonebook2 for the case |
|
259 // that Exit phonebook2 with the EditorDlg opened. |
|
260 if ( iExitApp ) |
|
261 { |
|
262 TRAP_IGNORE( ((CAknViewAppUi*)CEikonEnv::Static()->EikAppUi())->ProcessCommandL( EAknCmdExit ) ); |
|
263 } |
|
264 } |
246 } |
265 |
247 |
266 // -------------------------------------------------------------------------- |
248 // -------------------------------------------------------------------------- |
267 // CPbk2ContactEditorDlgImpl::NewL |
249 // CPbk2ContactEditorDlgImpl::NewL |
268 // -------------------------------------------------------------------------- |
250 // -------------------------------------------------------------------------- |
272 CPbk2PresentationContact& aContact, |
254 CPbk2PresentationContact& aContact, |
273 CPbk2FieldPropertyArray& aFieldProperties, |
255 CPbk2FieldPropertyArray& aFieldProperties, |
274 MPbk2EditedContactObserver& aContactObserver, |
256 MPbk2EditedContactObserver& aContactObserver, |
275 MPbk2ContactEditorStrategy& aEditorStrategy, |
257 MPbk2ContactEditorStrategy& aEditorStrategy, |
276 MPbk2ContactEditorContactRelocator& aRelocator) |
258 MPbk2ContactEditorContactRelocator& aRelocator) |
277 { |
259 { |
278 CPbk2ContactEditorDlgImpl* self = |
260 CPbk2ContactEditorDlgImpl* self = |
279 new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact, |
261 new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact, |
280 aFieldProperties, aContactObserver, |
262 aFieldProperties, aContactObserver, |
281 aEditorStrategy, aRelocator); |
263 aEditorStrategy, aRelocator); |
282 CleanupStack::PushL(self); |
264 CleanupStack::PushL(self); |
288 // -------------------------------------------------------------------------- |
270 // -------------------------------------------------------------------------- |
289 // CPbk2ContactEditorDlgImpl::NewL |
271 // CPbk2ContactEditorDlgImpl::NewL |
290 // -------------------------------------------------------------------------- |
272 // -------------------------------------------------------------------------- |
291 // |
273 // |
292 CPbk2ContactEditorDlgImpl* CPbk2ContactEditorDlgImpl::NewL( |
274 CPbk2ContactEditorDlgImpl* CPbk2ContactEditorDlgImpl::NewL( |
293 TPbk2ContactEditorParams& aParams, |
275 TPbk2ContactEditorParams& aParams, |
294 CPbk2PresentationContact& aContact, |
276 CPbk2PresentationContact& aContact, |
295 CPbk2FieldPropertyArray& aFieldProperties, |
277 CPbk2FieldPropertyArray& aFieldProperties, |
296 MPbk2EditedContactObserver& aContactObserver, |
278 MPbk2EditedContactObserver& aContactObserver, |
297 MPbk2ContactEditorStrategy& aEditorStrategy, |
279 MPbk2ContactEditorStrategy& aEditorStrategy, |
298 MPbk2ContactEditorContactRelocator& aRelocator, |
280 MPbk2ContactEditorContactRelocator& aRelocator, |
299 MPbk2ApplicationServices* aAppServices, |
281 MPbk2ApplicationServices* aAppServices, |
300 HBufC* aTitleText ) |
282 HBufC* aTitleText ) |
301 { |
283 { |
302 CPbk2ContactEditorDlgImpl* self = |
284 CPbk2ContactEditorDlgImpl* self = |
303 new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact, |
285 new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact, |
304 aFieldProperties, aContactObserver, |
286 aFieldProperties, aContactObserver, |
305 aEditorStrategy, aRelocator, aAppServices, aTitleText ); |
287 aEditorStrategy, aRelocator, aAppServices, aTitleText ); |
306 CleanupStack::PushL(self); |
288 CleanupStack::PushL(self); |
307 self->ConstructL(); |
289 self->ConstructL(); |
308 CleanupStack::Pop(self); |
290 CleanupStack::Pop(self); |
309 return self; |
291 return self; |
310 } |
292 } |
311 |
293 |
312 // -------------------------------------------------------------------------- |
294 // -------------------------------------------------------------------------- |
313 // CPbk2ContactEditorDlgImpl::ConstructL |
295 // CPbk2ContactEditorDlgImpl::ConstructL |
314 // -------------------------------------------------------------------------- |
296 // -------------------------------------------------------------------------- |
315 // |
297 // |
351 |
333 |
352 // Register to listen store events, so that we can close editor if |
334 // Register to listen store events, so that we can close editor if |
353 // iContact's store becomes unavailable. |
335 // iContact's store becomes unavailable. |
354 |
336 |
355 /* |
337 /* |
356 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context |
338 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context |
357 */ |
339 */ |
358 if( iAppServices ) |
340 if( iAppServices ) |
359 { |
341 { |
360 iAppServices->StoreObservationRegister().RegisterStoreEventsL( *this ); |
342 iAppServices->StoreObservationRegister().RegisterStoreEventsL( *this ); |
361 iNameFormatter = &iAppServices->NameFormatter(); |
343 iNameFormatter = &iAppServices->NameFormatter(); |
362 } |
344 } |
363 else |
345 else |
364 { |
346 { |
365 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
347 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
366 StoreObservationRegister().RegisterStoreEventsL( *this ); |
348 StoreObservationRegister().RegisterStoreEventsL( *this ); |
367 iNameFormatter = |
349 iNameFormatter = |
368 &Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter(); |
350 &Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter(); |
369 } |
351 } |
370 |
352 |
371 |
353 |
372 StoreTitlePaneTextL(); |
354 StoreTitlePaneTextL(); |
373 ConstructContextMenuL(); |
355 ConstructContextMenuL(); |
374 |
356 |
375 iExtensionManager = CPbk2UIExtensionManager::InstanceL(); |
357 iExtensionManager = CPbk2UIExtensionManager::InstanceL(); |
376 |
358 |
377 /* |
359 /* |
378 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context |
360 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context |
379 */ |
361 */ |
380 CVPbkContactManager* manager = NULL; |
362 CVPbkContactManager* manager = NULL; |
381 if( iAppServices ) |
363 if( iAppServices ) |
382 { |
364 { |
383 manager = &iAppServices->ContactManager(); |
365 manager = &iAppServices->ContactManager(); |
384 } |
366 } |
385 else |
367 else |
386 { |
368 { |
387 manager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager(); |
369 manager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager(); |
388 } |
370 } |
389 |
371 |
390 iEditorExtension = iExtensionManager->FactoryL()-> |
372 iEditorExtension = iExtensionManager->FactoryL()-> |
391 CreatePbk2ContactEditorExtensionL( *manager, iContact, *this ); |
373 CreatePbk2ContactEditorExtensionL( *manager, iContact, *this ); |
392 |
374 |
393 iFieldFactory = CPbk2ContactEditorFieldFactory::NewL(*this, *iEditorExtension); |
375 iFieldFactory = CPbk2ContactEditorFieldFactory::NewL(*this, *iEditorExtension); |
394 iUiFieldArray = CPbk2ContactEditorFieldArray::NewL( |
376 iUiFieldArray = CPbk2ContactEditorFieldArray::NewL( |
395 *manager, iContact, *this, *iFieldFactory, iAppServices ); |
377 *manager, iContact, *this, *iFieldFactory, iAppServices ); |
396 |
378 |
397 iUseState = EUseReady; |
379 iUseState = EUseReady; |
398 } |
380 } |
399 |
381 |
400 // -------------------------------------------------------------------------- |
382 // -------------------------------------------------------------------------- |
510 // CPbk2ContactEditorDlgImpl::HandleResourceChange |
492 // CPbk2ContactEditorDlgImpl::HandleResourceChange |
511 // -------------------------------------------------------------------------- |
493 // -------------------------------------------------------------------------- |
512 // |
494 // |
513 void CPbk2ContactEditorDlgImpl::HandleResourceChange( TInt aType ) |
495 void CPbk2ContactEditorDlgImpl::HandleResourceChange( TInt aType ) |
514 { |
496 { |
515 switch ( aType ) |
497 // Handle change in layout orientation |
516 { |
498 if ( aType == KEikDynamicLayoutVariantSwitch ) |
517 case KEikDynamicLayoutVariantSwitch: // Handle change in layout orientation |
499 { |
518 { |
500 // Set status pane layout to the Phonebook 2 one |
519 // Set status pane layout to the Phonebook 2 one |
501 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
520 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
502 if ( statusPane ) |
521 if ( statusPane ) |
503 { |
522 { |
504 iCurrentstatuspane = statusPane->CurrentLayoutResId(); |
523 iCurrentstatuspane = statusPane->CurrentLayoutResId(); |
505 if( iCurrentstatuspane != R_AVKON_STATUS_PANE_LAYOUT_USUAL ) |
524 if( iCurrentstatuspane != R_AVKON_STATUS_PANE_LAYOUT_USUAL ) |
506 { |
525 { |
507 TRAP_IGNORE( statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL) ); |
526 TRAP_IGNORE( |
508 } |
527 statusPane->SwitchLayoutL( |
509 } |
528 R_AVKON_STATUS_PANE_LAYOUT_USUAL ) |
|
529 ); |
|
530 } |
|
531 } |
|
532 } |
|
533 break; |
|
534 case KAknSplitInputEnabled: // Handle split input keyboard |
|
535 { |
|
536 // Sometimes this function will be called continuously |
|
537 // with the same parameter. |
|
538 // Add a flag iIsInputPaneOpen to ensure the dialog |
|
539 // only draw one time. |
|
540 if( !iIsInputPaneOpen ) |
|
541 { |
|
542 Layout(); |
|
543 DrawNow(); |
|
544 iIsInputPaneOpen = ETrue; |
|
545 } |
|
546 } |
|
547 break; |
|
548 case KAknSplitInputDisabled: |
|
549 { |
|
550 // Sometimes this function will be called continuously |
|
551 // with the same parameter. |
|
552 // Add a flag iIsInputPaneOpen to ensure the dialog |
|
553 // only draw one time. |
|
554 if( iIsInputPaneOpen ) |
|
555 { |
|
556 // Set status pane layout to the Phonebook 2 one |
|
557 Layout(); |
|
558 DrawNow(); |
|
559 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
|
560 if ( statusPane ) |
|
561 { |
|
562 TRAP_IGNORE( |
|
563 statusPane->SwitchLayoutL( |
|
564 R_AVKON_STATUS_PANE_LAYOUT_USUAL ) |
|
565 ); |
|
566 } |
|
567 iIsInputPaneOpen = EFalse; |
|
568 } |
|
569 } |
|
570 break; |
|
571 default: |
|
572 break; |
|
573 } |
510 } |
574 |
511 |
575 CAknForm::HandleResourceChange( aType ); |
512 CAknForm::HandleResourceChange( aType ); |
576 } |
513 } |
577 |
514 |
582 void CPbk2ContactEditorDlgImpl::AddItemToContactL |
519 void CPbk2ContactEditorDlgImpl::AddItemToContactL |
583 ( TInt aFieldTypeResourceId, |
520 ( TInt aFieldTypeResourceId, |
584 const TDesC& aFieldTypeXspName, |
521 const TDesC& aFieldTypeXspName, |
585 TBool aSetFocus ) |
522 TBool aSetFocus ) |
586 { |
523 { |
587 // For knowing whether the destructor has been called |
|
588 TBool destroyed = EFalse; |
|
589 iDestroyedPtrForAddItem = &destroyed; |
|
590 // Store the original parameter value, since it is |
524 // Store the original parameter value, since it is |
591 // changed by AddFieldsL |
525 // changed by AddFieldsL |
592 TInt origParam = aFieldTypeResourceId; |
526 TInt origParam = aFieldTypeResourceId; |
593 TPtrC xSpName = aFieldTypeXspName; |
527 TPtrC xSpName = aFieldTypeXspName; |
594 |
528 |
595 CPbk2AddItemManager* addItemManager = CPbk2AddItemManager::NewL |
529 CPbk2AddItemManager* addItemManager = CPbk2AddItemManager::NewL |
596 (iContact, *iUiFieldArray, iParams, iAppServices ); |
530 (iContact, *iUiFieldArray, iParams, iAppServices ); |
597 CleanupStack::PushL(addItemManager); |
531 CleanupStack::PushL(addItemManager); |
598 CPbk2AddItemManager::TReturnValue ret = addItemManager->AddFieldsL( |
532 CPbk2AddItemManager::TReturnValue ret = addItemManager->AddFieldsL( |
599 aFieldTypeResourceId, xSpName); |
533 aFieldTypeResourceId, xSpName); |
600 |
534 |
601 // In case that pop list for adding item is closed by FSW, this object |
535 if (ret.iControlId == KErrAlreadyExists) |
602 // will be destructed by CPbk2ContactEditorOperator::ForceExit(). |
536 { |
603 // If this object is destructed, don't execute the following anymore. |
537 // cannot add more than one of this field type |
604 if ( !destroyed ) |
538 // find and focus that |
605 { |
539 TInt fieldArrayCount( iUiFieldArray->Count() ); |
606 if (ret.iControlId == KErrAlreadyExists) |
540 for (TInt i(0); i < fieldArrayCount && ret.iControlId |
607 { |
541 == KErrAlreadyExists; ++i) |
608 // cannot add more than one of this field type |
542 { |
609 // find and focus that |
543 if (!iUiFieldArray->At(i).ContactEditorField()) |
610 TInt fieldArrayCount( iUiFieldArray->Count() ); |
544 { |
611 for (TInt i(0); i < fieldArrayCount && ret.iControlId |
545 continue; |
612 == KErrAlreadyExists; ++i) |
546 } |
613 { |
547 const MVPbkFieldType* fieldType = |
614 if (!iUiFieldArray->At(i).ContactEditorField()) |
548 iUiFieldArray->At(i).ContactEditorField()->ContactField(). |
|
549 BestMatchingFieldType(); |
|
550 if(fieldType && fieldType->FieldTypeResId() == aFieldTypeResourceId) |
|
551 { |
|
552 ret.iControlId = iUiFieldArray->At(i).ControlId(); |
|
553 } |
|
554 } |
|
555 } |
|
556 |
|
557 if (ret.iControlId > 0) |
|
558 { |
|
559 if (aSetFocus) |
|
560 { |
|
561 TryChangeFocusL(ret.iControlId); |
|
562 MPbk2ContactEditorField* editorField = iUiFieldArray->Find( ret.iControlId )->ContactEditorField(); |
|
563 MVPbkStoreContactField& storeContactField = editorField->ContactField(); |
|
564 iParams.iFocusedContactField = &storeContactField; |
|
565 // Call this after adding or deleting lines |
|
566 UpdatePageL( ETrue ); |
|
567 // Must be DrawNow and not DrawDeferred otherwise field label |
|
568 // and content of the following field will be incorrect |
|
569 DrawNow(); |
|
570 } |
|
571 } |
|
572 else if (ret.iControlId == KErrNotSupported && origParam == KErrNotFound) |
|
573 { |
|
574 iUiFieldArray->SaveFieldsL(); |
|
575 iRelocator.RelocateContactL(aFieldTypeResourceId, xSpName, |
|
576 Pbk2ContactRelocator::EPbk2DisplayStoreDoesNotSupportQuery); |
|
577 } |
|
578 else if ( iParams.iActiveView == TPbk2ContactEditorParams::EEditorView ) |
|
579 { |
|
580 switch( ret.iGruopId ) |
|
581 { |
|
582 case EPbk2FieldGroupIdPostalAddress: |
|
583 if(iUiFieldArray->Count()) |
615 { |
584 { |
616 continue; |
585 iUiFieldArray->AddNewFieldL( ret.iGruopId ); |
|
586 ExecuteAddressDlgL( TPbk2ContactEditorParams::EEditorAddressView ); |
617 } |
587 } |
618 const MVPbkFieldType* fieldType = |
588 break; |
619 iUiFieldArray->At(i).ContactEditorField()->ContactField(). |
589 case EPbk2FieldGroupIdHomeAddress: |
620 BestMatchingFieldType(); |
590 iUiFieldArray->AddNewFieldL( ret.iGruopId ); |
621 if(fieldType && fieldType->FieldTypeResId() == aFieldTypeResourceId) |
591 ExecuteAddressDlgL( TPbk2ContactEditorParams::EEditorAddressHomeView ); |
622 { |
592 break; |
623 ret.iControlId = iUiFieldArray->At(i).ControlId(); |
593 case EPbk2FieldGroupIdCompanyAddress: |
624 } |
594 iUiFieldArray->AddNewFieldL( ret.iGruopId ); |
625 } |
595 ExecuteAddressDlgL( TPbk2ContactEditorParams::EEditorAddressOfficeView ); |
626 } |
596 break; |
627 |
597 } |
628 if (ret.iControlId > 0) |
|
629 { |
|
630 if (aSetFocus) |
|
631 { |
|
632 TryChangeFocusL(ret.iControlId); |
|
633 MPbk2ContactEditorField* editorField = iUiFieldArray->Find( ret.iControlId )->ContactEditorField(); |
|
634 MVPbkStoreContactField& storeContactField = editorField->ContactField(); |
|
635 iParams.iFocusedContactField = &storeContactField; |
|
636 // Call this after adding or deleting lines |
|
637 UpdatePageL( ETrue ); |
|
638 // Must be DrawNow and not DrawDeferred otherwise field label |
|
639 // and content of the following field will be incorrect |
|
640 DrawNow(); |
|
641 } |
|
642 } |
|
643 else if (ret.iControlId == KErrNotSupported && origParam == KErrNotFound) |
|
644 { |
|
645 iUiFieldArray->SaveFieldsL(); |
|
646 iRelocator.RelocateContactL(aFieldTypeResourceId, xSpName, |
|
647 Pbk2ContactRelocator::EPbk2DisplayStoreDoesNotSupportQuery); |
|
648 } |
|
649 else if ( iParams.iActiveView == TPbk2ContactEditorParams::EEditorView ) |
|
650 { |
|
651 switch( ret.iGruopId ) |
|
652 { |
|
653 case EPbk2FieldGroupIdPostalAddress: |
|
654 if(iUiFieldArray->Count()) |
|
655 { |
|
656 iUiFieldArray->AddNewFieldL( ret.iGruopId ); |
|
657 ExecuteAddressDlgL( TPbk2ContactEditorParams::EEditorAddressView ); |
|
658 } |
|
659 break; |
|
660 case EPbk2FieldGroupIdHomeAddress: |
|
661 iUiFieldArray->AddNewFieldL( ret.iGruopId ); |
|
662 ExecuteAddressDlgL( TPbk2ContactEditorParams::EEditorAddressHomeView ); |
|
663 break; |
|
664 case EPbk2FieldGroupIdCompanyAddress: |
|
665 iUiFieldArray->AddNewFieldL( ret.iGruopId ); |
|
666 ExecuteAddressDlgL( TPbk2ContactEditorParams::EEditorAddressOfficeView ); |
|
667 break; |
|
668 } |
|
669 } |
|
670 iDestroyedPtrForAddItem = NULL; |
|
671 } |
598 } |
672 CleanupStack::PopAndDestroy(addItemManager); |
599 CleanupStack::PopAndDestroy(addItemManager); |
673 } |
600 } |
674 |
601 |
675 // -------------------------------------------------------------------------- |
602 // -------------------------------------------------------------------------- |
794 { |
713 { |
795 iContextMenuBar->TryDisplayMenuBarL(); |
714 iContextMenuBar->TryDisplayMenuBarL(); |
796 ret = EKeyWasConsumed; |
715 ret = EKeyWasConsumed; |
797 } |
716 } |
798 |
717 |
799 if ( ret != EKeyWasConsumed ) |
718 if ( ret != EKeyWasConsumed && !iEndKeyWasPressed ) |
800 { |
719 { |
801 // If the iEndKeyWasPressed equels to true, which illustrates |
720 if ( aKeyEvent.iCode == EKeyEscape ) |
802 // the EditorDlgImpl get the Escape key event one more time |
721 { |
803 // for the case that Exit phonebook2 with the EditorDlg opened, |
722 iEditorStrategy.StopQuery(); |
804 // sush as save VOIP settings,there will be two event, |
723 iEndKeyWasPressed = ETrue; |
805 // one is to close dialog and the other is to exit phonebook2. |
724 } |
806 if ( iEndKeyWasPressed ) |
725 ret = CAknForm::OfferKeyEventL( aKeyEvent, aType ); |
807 { |
726 if ( ret == EKeyWasConsumed && |
808 if ( aKeyEvent.iCode == EKeyEscape && iAvkonAppUi->IsAppShutterRunning() ) |
727 aKeyEvent.iCode != EKeyPhoneEnd && aKeyEvent.iCode != EKeyEscape ) |
809 { |
728 { |
810 // Use the iExitApp to record whether the AppShutter is running. |
729 UpdateCbasL(); |
811 // According to the value of iExitApp to Exit Phonebook2 app ui |
730 } |
812 // after the EditorDlg close completely. |
|
813 iExitApp = ETrue; |
|
814 } |
|
815 } |
|
816 else |
|
817 { |
|
818 if ( aKeyEvent.iCode == EKeyEscape ) |
|
819 { |
|
820 iEditorStrategy.StopQuery(); |
|
821 iEndKeyWasPressed = ETrue; |
|
822 } |
|
823 ret = CAknForm::OfferKeyEventL( aKeyEvent, aType ); |
|
824 if ( ret == EKeyWasConsumed && aKeyEvent.iCode != EKeyPhoneEnd |
|
825 && aKeyEvent.iCode != EKeyEscape ) |
|
826 { |
|
827 UpdateCbasL(); |
|
828 } |
|
829 } |
|
830 } |
731 } |
831 |
732 |
832 return ret; |
733 return ret; |
833 } |
734 } |
834 |
735 |
1255 iAddressView = adressDlg; |
1156 iAddressView = adressDlg; |
1256 adressDlg->ExecuteLD(); |
1157 adressDlg->ExecuteLD(); |
1257 iAddressView = NULL; |
1158 iAddressView = NULL; |
1258 iParams.iActiveView = TPbk2ContactEditorParams::EEditorView; |
1159 iParams.iActiveView = TPbk2ContactEditorParams::EEditorView; |
1259 UpdateControlsL(); |
1160 UpdateControlsL(); |
1260 |
|
1261 // The if-expression refers to the situation that need to |
|
1262 // delete editor dialog after address dialog exit completely, |
|
1263 // such as the store-unavailable situation |
|
1264 if ( iDelayDelete ) |
|
1265 { |
|
1266 iDelayDelete->Start( TCallBack( &DelayDlgDeleteCallBack, this ) ); |
|
1267 } |
|
1268 } |
|
1269 |
|
1270 // -------------------------------------------------------------------------- |
|
1271 // CPbk2ContactEditorDlgImpl::DelayDlgDeleteCallBack |
|
1272 // -------------------------------------------------------------------------- |
|
1273 // |
|
1274 TInt CPbk2ContactEditorDlgImpl::DelayDlgDeleteCallBack( TAny* aCallBack ) |
|
1275 { |
|
1276 static_cast<CPbk2ContactEditorDlgImpl*>( aCallBack )->DelayDlgDelete(); |
|
1277 return EFalse; |
|
1278 } |
|
1279 |
|
1280 // -------------------------------------------------------------------------- |
|
1281 // CPbk2ContactEditorDlgImpl::DelayDlgDelete |
|
1282 // -------------------------------------------------------------------------- |
|
1283 // |
|
1284 void CPbk2ContactEditorDlgImpl::DelayDlgDelete() |
|
1285 { |
|
1286 // Need to inform editor-observer that contact editing is |
|
1287 // aborted, at the same time, exit editor dialog directly |
|
1288 // without saving the changes. |
|
1289 iContactObserver.ContactEditingAborted(); |
|
1290 delete this; |
|
1291 } |
1161 } |
1292 |
1162 |
1293 // -------------------------------------------------------------------------- |
1163 // -------------------------------------------------------------------------- |
1294 // CPbk2ContactEditorDlgImpl::AddAddressFields |
1164 // CPbk2ContactEditorDlgImpl::AddAddressFields |
1295 // -------------------------------------------------------------------------- |
1165 // -------------------------------------------------------------------------- |
2489 |
2356 |
2490 // If this leaves the note is not shown. |
2357 // If this leaves the note is not shown. |
2491 // Cannot do anything about that |
2358 // Cannot do anything about that |
2492 TRAP_IGNORE( ShowStoreNotAvailableNoteL( storeName ) ); |
2359 TRAP_IGNORE( ShowStoreNotAvailableNoteL( storeName ) ); |
2493 |
2360 |
2494 // If the address dialog is opened, delete address dialog first, |
2361 // Close editor if store which came unavailable is iContact's store |
2495 // then after address dialog exit completely, delete the editor dialog |
2362 iContactObserver.ContactEditingAborted(); |
2496 // via DelayDlgDeleteCallBack; if there isn't the address dialog, |
2363 // TryExitL is not called because it would call OkToExitL |
2497 // delete editor dialog directly. |
2364 // which is not wanted |
2498 if (iAddressView ) |
2365 delete this; |
2499 { |
|
2500 // Create the CIdle object to delete editor dialog later. |
|
2501 if ( !iDelayDelete ) |
|
2502 { |
|
2503 iDelayDelete = CIdle::NewL( CActive::EPriorityStandard ); |
|
2504 } |
|
2505 delete iAddressView; |
|
2506 iAddressView = NULL; |
|
2507 } |
|
2508 else |
|
2509 { |
|
2510 // At the store unavailable situation, informs editor observer |
|
2511 // that contact editing is aborted without saving the changes. |
|
2512 iContactObserver.ContactEditingAborted(); |
|
2513 delete this; |
|
2514 } |
|
2515 } |
2366 } |
2516 } |
2367 } |
2517 |
2368 |
2518 // -------------------------------------------------------------------------- |
2369 // -------------------------------------------------------------------------- |
2519 // CPbk2ContactEditorDlgImpl::HandleStoreEventL |
2370 // CPbk2ContactEditorDlgImpl::HandleStoreEventL |
2727 if (iTitlePane) |
2578 if (iTitlePane) |
2728 { |
2579 { |
2729 // Update picture in title pane |
2580 // Update picture in title pane |
2730 |
2581 |
2731 /* |
2582 /* |
2732 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context |
2583 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context |
2733 */ |
2584 */ |
2734 CEikImage* image = NULL; |
2585 CEikImage* image = NULL; |
2735 if( iAppServices ) |
2586 if( iAppServices ) |
2736 { |
2587 { |
2737 image = |
2588 image = |
2738 Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC |
2589 Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC |
2739 ( &iContact.StoreContact(), |
2590 ( &iContact.StoreContact(), |
2740 iAppServices->StoreProperties() ); |
2591 iAppServices->StoreProperties() ); |
2741 } |
2592 } |
2742 else |
2593 else |
2743 { |
2594 { |
2744 image = |
2595 image = |
2745 Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC |
2596 Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC |
2746 ( &iContact.StoreContact(), |
2597 ( &iContact.StoreContact(), |
2747 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
2598 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
2748 StoreProperties() ); |
2599 StoreProperties() ); |
2749 } |
2600 } |
2750 |
2601 |
2751 |
2602 |
2752 // ownership of the picture is transfered to title pane |
2603 // ownership of the picture is transfered to title pane |
2753 image->SetPictureOwnedExternally( ETrue ); |
2604 image->SetPictureOwnedExternally( ETrue ); |
2754 iTitlePane->SetSmallPicture( |
2605 iTitlePane->SetSmallPicture( |
2799 } |
2650 } |
2800 |
2651 |
2801 // In VOIP/new contacts/exit case, this object will be destructed by |
2652 // In VOIP/new contacts/exit case, this object will be destructed by |
2802 // iContactObserver.ContactEditingComplete() above. |
2653 // iContactObserver.ContactEditingComplete() above. |
2803 // If this object is destructed, don't excute the following anymore |
2654 // If this object is destructed, don't excute the following anymore |
2804 if ( !destroyed ) |
2655 if ( destroyed ) |
2805 { |
2656 { |
2806 // Don't save any contact data (already saved) |
2657 return; |
2807 iExitRecord.Set(EOkToExitWithoutHandlingIt); |
2658 } |
2808 iExitRecord.Clear(EExitOrdered); |
2659 |
2809 |
2660 // Don't save any contact data (already saved) |
2810 // Close dialog using TryExitL and returning ETrue from OkToExit |
2661 iExitRecord.Set(EOkToExitWithoutHandlingIt); |
2811 TInt err = KErrNone; |
2662 iExitRecord.Clear(EExitOrdered); |
2812 TRAP( err, TryExitL( EAknSoftkeyBack ) ); |
2663 |
2813 if (err != KErrNone) |
2664 // Close dialog using TryExitL and returning ETrue from OkToExit |
2814 { |
2665 TInt err = KErrNone; |
2815 // If not nicely then use the force. |
2666 TRAP( err, TryExitL( EAknSoftkeyBack ) ); |
2816 delete this; |
2667 if (err != KErrNone) |
2817 } |
2668 { |
2818 iDestroyedPtrForCloseDlg = NULL; |
2669 // If not nicely then use the force. |
|
2670 delete this; |
2819 } |
2671 } |
2820 } |
2672 } |
2821 |
2673 |
2822 // -------------------------------------------------------------------------- |
2674 // -------------------------------------------------------------------------- |
2823 // CPbk2ContactEditorDlgImpl::ExitApplication |
2675 // CPbk2ContactEditorDlgImpl::ExitApplication |
2963 switch(uiField->UIField()->CtrlType()) |
2815 switch(uiField->UIField()->CtrlType()) |
2964 { |
2816 { |
2965 case EPbk2FieldCtrlTypeExtAddressEditor: |
2817 case EPbk2FieldCtrlTypeExtAddressEditor: |
2966 case EPbk2FieldCtrlTypeExtAddressHomeEditor: |
2818 case EPbk2FieldCtrlTypeExtAddressHomeEditor: |
2967 case EPbk2FieldCtrlTypeExtAddressOfficeEditor: |
2819 case EPbk2FieldCtrlTypeExtAddressOfficeEditor: |
2968 { |
2820 if(IsAddressValidated(Pbk2AddressTools::MapCtrlTypeToAddress( |
2969 TInt iconId = 0; |
2821 uiField->UIField()->CtrlType()))) |
2970 // UnSync feature indicator flag and chinese flag |
|
2971 TBool supportUnSyncFeature = |
|
2972 FeatureManager::FeatureSupported( |
|
2973 KFeatureIdFfTdUnSyncabPbfieldsInd ); |
|
2974 TBool supportChinese = |
|
2975 FeatureManager::FeatureSupported( KFeatureIdChinese ); |
|
2976 // Valid address |
|
2977 TBool addressValidated = |
|
2978 IsAddressValidated( |
|
2979 Pbk2AddressTools::MapCtrlTypeToAddress( |
|
2980 uiField->UIField()->CtrlType())); |
|
2981 if(supportChinese && supportUnSyncFeature) |
|
2982 { |
2822 { |
2983 // Unsync icon |
2823 TPbk2IconId iconID(TUid::Uid(KPbk2UID3), EPbk2qgn_prop_locev_map); |
2984 iconId = EPbk2qgn_prop_phonebook2_unsync; |
2824 uiField->LoadBitmapToFieldL(iconID); |
2985 } |
2825 } |
2986 else |
2826 else |
2987 { |
2827 { |
2988 iconId = addressValidated ? |
2828 TPbk2IconId iconID(TUid::Uid(KPbk2UID3), EPbk2qgn_prop_pb_no_valid_lm); |
2989 EPbk2qgn_prop_locev_map : EPbk2qgn_prop_pb_no_valid_lm; |
2829 uiField->LoadBitmapToFieldL(iconID); |
2990 } |
2830 } |
2991 TPbk2IconId pbkIconId(TUid::Uid(KPbk2UID3),iconId); |
|
2992 uiField->LoadBitmapToFieldL(pbkIconId); |
|
2993 } |
|
2994 break; |
2831 break; |
2995 case EPbk2FieldCtrlTypeExtAssignFromMapsEditor: |
2832 case EPbk2FieldCtrlTypeExtAssignFromMapsEditor: |
2996 { |
2833 if(IsAddressValidated( Pbk2AddressTools::MapViewTypeToAddress(iParams.iActiveView))) |
2997 // UnSync feature indicator flag and chinese flag |
|
2998 TBool supportUnSyncFeature = |
|
2999 FeatureManager::FeatureSupported( |
|
3000 KFeatureIdFfTdUnSyncabPbfieldsInd ); |
|
3001 TBool supportChinese = |
|
3002 FeatureManager::FeatureSupported( KFeatureIdChinese ); |
|
3003 |
|
3004 TBool addressValidated = |
|
3005 IsAddressValidated( |
|
3006 Pbk2AddressTools::MapViewTypeToAddress( iParams.iActiveView )); |
|
3007 TInt iconId = 0; |
|
3008 if( supportChinese && supportUnSyncFeature ) |
|
3009 { |
2834 { |
3010 iconId = EPbk2qgn_prop_phonebook2_unsync; |
2835 TPbk2IconId iconID(TUid::Uid(KPbk2UID3), EPbk2qgn_prop_locev_map); |
3011 } |
2836 uiField->LoadBitmapToFieldL(iconID); |
3012 else |
2837 } |
3013 { |
2838 else |
3014 iconId = addressValidated ? |
2839 { |
3015 EPbk2qgn_prop_locev_map : EPbk2qgn_prop_pb_no_valid_lm; |
2840 TPbk2IconId iconID(TUid::Uid(KPbk2UID3), EPbk2qgn_prop_pb_no_valid_lm); |
3016 } |
2841 uiField->LoadBitmapToFieldL(iconID); |
3017 TPbk2IconId pbkIconId(TUid::Uid(KPbk2UID3),iconId); |
2842 } |
3018 uiField->LoadBitmapToFieldL(pbkIconId); |
2843 break; |
3019 } |
|
3020 break; |
|
3021 default: |
2844 default: |
3022 return; |
2845 return; |
3023 } |
2846 } |
3024 } |
2847 } |
3025 } |
2848 } |