sysstatemgmt/syslangutil/ssmlangselcmd/inc/ssmlangselcmd.h
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 /*
     1 /*
     2  * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17  */
    17  */
    18 
    18 
    19 #ifndef SSMLANGSELCMD_H
    19 #ifndef SSMLANGSELCMD_H
    20 #define SSMLANGSELCMD_H
    20 #define SSMLANGSELCMD_H
    21 
    21 
    22 #include "ssmcommonlocale.h"
       
    23 #include <e32base.h>
    22 #include <e32base.h>
    24 #include <ssm/ssmcustomcommand.h>
    23 #include <ssm/ssmcustomcommand.h>
    25 #include <ssm/ssmadaptationcli.h>
    24 #include <ssm/ssmadaptationcli.h>
    26 #include <e32hashtab.h> 
       
    27 
    25 
    28 class CSsmMapperUtility;
    26 class CSsmMapperUtility;
    29 
    27 
    30 /**
    28 /**
    31  *  Each command is implemented in a class derived from MSsmCustomCommand.
    29  *  Each command is implemented in a class derived from MSsmCustomCommand.
   157      *
   155      *
   158      * @param aLang The language to use or a system-wide error code.
   156      * @param aLang The language to use or a system-wide error code.
   159      */
   157      */
   160     void UseLanguage(const TInt aLang);
   158     void UseLanguage(const TInt aLang);
   161 
   159 
   162     /**
       
   163     * Initialize the language region mapping
       
   164     * 
       
   165     */
       
   166     void InitializeRegionMappingL();
       
   167 
       
   168     /**
       
   169     * Used to check whether the region is valid or not
       
   170     * 
       
   171     * @param aRegion Region to be validated
       
   172     * 
       
   173     * @return ETrue if the region code was found in the list, EFalse otherwise.
       
   174     */
       
   175     TBool IsRegionValidL(const TInt aRegion) const;
       
   176     
       
   177     /**
       
   178     * Get the stored Region and Collation code from Central Repository
       
   179     * 
       
   180     * @param aRegion On return, will store the Region code fetched from CR
       
   181     * @param aCollation On return, will store the Collation code fetched from CR
       
   182     * 
       
   183     */
       
   184     void GetIndividualSettingsFromCentRepL(TInt& aRegion, TInt& aCollation);
       
   185 
       
   186     /**
       
   187     * Store the given Region and Collation code to Central Repository
       
   188     * 
       
   189     * @param aRegion Region code to be stored in CR
       
   190     * @param aCollation Collation code to be stored in CR
       
   191     * 
       
   192     * @return Success code, Contains any of the error code in case of any error.
       
   193     */
       
   194     TInt SetIndividualSettingsToCentRep(const TInt aRegion, const TInt aCollation);
       
   195 
       
   196     /**
       
   197     * Gets the selected Region and Collation codes. If not set will get the asscoiated codes 
       
   198     * for the language
       
   199     * 
       
   200     * @param aLastSelectedLang Contains the seleted Language code
       
   201     * @param aLastSelectedRegion On success contains the Region code
       
   202     * @param aLastSelectedCollation On success contains the Collation code
       
   203     * 
       
   204     * @return ETrue If the Region and Collation codes are valid or found the mapped Region 
       
   205     * incase of auto selection, EFalse otherwise.
       
   206     */
       
   207     TBool ValidateAndGetSettings(const TInt aLastSelectedLang, TInt& aLastSelectedRegion, TInt& aLastSelectedCollation);
       
   208 
       
   209     /**
       
   210     * Gets the selected Region and Collation codes. If not set will get the asscoiated codes 
       
   211     * for the language
       
   212     * 
       
   213     * @param aLastSelectedLang Contains the seleted Language code
       
   214     * @param aLastSelectedRegion On success contains the Region code
       
   215     * @param aLastSelectedCollation On success contains the Collation code
       
   216     * 
       
   217     * @return ETrue If the Region and Collation codes are valid or found the mapped Region 
       
   218     * incase of auto selection, EFalse otherwise. Leaves with any of error code incase of any error
       
   219     */
       
   220     TBool ValidateAndGetSettingsL(const TInt aLastSelectedLang, TInt& aLastSelectedRegion, TInt& aLastSelectedCollation);
       
   221 
       
   222     /**
       
   223     * Loads the default language setting if it is valid
       
   224     * 
       
   225     * @return KErrNone if the default language settings are valid and loaded successfully,
       
   226     * any of the error code otherwise.
       
   227     */
       
   228     TInt ValidateAndUseDefaultLanguage();
       
   229 
       
   230     /**
       
   231     * Loads the corresponsing locale codes
       
   232     * 
       
   233     * @param aLang Language code to be loaded
       
   234     * @param aRegion Region code to be loaded
       
   235     * @param aCollation Collation code to be loaded
       
   236     * 
       
   237     * @return Success code, Contains any of the error code in case of any error.
       
   238     */
       
   239     TInt UseLocale( const TInt aLang, const TInt aRegion, const TInt aCollation );
       
   240 
       
   241     /**
       
   242     * Gets the region mapped with the given language after validating
       
   243     * 
       
   244     * @param aLanguage Language code for getting associated Region code
       
   245     * @param aRegion On return contains the Region code associated with 
       
   246     * the given language code
       
   247     * 
       
   248     * @return ETrue if the region code was found in the list, EFalse otherwise.
       
   249     */
       
   250 
       
   251     TBool ValidateAndGetMappedRegion( const TInt aLanguage, TInt& aRegion );
       
   252 
       
   253 private: // data
   160 private: // data
   254 
   161 
   255     /** Custom command environment. Not owned. Set in Initialise. */
   162     /** Custom command environment. Not owned. Set in Initialise. */
   256     CSsmCustomCommandEnv* iEnv;
   163     CSsmCustomCommandEnv* iEnv;
   257 
   164 
   282     CArrayFix<TInt32>* iLangList;
   189     CArrayFix<TInt32>* iLangList;
   283     
   190     
   284     /** Internal state of the object. */
   191     /** Internal state of the object. */
   285     enum TState
   192     enum TState
   286         {
   193         {
   287         EQueryListNone = 0,
       
   288         EQueryListSize = 1,
   194         EQueryListSize = 1,
   289         EQueryListContent = 2
   195         EQueryListContent
   290         };
   196         };
   291     TState iState;
   197     TState iState;
   292     
   198     
   293     // The mapper utility instance, owned.
   199     // The mapper utility instance, owned.
   294     CSsmMapperUtility* iMapperUtility;
   200     CSsmMapperUtility* iMapperUtility;
   295 
   201 
   296     /** Array of  language and region mappings. */
       
   297     RHashSet<TLanguageRegion>  iLangRegionMappingHashSet;
       
   298     
       
   299     /** Array of  valid regions. */
       
   300     RArray<TLanguageRegion>  iRegionsArray;
       
   301     };
   202     };
   302 
   203 
   303 #endif // SSMLANGSELCMD_H
   204 #endif // SSMLANGSELCMD_H