emailcontacts/contactactionservice/src/cfscactionutils.cpp
branchRCL_3
changeset 70 968773a0b6ef
parent 64 3533d4323edc
child 73 c8382f7b54ef
equal deleted inserted replaced
64:3533d4323edc 70:968773a0b6ef
    29 #include <eikapp.h>
    29 #include <eikapp.h>
    30 #include <apgcli.h>
    30 #include <apgcli.h>
    31 #include <centralrepository.h>
    31 #include <centralrepository.h>
    32 #include <CoreApplicationUIsSDKCRKeys.h> 
    32 #include <CoreApplicationUIsSDKCRKeys.h> 
    33 #include <settingsinternalcrkeys.h>
    33 #include <settingsinternalcrkeys.h>
    34 //<cmail> Header neither in Cmail nor in the platform
       
    35 #include <crcseprofileregistry.h>
    34 #include <crcseprofileregistry.h>
    36 //</cmail>
       
    37 #include <NetworkHandlingDomainPSKeys.h>
    35 #include <NetworkHandlingDomainPSKeys.h>
    38 #include <MVPbkStoreContact.h>
    36 #include <MVPbkStoreContact.h>
    39 #include <MVPbkStoreContactFieldCollection.h>
    37 #include <MVPbkStoreContactFieldCollection.h>
    40 #include <MVPbkStoreContactField.h>
    38 #include <MVPbkStoreContactField.h>
    41 #include <MVPbkFieldType.h>
    39 #include <MVPbkFieldType.h>
    42 #include <TVPbkFieldVersitProperty.h>
    40 #include <TVPbkFieldVersitProperty.h>
    43 #include <MVPbkContactFieldData.h>
    41 #include <MVPbkContactFieldData.h>
    44 #include <MVPbkContactFieldTextData.h>
    42 #include <MVPbkContactFieldTextData.h>
    45 //<cmail>
       
    46 #include "fscactionplugincrkeys.h"
    43 #include "fscactionplugincrkeys.h"
    47 #include "fsccontactactionservicedefines.h"
    44 #include "fsccontactactionservicedefines.h"
    48 //</cmail>
       
    49 #include <FscActionUtils.rsg>
    45 #include <FscActionUtils.rsg>
    50 #include <barsread.h>
    46 #include <barsread.h>
    51 #include <Pbk2ContactNameFormatterFactory.h>
    47 #include <Pbk2ContactNameFormatterFactory.h>
    52 #include <MPbk2ContactNameFormatter.h>
    48 #include <MPbk2ContactNameFormatter.h>
    53 #include <CPbk2SortOrderManager.h>
    49 #include <CPbk2SortOrderManager.h>
    54 #include <CVPbkContactManager.h>
    50 #include <CVPbkContactManager.h>
    55 #include <MPbk2FieldProperty.h>
    51 #include <MPbk2FieldProperty.h>
    56 #include <CVPbkFieldTypeSelector.h>
    52 #include <CVPbkFieldTypeSelector.h>
    57 #include <CVPbkFieldFilter.h>
    53 #include <CVPbkFieldFilter.h>
    58 #include <commonphoneparser.h>
    54 #include <commonphoneparser.h>
    59 #include <bautils.h> // Fix for EMZG-7M23KX
    55 #include <bautils.h>
    60 //<cmail> hardcoded paths removal
       
    61 #include <data_caging_path_literals.hrh>
    56 #include <data_caging_path_literals.hrh>
    62 //</cmail>
       
    63 
       
    64 #include "cfscactionutils.h"
    57 #include "cfscactionutils.h"
    65 #include "cfsccontactaction.h"
    58 #include "cfsccontactaction.h"
    66 #include "mfscreasoncallback.h"
    59 #include "mfscreasoncallback.h"
    67 #include <VPbkFieldType.hrh>
    60 #include <VPbkFieldType.hrh>
    68 #include "FscPresentationUtils.h"
    61 #include "FscPresentationUtils.h"
    85 }
    78 }
    86 
    79 
    87 const TUint32 KPoCDefaultSettings = 0x199;
    80 const TUint32 KPoCDefaultSettings = 0x199;
    88 
    81 
    89 const TInt KMaxLengthOfNumber = 100;
    82 const TInt KMaxLengthOfNumber = 100;
    90 
    83 const TInt KMaxLengthOfAddrData = 255;
    91 //Fix for: ECWG-7QYAVS
    84 const TInt KMaxLengthOfName = 256; // same as max addr len + extra whitespace
    92 const TInt KMaxLengthOfName = 100;
       
    93 //end for fix
       
    94 
    85 
    95 _LIT( KSpace, " " );
    86 _LIT( KSpace, " " );
    96 //<cmail> hard coded path removed
       
    97 _LIT( KFscRscFileName, "fscactionutils.rsc" );
    87 _LIT( KFscRscFileName, "fscactionutils.rsc" );
    98 //</cmail>
       
    99 
    88 
   100 // ======== MEMBER FUNCTIONS ========
    89 // ======== MEMBER FUNCTIONS ========
   101 
    90 
   102 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
   103 // CFscActionUtils::NewL
    92 // CFscActionUtils::NewL
   133     {
   122     {
   134     FUNC_LOG;
   123     FUNC_LOG;
   135     delete iRep;
   124     delete iRep;
   136     if ( iRCSEProfileRegistry != NULL )
   125     if ( iRCSEProfileRegistry != NULL )
   137         {
   126         {
   138         //<cmail>
       
   139         delete iRCSEProfileRegistry;
   127         delete iRCSEProfileRegistry;
   140         //</cmail>
       
   141         }
   128         }
   142     }
   129     }
   143 
   130 
   144 // ---------------------------------------------------------------------------
   131 // ---------------------------------------------------------------------------
   145 // CFscActionUtils::ContactManager
   132 // CFscActionUtils::ContactManager
   158 void CFscActionUtils::ShowInfoNoteL( TInt aNote, const HBufC* aContactName )
   145 void CFscActionUtils::ShowInfoNoteL( TInt aNote, const HBufC* aContactName )
   159     {
   146     {
   160     FUNC_LOG;
   147     FUNC_LOG;
   161     HBufC* noteText = NULL;
   148     HBufC* noteText = NULL;
   162     
   149     
   163     // Fix for EMZG-7M23KX
       
   164     TInt offset = FindAndAddResourceFileL();
   150     TInt offset = FindAndAddResourceFileL();
   165     
   151     
   166     if ( aContactName )
   152     if ( aContactName )
   167         {
   153         {
   168         noteText = StringLoader::LoadL( aNote, *aContactName );
   154         noteText = StringLoader::LoadL( aNote, *aContactName );
   187 void CFscActionUtils::ShowInfoNoteL( TInt aNote, TInt aCounter )
   173 void CFscActionUtils::ShowInfoNoteL( TInt aNote, TInt aCounter )
   188     {
   174     {
   189     FUNC_LOG;
   175     FUNC_LOG;
   190     HBufC* noteText = NULL;
   176     HBufC* noteText = NULL;
   191     
   177     
   192     // Fix for EMZG-7M23KX
       
   193     TInt offset = FindAndAddResourceFileL();
   178     TInt offset = FindAndAddResourceFileL();
   194     
   179     
   195     noteText = StringLoader::LoadL( aNote, aCounter );
   180     noteText = StringLoader::LoadL( aNote, aCounter );
   196   
   181   
   197     CleanupStack::PushL( noteText );
   182     CleanupStack::PushL( noteText );
   208 //
   193 //
   209 void CFscActionUtils::ShowCnfNoteL( TInt aNote, const HBufC* aName )
   194 void CFscActionUtils::ShowCnfNoteL( TInt aNote, const HBufC* aName )
   210     {
   195     {
   211     FUNC_LOG;
   196     FUNC_LOG;
   212     
   197     
   213     // Fix for EMZG-7M23KX
       
   214     TInt offset = FindAndAddResourceFileL();
   198     TInt offset = FindAndAddResourceFileL();
   215     
   199     
   216     HBufC* noteText = NULL;
   200     HBufC* noteText = NULL;
   217     
   201     
   218     if ( aName )
   202     if ( aName )
   267 // CFscActionUtils::GetContactNameL
   251 // CFscActionUtils::GetContactNameL
   268 // ---------------------------------------------------------------------------
   252 // ---------------------------------------------------------------------------
   269 HBufC* CFscActionUtils::GetContactNameL( MVPbkStoreContact& aStoreContact )
   253 HBufC* CFscActionUtils::GetContactNameL( MVPbkStoreContact& aStoreContact )
   270     {
   254     {
   271     FUNC_LOG;
   255     FUNC_LOG;
   272     HBufC* contactName = HBufC::NewLC( KMaxLengthOfName + 1 ); // one ' ' char
   256 
   273     
   257     TBuf<KMaxLengthOfName> contactName;
   274     // Search for the contact name
   258     
   275     // Fix for EMZG-7M23KX
       
   276     TInt offset = FindAndAddResourceFileL();
   259     TInt offset = FindAndAddResourceFileL();
   277     
   260     
   278     TResourceReader selectorReader;
   261     TInt err( KErrNone );
   279     CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
   262     TRAP( err, AppendFieldToContactL( 
   280             R_FSC_FIRST_NAME_SELECTOR );
   263             contactName, R_FSC_FIRST_NAME_SELECTOR, aStoreContact ) );
   281 
   264     if ( err == KErrNone )
   282     CVPbkFieldTypeSelector* fieldTypeSelector = CVPbkFieldTypeSelector::NewL(
   265         {
   283             selectorReader, iContactManager.FieldTypes() );
   266         TRAP( err, AppendFieldToContactL( 
   284     CleanupStack::PopAndDestroy(); // selectorReader
   267                 contactName, R_FSC_LAST_NAME_SELECTOR, aStoreContact, 
   285 
   268                 ETrue ) );
   286     CVPbkFieldFilter::TConfig config(
   269         }
   287             const_cast<MVPbkStoreContactFieldCollection&> (
   270     if ( err == KErrNone && contactName.Length() <= 0 )
   288                     aStoreContact.Fields() ), fieldTypeSelector, NULL );
   271         {
   289 
   272         // If no first or last name was found, try to append company name
   290     CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
   273         TRAP_IGNORE( AppendFieldToContactL( 
   291     TInt fieldCount = fieldFilter->FieldCount();
   274                 contactName, R_FSC_COMPANY_NAME_SELECTOR, aStoreContact ) );
   292     const MVPbkStoreContactField* field = NULL;
   275         }
   293     if ( fieldCount == 1 )
   276 
   294         {
   277     // If there was an error or the contact name is zero length, use
   295         field = fieldFilter->FieldAtLC(0);
   278     // pre-defined unnamed string instead..
   296         contactName->Des().Append(
   279     if ( err != KErrNone || contactName.Length() <= 0 )
   297                 MVPbkContactFieldTextData::Cast( 
   280         {
   298                         field->FieldData() ).Text() );
       
   299         CleanupStack::PopAndDestroy();//field
       
   300         }
       
   301 
       
   302     delete fieldFilter;
       
   303     delete fieldTypeSelector;
       
   304 
       
   305     // Search for the contact second name
       
   306     CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
       
   307             R_FSC_LAST_NAME_SELECTOR );
       
   308     fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
       
   309             iContactManager.FieldTypes() );
       
   310     CleanupStack::PopAndDestroy();//selectorReader
       
   311     config.iFieldSelector = fieldTypeSelector;
       
   312 
       
   313     fieldFilter = CVPbkFieldFilter::NewL( config );
       
   314     fieldCount = fieldFilter->FieldCount();
       
   315     if ( fieldCount == 1 )
       
   316         {
       
   317         field = fieldFilter->FieldAtLC(0);
       
   318         if ( contactName->Des().Length() > 0 )
       
   319             {
       
   320             contactName->Des().Append( KSpace );
       
   321             }
       
   322         contactName->Des().Append(
       
   323                 MVPbkContactFieldTextData::Cast( 
       
   324                         field->FieldData() ).Text() );
       
   325         CleanupStack::PopAndDestroy();//field
       
   326         }
       
   327 
       
   328     // If first or second name hasn't been found -> find company name
       
   329     if ( contactName->Des().Length() <= 0 )
       
   330         {
       
   331         delete fieldFilter;
       
   332         delete fieldTypeSelector;
       
   333 
       
   334         CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
       
   335                 R_FSC_COMPANY_NAME_SELECTOR );
       
   336         fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
       
   337                 iContactManager.FieldTypes() );
       
   338         CleanupStack::PopAndDestroy();//selectorReader
       
   339         config.iFieldSelector = fieldTypeSelector;
       
   340 
       
   341         fieldFilter = CVPbkFieldFilter::NewL( config );
       
   342         fieldCount = fieldFilter->FieldCount();
       
   343         if ( fieldCount == 1 )
       
   344             {
       
   345             field = fieldFilter->FieldAtLC(0);
       
   346             contactName->Des().Append(
       
   347                     MVPbkContactFieldTextData::Cast(
       
   348                             field->FieldData() ).Text() );
       
   349             CleanupStack::PopAndDestroy();//field
       
   350             }
       
   351         }
       
   352     // no first or second name, nor company name -> return "unnamed" string
       
   353     if ( contactName->Des().Length() <= 0 )
       
   354         {
       
   355         //append (Unnamed)
       
   356         HBufC* unnamed = StringLoader::LoadL( R_QTN_FS_UNNAMED );
   281         HBufC* unnamed = StringLoader::LoadL( R_QTN_FS_UNNAMED );
   357         contactName->Des().Append( *unnamed );
   282         contactName.Zero();
       
   283         contactName.Append( *unnamed );
   358         delete unnamed;
   284         delete unnamed;
   359         }
   285         }
   360 
       
   361     delete fieldFilter;
       
   362     delete fieldTypeSelector;
       
   363     CleanupStack::Pop( contactName );
       
   364 
       
   365     CCoeEnv::Static()->DeleteResourceFile( offset );
   286     CCoeEnv::Static()->DeleteResourceFile( offset );
   366 
   287     return contactName.AllocL();
   367     return contactName;
       
   368     }
   288     }
   369 
   289 
   370 // ---------------------------------------------------------------------------
   290 // ---------------------------------------------------------------------------
   371 // CFscActionUtils::OpenSelectDialogL
   291 // CFscActionUtils::OpenSelectDialogL
   372 // ---------------------------------------------------------------------------
   292 // ---------------------------------------------------------------------------
   386                     iContactManager.FieldTypes(), *sortOrderManager );
   306                     iContactManager.FieldTypes(), *sortOrderManager );
   387 
   307 
   388     CFscFieldPropertyArray* fieldProperties =
   308     CFscFieldPropertyArray* fieldProperties =
   389             CFscFieldPropertyArray::NewL( iContactManager.FieldTypes() );
   309             CFscFieldPropertyArray::NewL( iContactManager.FieldTypes() );
   390 
   310 
   391     // Fix for EMZG-7M23KX
       
   392     TInt offset = FindAndAddResourceFileL();
   311     TInt offset = FindAndAddResourceFileL();
   393 
   312 
   394     // Create resource reader for new resource
   313     // Create resource reader for new resource
   395     TResourceReader resReader;
   314     TResourceReader resReader;
   396     
   315     
   438             
   357             
   439         case R_FSC_MSG_SELECT:
   358         case R_FSC_MSG_SELECT:
   440             {
   359             {
   441             defaultPrioritiesArray.Append( EVPbkDefaultTypeSms );
   360             defaultPrioritiesArray.Append( EVPbkDefaultTypeSms );
   442             defaultPrioritiesArray.Append( EVPbkDefaultTypeMms );
   361             defaultPrioritiesArray.Append( EVPbkDefaultTypeMms );
   443             // Fix for ELWG-7SPH5H 
       
   444             params.SetUseDefaultDirectly( ETrue );
   362             params.SetUseDefaultDirectly( ETrue );
   445             break;
   363             break;
   446             }
   364             }
   447             
   365             
   448         case R_FSC_EMAIL_SELECT:
   366         case R_FSC_EMAIL_SELECT:
   516             {
   434             {
   517             aNumber.Copy( phoneNumberFieldData );
   435             aNumber.Copy( phoneNumberFieldData );
   518             }
   436             }
   519 
   437 
   520         // Format phone number
   438         // Format phone number
   521         //Fix for: MHOA-7SQF6T
       
   522         CommonPhoneParser::ParsePhoneNumber( aNumber,
   439         CommonPhoneParser::ParsePhoneNumber( aNumber,
   523                             CommonPhoneParser::EPlainPhoneNumber );
   440                             CommonPhoneParser::EPlainPhoneNumber );
   524         //end for fix
       
   525         }
   441         }
   526 
   442 
   527     // Destroy objects
   443     // Destroy objects
   528     delete selectedField;
   444     delete selectedField;
   529 
   445 
   567             {
   483             {
   568             aNumber.Copy( phoneNumberFieldData );
   484             aNumber.Copy( phoneNumberFieldData );
   569             }
   485             }
   570 
   486 
   571         // Format phone number
   487         // Format phone number
   572         //Fix for: MHOA-7SQF6T
       
   573         CommonPhoneParser::ParsePhoneNumber( aNumber,
   488         CommonPhoneParser::ParsePhoneNumber( aNumber,
   574                             CommonPhoneParser::EPlainPhoneNumber );
   489                             CommonPhoneParser::EPlainPhoneNumber );
   575         //end for fix
       
   576         }
   490         }
   577 
   491 
   578     // Destroy objects
   492     // Destroy objects
   579     delete selectedField;
   493     delete selectedField;
   580 
   494 
   622             ret = KErrNotFound;
   536             ret = KErrNotFound;
   623             }
   537             }
   624         }
   538         }
   625 
   539 
   626     // Format phone number
   540     // Format phone number
   627     //Fix for: MHOA-7SQF6T
       
   628     CommonPhoneParser::ParsePhoneNumber( aVoipAddress,
   541     CommonPhoneParser::ParsePhoneNumber( aVoipAddress,
   629                         CommonPhoneParser::EPlainPhoneNumber );
   542                         CommonPhoneParser::EPlainPhoneNumber );
   630     //end for fix
       
   631     
   543     
   632     // Destroy objects
   544     // Destroy objects
   633     delete selectedField;
   545     delete selectedField;
   634 
   546 
   635     return ret;
   547     return ret;
   653         }
   565         }
   654     
   566     
   655     TInt ret = KErrNone;
   567     TInt ret = KErrNone;
   656     
   568     
   657     // Search for conference number
   569     // Search for conference number
   658     // Fix for EMZG-7M23KX
       
   659     TInt offset = FindAndAddResourceFileL();
   570     TInt offset = FindAndAddResourceFileL();
   660     TResourceReader selectorReader;
   571     TResourceReader selectorReader;
   661     CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
   572     CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
   662             R_FSC_CONF_NUMBER_SELECTOR );
   573             R_FSC_CONF_NUMBER_SELECTOR );
   663 
   574 
   823     
   734     
   824     return ret;
   735     return ret;
   825     }
   736     }
   826 
   737 
   827 // ---------------------------------------------------------------------------
   738 // ---------------------------------------------------------------------------
   828 // CFscActionUtils::GetEmailAddressL
   739 // CFscActionUtils::GetMessageAddressL
   829 // ---------------------------------------------------------------------------
   740 // ---------------------------------------------------------------------------
   830 //
   741 //
   831 TInt CFscActionUtils::GetMessageAddressL( MVPbkStoreContact& aStoreContact,
   742 TInt CFscActionUtils::GetMessageAddressL( MVPbkStoreContact& aStoreContact,
   832     TDes& aMsgAddress )
   743     TDes& aMsgAddress )
   833     {
   744     {
   856         {
   767         {
   857         // Copy message address from selected field
   768         // Copy message address from selected field
   858         TPtrC msgAddress = MVPbkContactFieldTextData::Cast(
   769         TPtrC msgAddress = MVPbkContactFieldTextData::Cast(
   859                 selectedField->FieldData() ).Text();
   770                 selectedField->FieldData() ).Text();
   860         
   771         
   861         if ( msgAddress.Length() )
   772         if ( msgAddress.Length() && 
       
   773              msgAddress.Length() <= KMaxLengthOfAddrData )
   862             {
   774             {
   863             aMsgAddress.Copy( msgAddress );
   775             aMsgAddress.Copy( msgAddress );
   864             }
   776             }
   865         else
   777         else
   866             {
   778             {
   905         {
   817         {
   906         // Copy email address from selected field
   818         // Copy email address from selected field
   907         TPtrC emailAddress = MVPbkContactFieldTextData::Cast(
   819         TPtrC emailAddress = MVPbkContactFieldTextData::Cast(
   908                 selectedField->FieldData() ).Text();
   820                 selectedField->FieldData() ).Text();
   909         
   821         
   910         if ( emailAddress.Length() )
   822         if ( emailAddress.Length() && 
       
   823              emailAddress.Length() <= KMaxLengthOfAddrData )
   911             {
   824             {
   912             aEmailAddress.Copy( emailAddress );
   825             aEmailAddress.Copy( emailAddress );
   913             }
   826             }
   914         else
   827         else
   915             {
   828             {
   951     FUNC_LOG;
   864     FUNC_LOG;
   952 
   865 
   953     TBool available( EFalse );
   866     TBool available( EFalse );
   954 
   867 
   955     // Search for the contact name
   868     // Search for the contact name
   956     // Fix for EMZG-7M23KX  
       
   957     TInt offset = FindAndAddResourceFileL();
   869     TInt offset = FindAndAddResourceFileL();
   958     
   870     
   959     TResourceReader selectorReader;
   871     TResourceReader selectorReader;
   960     CVPbkFieldTypeSelector* fieldTypeSelector = NULL;
   872     CVPbkFieldTypeSelector* fieldTypeSelector = NULL;
   961     CVPbkFieldFilter* fieldFilter = NULL;
   873     CVPbkFieldFilter* fieldFilter = NULL;
   962     TInt fieldCount = 0;
       
   963     TInt selector = 0;
   874     TInt selector = 0;
   964 
   875 
   965     switch ( aContactNumberType )
   876     switch ( aContactNumberType )
   966         {
   877         {
   967         case ETypeVoiceCallNumber:
   878         case ETypeVoiceCallNumber:
  1023         CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, selector );
   934         CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, selector );
  1024 
   935 
  1025         fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
   936         fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
  1026                 iContactManager.FieldTypes() );
   937                 iContactManager.FieldTypes() );
  1027         CleanupStack::PopAndDestroy(); // selectorReader
   938         CleanupStack::PopAndDestroy(); // selectorReader
  1028 
   939         CleanupStack::PushL( fieldTypeSelector );
       
   940         
  1029         CVPbkFieldFilter::TConfig config(
   941         CVPbkFieldFilter::TConfig config(
  1030                 const_cast<MVPbkStoreContactFieldCollection&> (
   942                 const_cast<MVPbkStoreContactFieldCollection&> (
  1031                         aStoreContact.Fields() ), fieldTypeSelector, NULL);
   943                         aStoreContact.Fields() ), fieldTypeSelector, NULL);
  1032 
   944 
  1033         fieldFilter = CVPbkFieldFilter::NewL( config );
   945         fieldFilter = CVPbkFieldFilter::NewL( config );
  1034         fieldCount = fieldFilter->FieldCount();
   946         CleanupStack::PushL( fieldFilter );
  1035         
   947         
  1036         if ( fieldCount )
   948         if ( fieldFilter->FieldCount() )
  1037             {
   949             {
  1038             if ( selector == R_FSC_CONF_NUMBER_SELECTOR )
   950             if ( selector == R_FSC_CONF_NUMBER_SELECTOR )
  1039                 {
   951                 {
  1040                 TBuf<KMaxLengthOfNumber> confNum;
   952                 TBuf<KMaxLengthOfNumber> confNum;
  1041                 const MVPbkStoreContactField* field = NULL;
   953                 const MVPbkStoreContactField* field = NULL;
  1042                 field = fieldFilter->FieldAtLC(0);
   954                 field = fieldFilter->FieldAtLC(0);
  1043                 confNum.Append( MVPbkContactFieldTextData::Cast( 
   955                 confNum.Append( MVPbkContactFieldTextData::Cast( 
  1044                         field->FieldData() ).Text() );
   956                         field->FieldData() ).Text() );
  1045                 CleanupStack::PopAndDestroy();//field
   957                 CleanupStack::PopAndDestroy(); // field
  1046                 
   958                 
  1047                 if ( CommonPhoneParser::IsValidPhoneNumber( confNum, 
   959                 if ( CommonPhoneParser::IsValidPhoneNumber( confNum, 
  1048                         CommonPhoneParser::EContactCardNumber ) )
   960                         CommonPhoneParser::EContactCardNumber ) )
  1049                     {
   961                     {
  1050                     available = ETrue;
   962                     available = ETrue;
  1053             else
   965             else
  1054                 {
   966                 {
  1055                 available = ETrue;
   967                 available = ETrue;
  1056                 }
   968                 }
  1057             }
   969             }
  1058 
   970         CleanupStack::PopAndDestroy( 2 ); // fieldFilter, fieldTypeSelector
  1059         delete fieldFilter;
       
  1060         delete fieldTypeSelector;
       
  1061         }
   971         }
  1062     
   972     
  1063     CCoeEnv::Static()->DeleteResourceFile( offset );
   973     CCoeEnv::Static()->DeleteResourceFile( offset );
  1064     
   974     
  1065     return available;
   975     return available;
  1131         {
  1041         {
  1132         TInt settingsId;
  1042         TInt settingsId;
  1133         TInt err = cenRep->Get( KPoCDefaultSettings, settingsId );
  1043         TInt err = cenRep->Get( KPoCDefaultSettings, settingsId );
  1134         if ( err == KErrNone )
  1044         if ( err == KErrNone )
  1135             {
  1045             {
  1136             result = (settingsId != KErrNotFound );
  1046             result = ( settingsId != KErrNotFound );
  1137             }
  1047             }
  1138         delete cenRep;
  1048         delete cenRep;
  1139         }
  1049         }
  1140 
  1050 
  1141     return result;
  1051     return result;
  1152     TBool configured = EFalse;
  1062     TBool configured = EFalse;
  1153     if ( iRCSEProfileRegistry != NULL )
  1063     if ( iRCSEProfileRegistry != NULL )
  1154         {
  1064         {
  1155         RArray<TUint32> ids;
  1065         RArray<TUint32> ids;
  1156         CleanupClosePushL( ids );
  1066         CleanupClosePushL( ids );
  1157         //<cmail>
       
  1158         iRCSEProfileRegistry->GetAllIdsL( ids );
  1067         iRCSEProfileRegistry->GetAllIdsL( ids );
  1159         //</cmail>
       
  1160         configured = ids.Count() > 0;
  1068         configured = ids.Count() > 0;
  1161         CleanupStack::PopAndDestroy( &ids );
  1069         CleanupStack::PopAndDestroy( &ids );
  1162         }
  1070         }
  1163 
  1071 
  1164     return configured;
  1072     return configured;
  1249     FUNC_LOG;
  1157     FUNC_LOG;
  1250     TRAP_IGNORE( iRep = CRepository::NewL( KCRUidFsContactActionService ) );
  1158     TRAP_IGNORE( iRep = CRepository::NewL( KCRUidFsContactActionService ) );
  1251 
  1159 
  1252     if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
  1160     if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
  1253         {
  1161         {
  1254         //<cmail>
       
  1255         TRAP_IGNORE( iRCSEProfileRegistry = CRCSEProfileRegistry::NewL() );
  1162         TRAP_IGNORE( iRCSEProfileRegistry = CRCSEProfileRegistry::NewL() );
  1256         //</cmail>
  1163         }
  1257         }
       
  1258     
       
  1259     //<cmail>
       
  1260     //iRCSEProfileRegistry = NULL;
       
  1261     //</cmail>
       
  1262 
       
  1263     }
  1164     }
  1264 
  1165 
  1265 // ---------------------------------------------------------------------------
  1166 // ---------------------------------------------------------------------------
  1266 // CFscActionUtils::GetFileDir
  1167 // CFscActionUtils::GetFileDir
  1267 // ---------------------------------------------------------------------------
  1168 // ---------------------------------------------------------------------------
  1289     fileName.Append( aFilePath );
  1190     fileName.Append( aFilePath );
  1290     
  1191     
  1291     return fileName;
  1192     return fileName;
  1292     }
  1193     }
  1293 
  1194 
  1294 // Fix for EMZG-7M23KX
       
  1295 // ---------------------------------------------------------------------------
  1195 // ---------------------------------------------------------------------------
  1296 // CFscActionUtils::FindAndAddResourceFileL
  1196 // CFscActionUtils::FindAndAddResourceFileL
  1297 // ---------------------------------------------------------------------------
  1197 // ---------------------------------------------------------------------------
  1298 //
  1198 //
  1299 TInt CFscActionUtils::FindAndAddResourceFileL()
  1199 TInt CFscActionUtils::FindAndAddResourceFileL()
  1300     {
  1200     {
  1301     FUNC_LOG;
  1201     FUNC_LOG;
  1302     //<cmail> hardcoded removed
       
  1303     TFileName resourceFileName( KDC_RESOURCE_FILES_DIR );
  1202     TFileName resourceFileName( KDC_RESOURCE_FILES_DIR );
  1304     resourceFileName.Append(KFscRscFileName);
  1203     resourceFileName.Append( KFscRscFileName );
  1305     //</cmail>
       
  1306     BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
  1204     BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
  1307     TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );
  1205     return CCoeEnv::Static()->AddResourceFileL( resourceFileName );
  1308     
       
  1309     return offset;
       
  1310     }
  1206     }
  1311 // ---------------------------------------------------------------------------
  1207 // ---------------------------------------------------------------------------
  1312 // CFscActionUtils::CloseSelectDialogL
  1208 // CFscActionUtils::CloseSelectDialogL
  1313 // ---------------------------------------------------------------------------
  1209 // ---------------------------------------------------------------------------
  1314 // 
  1210 // 
  1319         {
  1215         {
  1320         iAddressSelect->AttemptExitL( EFalse );
  1216         iAddressSelect->AttemptExitL( EFalse );
  1321         }
  1217         }
  1322     }
  1218     }
  1323 
  1219 
  1324 
  1220 // ---------------------------------------------------------------------------
  1325 // ======== GLOBAL FUNCTIONS ========
  1221 // CFscActionUtils::AppendFieldToContactL
  1326 
  1222 // ---------------------------------------------------------------------------
       
  1223 //
       
  1224 void CFscActionUtils::AppendFieldToContactL( TDes& aContact,
       
  1225         TInt aFieldResourceId,
       
  1226         MVPbkStoreContact& aStoreContact,
       
  1227         TBool aAddSpace )
       
  1228     {
       
  1229     FUNC_LOG;
       
  1230 
       
  1231     TResourceReader selectorReader;
       
  1232     CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
       
  1233             aFieldResourceId );
       
  1234 
       
  1235     CVPbkFieldTypeSelector* fieldTypeSelector = CVPbkFieldTypeSelector::NewL(
       
  1236             selectorReader, iContactManager.FieldTypes() );
       
  1237     CleanupStack::PopAndDestroy(); // selectorReader
       
  1238     CleanupStack::PushL( fieldTypeSelector );
       
  1239 
       
  1240     CVPbkFieldFilter::TConfig config(
       
  1241             const_cast<MVPbkStoreContactFieldCollection&> (
       
  1242                     aStoreContact.Fields() ), fieldTypeSelector, NULL );
       
  1243 
       
  1244     CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
       
  1245     CleanupStack::PushL( fieldFilter );
       
  1246 
       
  1247     if ( fieldFilter->FieldCount() == 1 )
       
  1248         {
       
  1249         MVPbkStoreContactField* field = fieldFilter->FieldAtLC( 0 );
       
  1250         if ( aAddSpace && aContact.Length() > 0 )
       
  1251             {
       
  1252             aContact.Append( KSpace );
       
  1253             }
       
  1254         TPtrC castFieldText = MVPbkContactFieldTextData::Cast( 
       
  1255                 field->FieldData() ).Text();
       
  1256 
       
  1257         if ( ( aContact.Length() + castFieldText.Length() ) > KMaxLengthOfName )
       
  1258             {
       
  1259             User::Leave( KErrOverflow );
       
  1260             }
       
  1261 
       
  1262         aContact.Append( MVPbkContactFieldTextData::Cast(
       
  1263                 field->FieldData() ).Text() );
       
  1264         CleanupStack::PopAndDestroy(); // field
       
  1265         }
       
  1266     CleanupStack::PopAndDestroy( 2 ); // fieldFilter, fieldTypeSelector    
       
  1267     }
       
  1268