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