phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
branchRCL_3
changeset 58 d4f567ce2e7c
parent 39 a6539d1e8e43
child 64 c1e8ba0c2b16
equal deleted inserted replaced
57:2666d9724c76 58:d4f567ce2e7c
   205         {
   205         {
   206         *iDestroyedPtr = ETrue;
   206         *iDestroyedPtr = ETrue;
   207         }
   207         }
   208     
   208     
   209     if( iAppServices )
   209     if( iAppServices )
   210     	{
   210         {
   211     	iAppServices->StoreObservationRegister().DeregisterStoreEvents( *this );
   211         iAppServices->StoreObservationRegister().DeregisterStoreEvents( *this );
   212     	}
   212         }
   213     else
   213     else
   214     	{
   214         {
   215     	Phonebook2::Pbk2AppUi()->ApplicationServices().
   215         Phonebook2::Pbk2AppUi()->ApplicationServices().
   216     	        StoreObservationRegister().DeregisterStoreEvents( *this );
   216                 StoreObservationRegister().DeregisterStoreEvents( *this );
   217     	}
   217         }
   218               
   218               
   219     if ( iEikonEnv && iContextMenuBar )
   219     if ( iEikonEnv && iContextMenuBar )
   220         {
   220         {
   221         iEikonEnv->EikAppUi()->RemoveFromStack( iContextMenuBar );
   221         iEikonEnv->EikAppUi()->RemoveFromStack( iContextMenuBar );
   222         delete iContextMenuBar;
   222         delete iContextMenuBar;
   235     delete iFieldFactory;
   235     delete iFieldFactory;
   236     delete iPbk2BaseCommand;
   236     delete iPbk2BaseCommand;
   237     delete iEditorExtension;
   237     delete iEditorExtension;
   238     delete iUiFieldArray;
   238     delete iUiFieldArray;
   239     Release(iExtensionManager);
   239     Release(iExtensionManager);
   240 	delete iTitleText;    
   240     delete iTitleText;    
   241     iTitleText = NULL;
   241     iTitleText = NULL;
   242     delete iStoredTitlePaneText;
   242     delete iStoredTitlePaneText;
   243     iStoredTitlePaneText = NULL;
   243     iStoredTitlePaneText = NULL;
   244 
   244 
   245     delete iConverter;
   245     delete iConverter;
       
   246     delete iDelayDelete;
   246     }
   247     }
   247 
   248 
   248 // --------------------------------------------------------------------------
   249 // --------------------------------------------------------------------------
   249 // CPbk2ContactEditorDlgImpl::NewL
   250 // CPbk2ContactEditorDlgImpl::NewL
   250 // --------------------------------------------------------------------------
   251 // --------------------------------------------------------------------------
   254         CPbk2PresentationContact& aContact,
   255         CPbk2PresentationContact& aContact,
   255         CPbk2FieldPropertyArray& aFieldProperties,
   256         CPbk2FieldPropertyArray& aFieldProperties,
   256         MPbk2EditedContactObserver& aContactObserver,
   257         MPbk2EditedContactObserver& aContactObserver,
   257         MPbk2ContactEditorStrategy& aEditorStrategy,
   258         MPbk2ContactEditorStrategy& aEditorStrategy,
   258         MPbk2ContactEditorContactRelocator& aRelocator)
   259         MPbk2ContactEditorContactRelocator& aRelocator)
   259     {	
   260     {    
   260     CPbk2ContactEditorDlgImpl* self =
   261     CPbk2ContactEditorDlgImpl* self =
   261         new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact,
   262         new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact,
   262             aFieldProperties, aContactObserver,
   263             aFieldProperties, aContactObserver,
   263             aEditorStrategy, aRelocator);
   264             aEditorStrategy, aRelocator);
   264     CleanupStack::PushL(self);
   265     CleanupStack::PushL(self);
   270 // --------------------------------------------------------------------------
   271 // --------------------------------------------------------------------------
   271 // CPbk2ContactEditorDlgImpl::NewL
   272 // CPbk2ContactEditorDlgImpl::NewL
   272 // --------------------------------------------------------------------------
   273 // --------------------------------------------------------------------------
   273 //
   274 //
   274 CPbk2ContactEditorDlgImpl* CPbk2ContactEditorDlgImpl::NewL(
   275 CPbk2ContactEditorDlgImpl* CPbk2ContactEditorDlgImpl::NewL(
   275 		TPbk2ContactEditorParams& aParams,
   276         TPbk2ContactEditorParams& aParams,
   276 		CPbk2PresentationContact& aContact,
   277         CPbk2PresentationContact& aContact,
   277 		CPbk2FieldPropertyArray& aFieldProperties,
   278         CPbk2FieldPropertyArray& aFieldProperties,
   278 		MPbk2EditedContactObserver& aContactObserver,
   279         MPbk2EditedContactObserver& aContactObserver,
   279 		MPbk2ContactEditorStrategy& aEditorStrategy,
   280         MPbk2ContactEditorStrategy& aEditorStrategy,
   280 		MPbk2ContactEditorContactRelocator& aRelocator,
   281         MPbk2ContactEditorContactRelocator& aRelocator,
   281 		MPbk2ApplicationServices* aAppServices,
   282         MPbk2ApplicationServices* aAppServices,
   282 		HBufC* aTitleText )
   283         HBufC* aTitleText )
   283 	{
   284     {
   284 	CPbk2ContactEditorDlgImpl* self =
   285     CPbk2ContactEditorDlgImpl* self =
   285 		new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact,
   286         new ( ELeave ) CPbk2ContactEditorDlgImpl(aParams, aContact,
   286 			aFieldProperties, aContactObserver,
   287             aFieldProperties, aContactObserver,
   287 			aEditorStrategy, aRelocator, aAppServices, aTitleText );
   288             aEditorStrategy, aRelocator, aAppServices, aTitleText );
   288 	CleanupStack::PushL(self);
   289     CleanupStack::PushL(self);
   289 	self->ConstructL();
   290     self->ConstructL();
   290 	CleanupStack::Pop(self);
   291     CleanupStack::Pop(self);
   291 	return self;
   292     return self;
   292 	}
   293     }
   293 
   294 
   294 // --------------------------------------------------------------------------
   295 // --------------------------------------------------------------------------
   295 // CPbk2ContactEditorDlgImpl::ConstructL
   296 // CPbk2ContactEditorDlgImpl::ConstructL
   296 // --------------------------------------------------------------------------
   297 // --------------------------------------------------------------------------
   297 //
   298 //
   333     
   334     
   334     // Register to listen store events, so that we can close editor if
   335     // Register to listen store events, so that we can close editor if
   335     // iContact's store becomes unavailable.
   336     // iContact's store becomes unavailable.
   336     
   337     
   337     /*
   338     /*
   338 	 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
   339      * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
   339 	 */
   340      */
   340     if( iAppServices )
   341     if( iAppServices )
   341     	{
   342         {
   342     	iAppServices->StoreObservationRegister().RegisterStoreEventsL( *this );
   343         iAppServices->StoreObservationRegister().RegisterStoreEventsL( *this );
   343     	iNameFormatter = &iAppServices->NameFormatter();
   344         iNameFormatter = &iAppServices->NameFormatter();
   344     	}
   345         }
   345     else
   346     else
   346     	{
   347         {
   347     	Phonebook2::Pbk2AppUi()->ApplicationServices().
   348         Phonebook2::Pbk2AppUi()->ApplicationServices().
   348 			StoreObservationRegister().RegisterStoreEventsL( *this );
   349             StoreObservationRegister().RegisterStoreEventsL( *this );
   349     	iNameFormatter =
   350         iNameFormatter =
   350     	        &Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter();
   351                 &Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter();
   351     	}
   352         }
   352 
   353 
   353    
   354    
   354     StoreTitlePaneTextL();
   355     StoreTitlePaneTextL();
   355     ConstructContextMenuL();
   356     ConstructContextMenuL();
   356 
   357 
   357     iExtensionManager = CPbk2UIExtensionManager::InstanceL();
   358     iExtensionManager = CPbk2UIExtensionManager::InstanceL();
   358     
   359     
   359     /*
   360     /*
   360 	 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
   361      * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
   361 	 */
   362      */
   362     CVPbkContactManager* manager = NULL;
   363     CVPbkContactManager* manager = NULL;
   363     if( iAppServices )
   364     if( iAppServices )
   364     	{
   365         {
   365     	manager = &iAppServices->ContactManager();
   366         manager = &iAppServices->ContactManager();
   366     	}
   367         }
   367     else
   368     else
   368     	{
   369         {
   369     	manager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager();
   370         manager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager();
   370     	}
   371         }
   371     
   372     
   372     iEditorExtension = iExtensionManager->FactoryL()->
   373     iEditorExtension = iExtensionManager->FactoryL()->
   373         CreatePbk2ContactEditorExtensionL( *manager, iContact, *this );
   374         CreatePbk2ContactEditorExtensionL( *manager, iContact, *this );
   374 
   375 
   375     iFieldFactory = CPbk2ContactEditorFieldFactory::NewL(*this, *iEditorExtension);
   376     iFieldFactory = CPbk2ContactEditorFieldFactory::NewL(*this, *iEditorExtension);
   376     iUiFieldArray = CPbk2ContactEditorFieldArray::NewL(
   377     iUiFieldArray = CPbk2ContactEditorFieldArray::NewL(
   377     *manager, iContact, *this, *iFieldFactory, iAppServices );	
   378     *manager, iContact, *this, *iFieldFactory, iAppServices );    
   378     
   379     
   379     iUseState = EUseReady;
   380     iUseState = EUseReady;
   380     }
   381     }
   381 
   382 
   382 // --------------------------------------------------------------------------
   383 // --------------------------------------------------------------------------
   779     // This is needed here because previous settings might override extension's
   780     // This is needed here because previous settings might override extension's
   780     // buttons.
   781     // buttons.
   781     iEditorExtension->ModifyButtonGroupContainerL(ButtonGroupContainer());
   782     iEditorExtension->ModifyButtonGroupContainerL(ButtonGroupContainer());
   782 
   783 
   783     ConstructNaviPaneL();
   784     ConstructNaviPaneL();
   784 	UpdateTitleL();
   785     UpdateTitleL();
   785     UpdateTitlePictureL();
   786     UpdateTitlePictureL();
   786     }
   787     }
   787 
   788 
   788 // --------------------------------------------------------------------------
   789 // --------------------------------------------------------------------------
   789 // CPbk2ContactEditorDlgImpl::PostLayoutDynInitL
   790 // CPbk2ContactEditorDlgImpl::PostLayoutDynInitL
  1156     iAddressView = adressDlg;
  1157     iAddressView = adressDlg;
  1157     adressDlg->ExecuteLD();
  1158     adressDlg->ExecuteLD();
  1158     iAddressView = NULL;
  1159     iAddressView = NULL;
  1159     iParams.iActiveView = TPbk2ContactEditorParams::EEditorView;
  1160     iParams.iActiveView = TPbk2ContactEditorParams::EEditorView;
  1160     UpdateControlsL();
  1161     UpdateControlsL();
       
  1162     
       
  1163     // The if-expression refers to the situation that need to
       
  1164     // delete editor dialog after address dialog exit completely,
       
  1165     // such as the store-unavailable situation    
       
  1166     if ( iDelayDelete )
       
  1167         {
       
  1168         iDelayDelete->Start( TCallBack( &DelayDlgDeleteCallBack, this ) );
       
  1169         }
       
  1170     }
       
  1171 
       
  1172 // --------------------------------------------------------------------------
       
  1173 // CPbk2ContactEditorDlgImpl::DelayDlgDeleteCallBack
       
  1174 // --------------------------------------------------------------------------
       
  1175 //
       
  1176 TInt CPbk2ContactEditorDlgImpl::DelayDlgDeleteCallBack( TAny* aCallBack )
       
  1177     {
       
  1178     static_cast<CPbk2ContactEditorDlgImpl*>( aCallBack )->DelayDlgDelete();
       
  1179     return EFalse;    
       
  1180     }
       
  1181 
       
  1182 // --------------------------------------------------------------------------
       
  1183 // CPbk2ContactEditorDlgImpl::DelayDlgDelete
       
  1184 // --------------------------------------------------------------------------
       
  1185 //
       
  1186 void CPbk2ContactEditorDlgImpl::DelayDlgDelete()
       
  1187     {
       
  1188     // Need to inform editor-observer that contact editing is
       
  1189     // aborted, at the same time, exit editor dialog directly 
       
  1190     // without saving the changes.
       
  1191     iContactObserver.ContactEditingAborted();
       
  1192     delete this;
  1161     }
  1193     }
  1162 
  1194 
  1163 // --------------------------------------------------------------------------
  1195 // --------------------------------------------------------------------------
  1164 // CPbk2ContactEditorDlgImpl::AddAddressFields
  1196 // CPbk2ContactEditorDlgImpl::AddAddressFields
  1165 // --------------------------------------------------------------------------
  1197 // --------------------------------------------------------------------------
  1932 // CPbk2ContactEditorDlgImpl::CloseDialog
  1964 // CPbk2ContactEditorDlgImpl::CloseDialog
  1933 // --------------------------------------------------------------------------
  1965 // --------------------------------------------------------------------------
  1934 //
  1966 //
  1935 void CPbk2ContactEditorDlgImpl::CloseDialog()
  1967 void CPbk2ContactEditorDlgImpl::CloseDialog()
  1936 	{
  1968 	{
  1937     // Ignor error and close editor without further user interaction
  1969     // Ignore error and close editor without further user interaction
  1938     MVPbkContactObserver::TContactOpResult exitResult;
  1970     MVPbkContactObserver::TContactOpResult exitResult;
  1939     exitResult.iExtension = NULL;
  1971     exitResult.iExtension = NULL;
  1940     exitResult.iStoreContact = NULL;
  1972     exitResult.iStoreContact = NULL;
  1941     exitResult.iOpCode = MVPbkContactObserver::EContactDelete;
  1973     exitResult.iOpCode = MVPbkContactObserver::EContactDelete;
  1942     MPbk2ContactEditorEventObserver::TParams exitParams;
  1974     MPbk2ContactEditorEventObserver::TParams exitParams;
  1955         iExitRecord.Set( EExitApproved );
  1987         iExitRecord.Set( EExitApproved );
  1956         iExitRecord.Set( EExitOrdered );
  1988         iExitRecord.Set( EExitOrdered );
  1957         }
  1989         }
  1958       
  1990       
  1959     ContactEditorOperationCompleted(exitResult, exitParams);
  1991     ContactEditorOperationCompleted(exitResult, exitParams);
  1960 	}
  1992     }
  1961 
  1993 
  1962 // --------------------------------------------------------------------------
  1994 // --------------------------------------------------------------------------
  1963 // CPbk2ContactEditorDlgImpl::ContactEditorOperationFailed
  1995 // CPbk2ContactEditorDlgImpl::ContactEditorOperationFailed
  1964 // --------------------------------------------------------------------------
  1996 // --------------------------------------------------------------------------
  1965 //
  1997 //
  2327 void CPbk2ContactEditorDlgImpl::StoreUnavailable
  2359 void CPbk2ContactEditorDlgImpl::StoreUnavailable
  2328     ( MVPbkContactStore& aContactStore, TInt /*aReason*/ )
  2360     ( MVPbkContactStore& aContactStore, TInt /*aReason*/ )
  2329     {
  2361     {
  2330     if ( &aContactStore == &iContact.ParentStore() )
  2362     if ( &aContactStore == &iContact.ParentStore() )
  2331         {
  2363         {
  2332         /*
  2364         // Use iAppServices if provided. This is to enable editor use outside from pbk2 context		
  2333 		 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
       
  2334 		 */
       
  2335         const CPbk2StoreProperty* property = NULL;
  2365         const CPbk2StoreProperty* property = NULL;
  2336         if( iAppServices )
  2366         if( iAppServices )
  2337         	{
  2367             {
  2338         	property =
  2368             property =
  2339 					iAppServices->StoreProperties().FindProperty
  2369                     iAppServices->StoreProperties().FindProperty
  2340 							( aContactStore.StoreProperties().Uri() );
  2370                             ( aContactStore.StoreProperties().Uri() );
  2341         	}
  2371             }
  2342         else
  2372         else
  2343         	{
  2373             {
  2344         	property =
  2374             property =
  2345 					Phonebook2::Pbk2AppUi()->ApplicationServices().
  2375                     Phonebook2::Pbk2AppUi()->ApplicationServices().
  2346 						StoreProperties().FindProperty
  2376                         StoreProperties().FindProperty
  2347 							( aContactStore.StoreProperties().Uri() );
  2377                             ( aContactStore.StoreProperties().Uri() );
  2348         	}
  2378             }
  2349         
  2379 
  2350 
  2380 
  2351         TPtrC storeName;
  2381         TPtrC storeName;
  2352         if ( property )
  2382         if ( property )
  2353             {
  2383             {
  2354             storeName.Set( property->StoreName() );
  2384             storeName.Set( property->StoreName() );
  2356 
  2386 
  2357         // If this leaves the note is not shown.
  2387         // If this leaves the note is not shown.
  2358         // Cannot do anything about that
  2388         // Cannot do anything about that
  2359         TRAP_IGNORE( ShowStoreNotAvailableNoteL( storeName ) );
  2389         TRAP_IGNORE( ShowStoreNotAvailableNoteL( storeName ) );
  2360 
  2390 
  2361         // Close editor if store which came unavailable is iContact's store
  2391         // If the address dialog is opened, delete address dialog first,
  2362         iContactObserver.ContactEditingAborted();
  2392         // then after address dialog exit completely, delete the editor dialog
  2363         // TryExitL is not called because it would call OkToExitL
  2393         // via DelayDlgDeleteCallBack; if there isn't the address dialog, 
  2364         // which is not wanted
  2394         // delete editor dialog directly.         
  2365         delete this;
  2395         if (iAddressView )
       
  2396             {
       
  2397             // Create the CIdle object to delete editor dialog later.
       
  2398             if ( !iDelayDelete )
       
  2399                 {
       
  2400                 iDelayDelete = CIdle::NewL( CActive::EPriorityStandard );
       
  2401                 }
       
  2402             delete iAddressView;
       
  2403             }
       
  2404        else
       
  2405             {
       
  2406             // At the store unavailable situation, informs editor observer 
       
  2407             // that contact editing is aborted without saving the changes.
       
  2408             iContactObserver.ContactEditingAborted();
       
  2409             delete this;
       
  2410             }
  2366         }
  2411         }
  2367     }
  2412     }
  2368 
  2413 
  2369 // --------------------------------------------------------------------------
  2414 // --------------------------------------------------------------------------
  2370 // CPbk2ContactEditorDlgImpl::HandleStoreEventL
  2415 // CPbk2ContactEditorDlgImpl::HandleStoreEventL
  2473         {
  2518         {
  2474         HBufC* title = NULL;
  2519         HBufC* title = NULL;
  2475         switch (iParams.iActiveView)
  2520         switch (iParams.iActiveView)
  2476             {
  2521             {
  2477             case TPbk2ContactEditorParams::EEditorAddressView:
  2522             case TPbk2ContactEditorParams::EEditorAddressView:
  2478             	if( !iTitleText )
  2523                 if( !iTitleText )
  2479             		{
  2524                     {
  2480             		title = StringLoader::LoadL(R_QTN_PHOB_HEADER_ADDRESS);
  2525                     title = StringLoader::LoadL(R_QTN_PHOB_HEADER_ADDRESS);
  2481             		}
  2526                     }
  2482                 break;
  2527                 break;
  2483             case TPbk2ContactEditorParams::EEditorAddressHomeView:
  2528             case TPbk2ContactEditorParams::EEditorAddressHomeView:
  2484             	if( !iTitleText )
  2529                 if( !iTitleText )
  2485             		{
  2530                     {
  2486             		title = StringLoader::LoadL(
  2531                     title = StringLoader::LoadL(
  2487             				R_QTN_PHOB_HEADER_ADDRESS_HOME);
  2532                             R_QTN_PHOB_HEADER_ADDRESS_HOME);
  2488             		}
  2533                     }
  2489                 break;
  2534                 break;
  2490             case TPbk2ContactEditorParams::EEditorAddressOfficeView:
  2535             case TPbk2ContactEditorParams::EEditorAddressOfficeView:
  2491             	if( !iTitleText )
  2536                 if( !iTitleText )
  2492             		{
  2537                     {
  2493             		title = StringLoader::LoadL(
  2538                     title = StringLoader::LoadL(
  2494             				R_QTN_PHOB_HEADER_ADDRESS_WORK);
  2539                             R_QTN_PHOB_HEADER_ADDRESS_WORK);
  2495             		}
  2540                     }
  2496                 break;
  2541                 break;
  2497             case TPbk2ContactEditorParams::EEditorView:
  2542             case TPbk2ContactEditorParams::EEditorView:
  2498                 {
  2543                 {
  2499                 if ( !iStoreContact )
  2544                 if ( !iStoreContact )
  2500                     {
  2545                     {
  2527                             CleanupStack::PopAndDestroy(uiData);
  2572                             CleanupStack::PopAndDestroy(uiData);
  2528                             }
  2573                             }
  2529                         }
  2574                         }
  2530                     }
  2575                     }
  2531                 if( !iTitleText )
  2576                 if( !iTitleText )
  2532                 	{
  2577                     {
  2533                 	title = iNameFormatter->GetContactTitleOrNullL(iStoreContact->Fields(),
  2578                     title = iNameFormatter->GetContactTitleOrNullL(iStoreContact->Fields(),
  2534                 			KEditorNameFormatFlags);
  2579                             KEditorNameFormatFlags);
  2535                 	}
  2580                     }
  2536                 break;
  2581                 break;
  2537                 }
  2582                 }
  2538             default:
  2583             default:
  2539                 break;
  2584                 break;
  2540             }
  2585             }
  2541         
  2586         
  2542         // if custom title text is provided
  2587         // if custom title text is provided
  2543         if( iTitleText )
  2588         if( iTitleText )
  2544         	{
  2589             {
  2545         	iTitlePane->SetTextL( iTitleText->Des() );
  2590             iTitlePane->SetTextL( iTitleText->Des() );
  2546         	}
  2591             }
  2547         else 
  2592         else 
  2548         	{
  2593             {
  2549         	 if (title)
  2594              if (title)
  2550 				{
  2595                 {
  2551 				iTitlePane->SetText(title);
  2596                 iTitlePane->SetText(title);
  2552 				}
  2597                 }
  2553 			else
  2598             else
  2554 				{
  2599                 {
  2555 				iTitlePane->SetTextL(iEditorStrategy.DefaultTitle());
  2600                 iTitlePane->SetTextL(iEditorStrategy.DefaultTitle());
  2556 				}
  2601                 }
  2557         	}
  2602             }
  2558         }
  2603         }
  2559     CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
  2604     CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
  2560     
  2605     
  2561     if (statusPane)
  2606     if (statusPane)
  2562         {
  2607         {
  2578     if (iTitlePane)
  2623     if (iTitlePane)
  2579         {
  2624         {
  2580         // Update picture in title pane
  2625         // Update picture in title pane
  2581         
  2626         
  2582         /*
  2627         /*
  2583 		 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
  2628          * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
  2584 		 */
  2629          */
  2585         CEikImage* image = NULL;
  2630         CEikImage* image = NULL;
  2586         if( iAppServices )
  2631         if( iAppServices )
  2587         	{
  2632             {
  2588         	image =
  2633             image =
  2589 				Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC
  2634                 Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC
  2590 					( &iContact.StoreContact(),
  2635                     ( &iContact.StoreContact(),
  2591 							iAppServices->StoreProperties() );
  2636                             iAppServices->StoreProperties() );
  2592         	}
  2637             }
  2593         else
  2638         else
  2594         	{
  2639             {
  2595         	image =
  2640             image =
  2596 				Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC
  2641                 Pbk2TitlePanePictureFactory::CreateTitlePanePictureLC
  2597 					( &iContact.StoreContact(),
  2642                     ( &iContact.StoreContact(),
  2598 					  Phonebook2::Pbk2AppUi()->ApplicationServices().
  2643                       Phonebook2::Pbk2AppUi()->ApplicationServices().
  2599 						StoreProperties() );
  2644                         StoreProperties() );
  2600         	}
  2645             }
  2601         
  2646         
  2602         
  2647         
  2603         // ownership of the picture is transfered to title pane
  2648         // ownership of the picture is transfered to title pane
  2604         image->SetPictureOwnedExternally( ETrue );
  2649         image->SetPictureOwnedExternally( ETrue );
  2605         iTitlePane->SetSmallPicture(
  2650         iTitlePane->SetSmallPicture(
  2685 
  2730 
  2686         CloseDialog( aOpCode, ETrue );
  2731         CloseDialog( aOpCode, ETrue );
  2687 
  2732 
  2688         // Dialog is closed so there is nothing to do if
  2733         // Dialog is closed so there is nothing to do if
  2689         // HandleCommandL leaves. 
  2734         // HandleCommandL leaves. 
  2690 		TRAP_IGNORE(CEikonEnv::Static()->EikAppUi()->HandleCommandL(aCommandId)); 
  2735         TRAP_IGNORE(CEikonEnv::Static()->EikAppUi()->HandleCommandL(aCommandId)); 
  2691         }
  2736         }
  2692     }
  2737     }
  2693 
  2738 
  2694 // --------------------------------------------------------------------------
  2739 // --------------------------------------------------------------------------
  2695 // CPbk2ContactEditorDlgImpl::CmdAddItemL
  2740 // CPbk2ContactEditorDlgImpl::CmdAddItemL
  2979                     if ( iEndKeyWasPressed )
  3024                     if ( iEndKeyWasPressed )
  2980                         {
  3025                         {
  2981                         CloseDialog();
  3026                         CloseDialog();
  2982                         }
  3027                         }
  2983                     else
  3028                     else
  2984                     	{
  3029                         {
  2985                     	iExitRecord.Clear( EExitOrdered );
  3030                         iExitRecord.Clear( EExitOrdered );
  2986                     	}
  3031                         }
  2987                     }
  3032                     }
  2988                 }
  3033                 }
  2989             }
  3034             }
  2990        else
  3035        else
  2991             {
  3036             {
  3358 // CPbk2ContactEditorDlgImpl::CheckCurrentFieldTextL
  3403 // CPbk2ContactEditorDlgImpl::CheckCurrentFieldTextL
  3359 // --------------------------------------------------------------------------
  3404 // --------------------------------------------------------------------------
  3360 //    
  3405 //    
  3361 void CPbk2ContactEditorDlgImpl::CheckCurrentFieldTextL( 
  3406 void CPbk2ContactEditorDlgImpl::CheckCurrentFieldTextL( 
  3362         CPbk2ContactEditorArrayItem* aCurrentField,
  3407         CPbk2ContactEditorArrayItem* aCurrentField,
  3363 		const TKeyEvent& aKeyEvent, 
  3408         const TKeyEvent& aKeyEvent, 
  3364 		TEventCode aType )
  3409         TEventCode aType )
  3365     {
  3410     {
  3366     MPbk2ContactEditorField* editorField = aCurrentField->ContactEditorField();
  3411     MPbk2ContactEditorField* editorField = aCurrentField->ContactEditorField();
  3367     if ( editorField )
  3412     if ( editorField )
  3368         {
  3413         {
  3369         MVPbkStoreContactField& contactField = editorField->ContactField();
  3414         MVPbkStoreContactField& contactField = editorField->ContactField();