sysstatemgmt/syslangutil/ssmlangselcmd/inc/ssmlangselcmd.h
branchRCL_3
changeset 21 ccb4f6b3db21
parent 0 4e1aa6a622a0
child 22 8cb079868133
equal deleted inserted replaced
20:1ddbe54d0645 21:ccb4f6b3db21
     1 /*
     1 /*
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009-2010 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"
    22 #include <e32base.h>
    23 #include <e32base.h>
    23 #include <ssm/ssmcustomcommand.h>
    24 #include <ssm/ssmcustomcommand.h>
    24 #include <ssm/ssmadaptationcli.h>
    25 #include <ssm/ssmadaptationcli.h>
       
    26 #include <e32hashtab.h> 
    25 
    27 
    26 class CSsmMapperUtility;
    28 class CSsmMapperUtility;
    27 
    29 
    28 /**
    30 /**
    29  *  Each command is implemented in a class derived from MSsmCustomCommand.
    31  *  Each command is implemented in a class derived from MSsmCustomCommand.
   155      *
   157      *
   156      * @param aLang The language to use or a system-wide error code.
   158      * @param aLang The language to use or a system-wide error code.
   157      */
   159      */
   158     void UseLanguage(const TInt aLang);
   160     void UseLanguage(const TInt aLang);
   159 
   161 
       
   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 
   160 private: // data
   253 private: // data
   161 
   254 
   162     /** Custom command environment. Not owned. Set in Initialise. */
   255     /** Custom command environment. Not owned. Set in Initialise. */
   163     CSsmCustomCommandEnv* iEnv;
   256     CSsmCustomCommandEnv* iEnv;
   164 
   257 
   189     CArrayFix<TInt32>* iLangList;
   282     CArrayFix<TInt32>* iLangList;
   190     
   283     
   191     /** Internal state of the object. */
   284     /** Internal state of the object. */
   192     enum TState
   285     enum TState
   193         {
   286         {
       
   287         EQueryListNone = 0,
   194         EQueryListSize = 1,
   288         EQueryListSize = 1,
   195         EQueryListContent
   289         EQueryListContent = 2
   196         };
   290         };
   197     TState iState;
   291     TState iState;
   198     
   292     
   199     // The mapper utility instance, owned.
   293     // The mapper utility instance, owned.
   200     CSsmMapperUtility* iMapperUtility;
   294     CSsmMapperUtility* iMapperUtility;
   201 
   295 
       
   296     /** Array of  language and region mappings. */
       
   297     RHashSet<TLanguageRegion>  iLangRegionMappingHashSet;
       
   298     
       
   299     /** Array of  valid regions. */
       
   300     RArray<TLanguageRegion>  iRegionsArray;
   202     };
   301     };
   203 
   302 
   204 #endif // SSMLANGSELCMD_H
   303 #endif // SSMLANGSELCMD_H