phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
branchRCL_3
changeset 3 04ab22b956c2
parent 0 e686773b3f54
child 7 b3431bff8c19
equal deleted inserted replaced
0:e686773b3f54 3:04ab22b956c2
    77 #include <MVPbkContactFieldTextData.h>
    77 #include <MVPbkContactFieldTextData.h>
    78 #include <MVPbkContactStoreProperties.h>
    78 #include <MVPbkContactStoreProperties.h>
    79 #include <MVPbkContactFieldData.h>
    79 #include <MVPbkContactFieldData.h>
    80 #include <MVPbkFieldType.h>
    80 #include <MVPbkFieldType.h>
    81 #include <TVPbkFieldVersitProperty.h>
    81 #include <TVPbkFieldVersitProperty.h>
    82 #include <ccappmycardpluginrsc.rsg>
       
    83 
    82 
    84 #include <VPbkEng.rsg> 
    83 #include <VPbkEng.rsg> 
    85 #include <VPbkFieldType.hrh>
    84 #include <VPbkFieldType.hrh>
    86 #include <VPbkContactStoreUris.h>
    85 #include <VPbkContactStoreUris.h>
    87 
    86 
    93 #include <barsread.h>
    92 #include <barsread.h>
    94 #include <aknnotewrappers.h>
    93 #include <aknnotewrappers.h>
    95 #include <hlplch.h>
    94 #include <hlplch.h>
    96 #include <aknnavide.h>
    95 #include <aknnavide.h>
    97 #include <akninputblock.h>
    96 #include <akninputblock.h>
    98 #include <coemain.h>
       
    99 
       
   100 _LIT( KCCAppMyCardPluginResFileName, "\\resource\\ccappmycardpluginrsc.rsc");
       
   101 
    97 
   102 /// Unnamed namespace for local definitions
    98 /// Unnamed namespace for local definitions
   103 namespace {
    99 namespace {
   104 
   100 
   105 const TInt KEditorNameFormatFlags = MPbk2ContactNameFormatter::EUseSeparator;
   101 const TInt KEditorNameFormatFlags = MPbk2ContactNameFormatter::EUseSeparator;
   173         iContactObserver( aContactObserver ),
   169         iContactObserver( aContactObserver ),
   174         iRelocator( aRelocator ),
   170         iRelocator( aRelocator ),
   175         iEndKeyWasPressed( EFalse ),
   171         iEndKeyWasPressed( EFalse ),
   176         iAddressViewStandalone( EFalse ),
   172         iAddressViewStandalone( EFalse ),
   177         iAppServices( aAppServices ),
   173         iAppServices( aAppServices ),
   178         iTitleText( aTitleText ),
   174         iTitleText( aTitleText )
   179         iPbk2UiResource( *CCoeEnv::Static() )        
       
   180     {
   175     {
   181     // Exit is approved by default
   176     // Exit is approved by default
   182     iExitRecord.Set( EExitApproved );
   177     iExitRecord.Set( EExitApproved );
   183     }
   178     }
   184 
   179 
   217         }
   212         }
   218 
   213 
   219     // Restore the titlepane text
   214     // Restore the titlepane text
   220     if (iTitlePane && iStoredTitlePaneText)
   215     if (iTitlePane && iStoredTitlePaneText)
   221         {
   216         {
   222         // iTitlePane takes ownership of iStoredTitlePaneText
   217         iTitlePane->SetTextL(*iStoredTitlePaneText);
   223         iTitlePane->SetText(iStoredTitlePaneText);
       
   224         }
   218         }
   225 
   219 
   226     // Reset title pane picture
   220     // Reset title pane picture
   227     if( iTitlePane )
   221     if( iTitlePane )
   228         {
   222         {
   239     delete iFieldFactory;
   233     delete iFieldFactory;
   240     delete iPbk2BaseCommand;
   234     delete iPbk2BaseCommand;
   241     delete iEditorExtension;
   235     delete iEditorExtension;
   242     delete iUiFieldArray;
   236     delete iUiFieldArray;
   243     Release(iExtensionManager);
   237     Release(iExtensionManager);
   244         
       
   245     if( iCommandId == EEikCmdExit || iCommandId == EAknCmdExit )
       
   246 		{	
       
   247 		CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() );      		
       
   248 			
       
   249 		if( appUi )
       
   250 			{
       
   251 			TFileName file;
       
   252 			file.Copy( KCCAppMyCardPluginResFileName );
       
   253 			iPbk2UiResource.OpenL( file );
       
   254 		
       
   255 			HBufC* title = StringLoader::LoadLC( R_QTN_MYCARD_EDITOR_TITLE );	
       
   256 			
       
   257 			iPbk2UiResource.Close();			
       
   258 			TBool okToExit = EFalse;
       
   259 			
       
   260 			if( iTitleText && iTitleText->CompareC( title->Des() ) == 0 )
       
   261 				{
       
   262 				okToExit = ETrue;
       
   263 				}
       
   264 			
       
   265 			CleanupStack::PopAndDestroy(); // title
       
   266 								
       
   267 			if ( okToExit )
       
   268 				{
       
   269 				appUi->ProcessCommandL( EAknCmdExit );
       
   270 				}								
       
   271 			}
       
   272 		}    
       
   273     
       
   274 	delete iTitleText;    
   238 	delete iTitleText;    
       
   239     iTitleText = NULL;
       
   240     delete iStoredTitlePaneText;
       
   241     iStoredTitlePaneText = NULL;
   275     }
   242     }
   276 
   243 
   277 // --------------------------------------------------------------------------
   244 // --------------------------------------------------------------------------
   278 // CPbk2ContactEditorDlgImpl::NewL
   245 // CPbk2ContactEditorDlgImpl::NewL
   279 // --------------------------------------------------------------------------
   246 // --------------------------------------------------------------------------
   903     if (!iEditorExtension->ProcessCommandL(aCommandId) &&
   870     if (!iEditorExtension->ProcessCommandL(aCommandId) &&
   904         !CheckBaseCommandL(aCommandId) &&
   871         !CheckBaseCommandL(aCommandId) &&
   905         !CheckFieldSpecificCommandL(aCommandId) &&
   872         !CheckFieldSpecificCommandL(aCommandId) &&
   906         iExitRecord.IsClear( EExitOrdered ) )
   873         iExitRecord.IsClear( EExitOrdered ) )
   907         {
   874         {
   908 		iCommandId = aCommandId;
       
   909     
       
   910         switch (aCommandId)
   875         switch (aCommandId)
   911             {
   876             {
   912             case EPbk2CmdAddItem:
   877             case EPbk2CmdAddItem:
   913                 {
   878                 {
   914                 CmdAddItemL();
   879                 CmdAddItemL();
  1513     CEikMenuPane* aMenuPane, 
  1478     CEikMenuPane* aMenuPane, 
  1514     MPbk2ContactEditorField& aCurrentField )
  1479     MPbk2ContactEditorField& aCurrentField )
  1515     {
  1480     {
  1516     TInt id = aCurrentField.FieldProperty().FieldType().FieldTypeResId();  
  1481     TInt id = aCurrentField.FieldProperty().FieldType().FieldTypeResId();  
  1517     
  1482     
  1518     if(id != R_VPBK_FIELD_TYPE_SYNCCLASS) 
  1483     // If the selection popup is open, hide menu option "Change" 
  1519         {
  1484     if( id == R_VPBK_FIELD_TYPE_SYNCCLASS ) 
       
  1485         {
       
  1486         CEikCaptionedControl* line=CurrentLine();  
       
  1487         if ( line && (line->iControlType == EAknCtPopupField || line->iControlType == EAknCtPopupFieldText ) )
       
  1488             {
       
  1489             CAknPopupField* ctrl = static_cast<CAknPopupField*>( line->iControl );
       
  1490             if ( ctrl && ctrl->NumLines() > 1 ) 
       
  1491                 {
       
  1492                 DimItem( aMenuPane, EPbk2CmdEditorChangeSync);
       
  1493                 }
       
  1494             }
       
  1495         }
       
  1496     else  // id != R_VPBK_FIELD_TYPE_SYNCCLASS
       
  1497         { 
  1520         DimItem( aMenuPane,  EPbk2CmdEditorChangeSync);
  1498         DimItem( aMenuPane,  EPbk2CmdEditorChangeSync);
  1521         }
  1499         }
  1522     else 
  1500     
  1523         {
       
  1524         //Label editing not anymore supported (is dimmed in DynInitMenuPaneL)
       
  1525         //DimItem( aMenuPane,  EPbk2CmdEditItemLabel);
       
  1526         }
       
  1527     }
  1501     }
  1528 // CPbk2ContactEditorDlgImpl::DynInitAddressL
  1502 // CPbk2ContactEditorDlgImpl::DynInitAddressL
  1529 // --------------------------------------------------------------------------
  1503 // --------------------------------------------------------------------------
  1530 //
  1504 //
  1531 void CPbk2ContactEditorDlgImpl::DynInitAddressL(TInt /*aResourceId*/,
  1505 void CPbk2ContactEditorDlgImpl::DynInitAddressL(TInt /*aResourceId*/,
  1631             if (iNaviContainer)
  1605             if (iNaviContainer)
  1632                 {
  1606                 {
  1633                  iNaviContainer->Pop();
  1607                  iNaviContainer->Pop();
  1634                  iNaviContainer = NULL;
  1608                  iNaviContainer = NULL;
  1635                  }
  1609                  }
  1636             if ( iStoredTitlePaneText )
       
  1637                 {
       
  1638                 delete iStoredTitlePaneText;
       
  1639                 iStoredTitlePaneText = NULL;
       
  1640                 }
       
  1641             MakeVisible( EFalse );
  1610             MakeVisible( EFalse );
  1642             MPbk2ContactEditorEventObserver::TParams params;
  1611             MPbk2ContactEditorEventObserver::TParams params;
  1643             params.iFlags = EPbk2EditorKeyCode;
  1612             params.iFlags = EPbk2EditorKeyCode;
  1644             params.iKeyCode = aKeycode;
  1613             params.iKeyCode = aKeycode;
  1645 
  1614