wvuing/wvuieng/EngSrc/CCASettingsManager.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Settings manager
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCASETTINGSMANAGER_H
       
    20 #define CCASETTINGSMANAGER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "MCASettings.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MCASettingsObserver;
       
    28 class MCASDCRVariator;
       
    29 class CIMPSSAPSettingsStore;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  Handles all application settings-related operations.
       
    35 *
       
    36 *
       
    37 *  @lib CAEngine.lib
       
    38 *  @since 1.2
       
    39 */
       
    40 class CCASettingsManager : public CBase, public MCASettings
       
    41     {
       
    42 
       
    43     public:  // Constructors and destructor
       
    44 
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         * @param aIdentifier UID of application
       
    48         */
       
    49         static CCASettingsManager* NewL( TUid aIdentifier );
       
    50 
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CCASettingsManager();
       
    55 
       
    56     public: // From MCASettings
       
    57 
       
    58         /**
       
    59         * From MCASettings. @see MCASettings
       
    60         * @since 1.2
       
    61         * @param aObserver Settings observer pointer
       
    62         */
       
    63         void AddObserverL( const MCASettingsObserver* aObserver );
       
    64 
       
    65         /**
       
    66         * From MCASettings. @see MCASettings
       
    67         * @since 1.2
       
    68         * @param aObserver Settings observer pointer
       
    69         */
       
    70         void RemoveObserver( const MCASettingsObserver* aObserver );
       
    71 
       
    72         /**
       
    73         * From MCASettings. @see MCASettings
       
    74         * @since 1.2
       
    75         * @param aSetting Settings enumeration that value is returned
       
    76         * @return Value of setting
       
    77         */
       
    78         TBool Value( TCASettingFlags aSetting,
       
    79                      CIMPSSAPSettings* aSap = NULL );
       
    80 
       
    81         /**
       
    82         * From MCASettings. @see MCASettings
       
    83         * @since 1.2
       
    84         * @param aSetting Settings enumeration that value is returned
       
    85         * @return Value of setting
       
    86         */
       
    87         TInt Value( TCASettingIntegers aSetting,
       
    88                     CIMPSSAPSettings* aSap = NULL );
       
    89 
       
    90         /**
       
    91         * From MCASettings. @see MCASettings
       
    92         * Transfers ownership!!!
       
    93         * @since 1.2
       
    94         * @param aSetting Settings enumeration that value is returned
       
    95         * @return Value of setting
       
    96         */
       
    97         HBufC* ValueL( TCASettingStrings aSetting,
       
    98                        CIMPSSAPSettings* aSap = NULL );
       
    99 
       
   100         /**
       
   101         * From MCASettings. @see MCASettings
       
   102         * @param aSetting Settings enumeration that value is set
       
   103         * @param aValue Value of setting
       
   104         * @param aIgnoreRollback Don't perform rollback operation on these
       
   105         *                        errors. NULL if rollback is wanted in every
       
   106         *                        error situation.
       
   107         */
       
   108         void SetValueL( TCASettingFlags aSetting, TBool aValue,
       
   109                         RArray<TInt>* aIgnoreRollback = NULL,
       
   110                         CIMPSSAPSettings* aSap = NULL );
       
   111 
       
   112         /**
       
   113         * From MCASettings. @see MCASettings
       
   114         * @param aSetting Settings enumeration that value is set
       
   115         * @param aValue Value of setting
       
   116         * @param aIgnoreRollback Don't perform rollback operation on these
       
   117         *                        errors. NULL if rollback is wanted in every
       
   118         *                        error situation
       
   119         */
       
   120         void SetValueL( TCASettingIntegers aSetting, TInt aValue,
       
   121                         RArray<TInt>* aIgnoreRollback = NULL,
       
   122                         CIMPSSAPSettings* aSap = NULL );
       
   123 
       
   124         /**
       
   125         * From MCASettings. @see MCASettings
       
   126         * @param aSetting Settings enumeration that value is set
       
   127         * @param aValue Value of setting
       
   128         * @param aIgnoreRollback Don't perform rollback operation on these
       
   129         *                        errors. NULL if rollback is wanted in every
       
   130         *                        error situation
       
   131         */
       
   132         void SetValueL( TCASettingStrings aSetting, const TDesC& aValue,
       
   133                         RArray<TInt>* aIgnoreRollback = NULL,
       
   134                         CIMPSSAPSettings* aSap = NULL );
       
   135 
       
   136         /**
       
   137         * From MCASettings. @see MCASettings
       
   138         * @since 1.2
       
   139         */
       
   140         void FlushData();
       
   141 
       
   142         /**
       
   143         * From MCASettings. @see MCASettings
       
   144         * @since 3.1
       
   145         */
       
   146         void SetDefaultSapL( CIMPSSAPSettings* aSap );
       
   147 
       
   148         /**
       
   149         * From MCASettings. @see MCASettings
       
   150         * @since 3.1
       
   151         */
       
   152         HBufC* OwnAliasL();
       
   153 
       
   154         /**
       
   155         * From MCASettings. @see MCASettings
       
   156         * @since 3.1
       
   157         */
       
   158         void SetOwnAliasL( const TDesC& aAlias );
       
   159 
       
   160     private:
       
   161 
       
   162         /**
       
   163         * By default Symbian OS constructor is private.
       
   164         * @param aIdentifier Identifier of setting storage used
       
   165         */
       
   166         void ConstructL( TUid aIdentifier );
       
   167 
       
   168         /**
       
   169         * C++ default constructor.
       
   170         */
       
   171         CCASettingsManager();
       
   172 
       
   173         /**
       
   174         * Notifies observers about changed setting
       
   175         * @param aEnum Setting that was changed
       
   176         */
       
   177         void NotifyObserversL( TInt aEnum );
       
   178 
       
   179         /**
       
   180         * Returns default value for given setting if such exists
       
   181         * @since 1.2
       
   182         * @param aEnum Setting enumeration
       
   183         * @return Default value for that setting
       
   184         */
       
   185         TInt DefaultIntegerValue( TInt aEnum ) const;
       
   186 
       
   187         /**
       
   188         * Returns default value for given setting if such exists
       
   189         * @since 1.2
       
   190         * @param aEnum Setting enumeration
       
   191         * @return Default value for that setting
       
   192         */
       
   193         TBool DefaultBooleanValue( TInt aEnum ) const;
       
   194 
       
   195         /**
       
   196         * Helper method for setting boolean and integer values
       
   197         * @since 2.1
       
   198         * @param aSetting Settings enumeration that value is set
       
   199         * @param aValue Value of setting
       
   200         * @param oldValue old value of setting which is set if
       
   201         *        observers notifying leaves
       
   202         * @param aIgnoreRollback Don't perform rollback operation on these
       
   203         *                        errors. NULL if rollback is wanted in every
       
   204         *                        error situation
       
   205         */
       
   206         void SetIntValueL( TInt aSetting, TInt aValue, TInt oldValue,
       
   207                            RArray<TInt>* aIgnoreRollback = NULL,
       
   208                            CIMPSSAPSettings* aSap = NULL );
       
   209 
       
   210         /**
       
   211         * Converts the settings integer to sap opaque ids
       
   212         * @param aEnum Setting that was changed
       
   213         */
       
   214         const TDesC& ConvertSettingInteger( TInt aEnum ) const;
       
   215 
       
   216         /**
       
   217         * Get correct SAP. If aSap is NULL and RD_SETTINGS_FACELIFT
       
   218         * is defined will return default SAP.
       
   219         * !!NOTE!! If returns NULL, then there is nothing in
       
   220         * CleanupStack.
       
   221         * @param aSap server
       
   222         */
       
   223         CIMPSSAPSettings* GetSAPLC( CIMPSSAPSettings* aSap );
       
   224 
       
   225         /**
       
   226         * Store to SAP or cenrep
       
   227         * @param aSap server (can be NULL)
       
   228         * @param aSetting the setting which we are saving
       
   229         * @param aValue the value of the setting
       
   230         */
       
   231         void StoreL( CIMPSSAPSettings* aSap,
       
   232                      TInt aSetting,
       
   233                      TInt aValue );
       
   234 
       
   235         /**
       
   236         * Store to SAP or cenrep
       
   237         * @param aSap server (can be NULL)
       
   238         * @param aSetting the setting which we are saving
       
   239         * @param aValue the value of the setting
       
   240         */
       
   241         void StoreL( CIMPSSAPSettings* aSap,
       
   242                      TInt aSetting,
       
   243                      const TDesC& aValue );
       
   244 
       
   245         /**
       
   246          * Finds alias for given aUserID inside aAliasTable.
       
   247          * @param aAliasTable string containeing all aliases for different ids
       
   248          * @param aUserId Userid to look for
       
   249          * @param aIndex Position inside aAliasTable, where the wanted alias starts.
       
   250          *               Or KErrNotFound
       
   251          * @param aLength aLength length of alias
       
   252          */
       
   253         void LocateAliasL( const TDesC& aAliasTable, const TDesC& aUserId,
       
   254                            TInt& aIndex, TInt& aLength );
       
   255 
       
   256     private: // Data
       
   257 
       
   258         // Array of observers
       
   259         RPointerArray<MCASettingsObserver> iObserverList;
       
   260 
       
   261         MCASDCRVariator* iSDCRVariator;
       
   262 
       
   263         CIMPSSAPSettingsStore* iSapSettingsStore;
       
   264         CIMPSSAPSettings* iDefaultSap;
       
   265         TBool iSettingsFaceLift;
       
   266     };
       
   267 
       
   268 #endif      // CCASETTINGSMANAGER_H
       
   269 
       
   270 // End of File