sysstatemgmt/syslangutil/ssmlangselcmd/src/ssmlangselcmd.cpp
changeset 63 09d657f1ee00
parent 54 072a9626b290
child 64 61992147389a
equal deleted inserted replaced
54:072a9626b290 63:09d657f1ee00
    20 #include "ssmmapperutility.h"
    20 #include "ssmmapperutility.h"
    21 #include "ssmalternativelanguages.h"
    21 #include "ssmalternativelanguages.h"
    22 #include "ssmlanguageloader.h"
    22 #include "ssmlanguageloader.h"
    23 #include "syslangutilprivatecrkeys.h"
    23 #include "syslangutilprivatecrkeys.h"
    24 #include "trace.h"
    24 #include "trace.h"
    25 #include "ssmlocalepskeys.h"
       
    26 #include "ssmmapperutilityinternalpskeys.h"
    25 #include "ssmmapperutilityinternalpskeys.h"
    27 
    26 
    28 #include <e32property.h>
       
    29 #include <syslangutil.h>
    27 #include <syslangutil.h>
    30 #include <CommonEngineDomainCRKeys.h>
    28 #include <CommonEngineDomainCRKeys.h>
    31 #include <centralrepository.h>
    29 #include <centralrepository.h>
    32 
    30 
    33 
    31 
   326 
   324 
   327     TInt value( 0 );
   325     TInt value( 0 );
   328     TInt errorCode = iMapperUtility->CrValue( KCRUidCommonEngineKeys, 
   326     TInt errorCode = iMapperUtility->CrValue( KCRUidCommonEngineKeys, 
   329                                               KGSDisplayTxtLang,
   327                                               KGSDisplayTxtLang,
   330                                               value );
   328                                               value );
   331     if( KErrNone == errorCode )
   329     ERROR( errorCode, "Failed read KGSDisplayTxtLang CenRep key with error= %d"  );       
   332         {
       
   333         errorCode = RProperty::Set( KPSStarterUid, KSSMUILanguagePSKey, value );
       
   334         ERROR_1( errorCode, "Failed to set read KSSMUILanguagePSKey PS key %d", errorCode );
       
   335         }
       
   336     else
       
   337         {
       
   338         INFO_1( "Failed read KGSDisplayTxtLang CenRep key with error= %d", errorCode );
       
   339         }
       
   340     
   330     
   341     INFO_1( "Last selected language is %d", value );
   331     INFO_1( "Last selected language is %d", value );
   342     return value;
   332     return value;
   343     }
   333     }
   344 
   334 
   355   
   345   
   356     if ( KErrNone == errorCode )
   346     if ( KErrNone == errorCode )
   357         {
   347         {
   358         //Set the Region CR with the given value
   348         //Set the Region CR with the given value
   359         errorCode = cenrep->Set( KGSRegion, aRegion );
   349         errorCode = cenrep->Set( KGSRegion, aRegion );
   360         if ( KErrNone == errorCode )
   350         ERROR( errorCode, "Failed to Set Region code to CentRep, %d"  );                
   361             {
       
   362             //Set the Region PS key which is used in Region SUP  
       
   363              TInt err = RProperty::Set( KPSStarterUid, KSSMRegionPSKey, aRegion );
       
   364              ERROR( err, "Failed to Set Region PS key");
       
   365             }
       
   366         else
       
   367             {
       
   368             INFO_1( "Failed to Set Region code to CentRep, %d", errorCode );            
       
   369             }
       
   370         }
   351         }
   371     else
   352     else
   372         {
   353         {
   373         INFO_1( "Failed to initialize cen rep %d", errorCode );        
   354         INFO_1( "Failed to initialize cen rep %d", errorCode );        
   374         }
   355         }
   375 
   356 
   376     if ( KErrNone == errorCode )
   357     if ( KErrNone == errorCode )
   377         {
   358         {
   378         //Set the Collation CR with the given value
   359         //Set the Collation CR with the given value
   379         errorCode = cenrep->Set( KGSCollation, aCollation );
   360         errorCode = cenrep->Set( KGSCollation, aCollation );
   380         if ( KErrNone == errorCode )
   361         ERROR( errorCode, "Failed to Set Collation code to CentRep, %d"  );               
   381             {
       
   382             //Set the Collation PS key which is used in Collation SUP  
       
   383             errorCode = RProperty::Set( KPSStarterUid, KSSMCollationPSKey, aCollation );
       
   384             ERROR( errorCode, "Failed to Set Collation  PS key " );
       
   385             }
       
   386         else
       
   387             {
       
   388             INFO_1( "Failed to Set Collation code to CentRep, %d", errorCode );            
       
   389             }
       
   390         }
   362         }
   391     delete cenrep;
   363     delete cenrep;
   392     return errorCode;
   364     return errorCode;
   393     }
   365     }
   394 
   366 
   540     FUNC_LOG;
   512     FUNC_LOG;
   541     CRepository* cenrep = CRepository::NewL( KCRUidCommonEngineKeys );
   513     CRepository* cenrep = CRepository::NewL( KCRUidCommonEngineKeys );
   542     CleanupStack::PushL( cenrep );
   514     CleanupStack::PushL( cenrep );
   543     
   515     
   544     //Get the last selected Region from central repository
   516     //Get the last selected Region from central repository
   545     User::LeaveIfError(cenrep->Get( KGSRegion, aRegion));
   517     User::LeaveIfError(cenrep->Get( KGSRegion, aRegion));   
   546     
   518         
   547     //Set the Region PS key which is used in Region SUP
       
   548     User::LeaveIfError(RProperty::Set( KPSStarterUid, KSSMRegionPSKey, aRegion ));
       
   549     
       
   550     //Get the last selected Collation from central repository
   519     //Get the last selected Collation from central repository
   551     User::LeaveIfError(cenrep->Get( KGSCollation, aCollation));
   520     User::LeaveIfError(cenrep->Get( KGSCollation, aCollation));    
   552     
   521     
   553     //Set the Collation PS key which is used in Collation SUP
       
   554     User::LeaveIfError(RProperty::Set( KPSStarterUid, KSSMCollationPSKey, aCollation ));
       
   555 
       
   556     INFO_2( "Last selected region %d and collation %d", aRegion, aCollation );
   522     INFO_2( "Last selected region %d and collation %d", aRegion, aCollation );
   557     CleanupStack::PopAndDestroy( cenrep );
   523     CleanupStack::PopAndDestroy( cenrep );
   558     }
   524     }
   559 
   525 
   560 // ---------------------------------------------------------------------------
   526 // ---------------------------------------------------------------------------