pushmtm/MtmUtilInc/PushMtmSettings.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:  Push Mtm settings class declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef PUSHMTMSETTINGS_H
       
    21 #define PUSHMTMSETTINGS_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <e32std.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 class CPushInitiatorList;
       
    31 class CRepository;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 * CPushMtmSettings supports an API with which push mtm settings can be 
       
    37 * read or edited. These settings are stored in Central Repository.
       
    38 *
       
    39 * On construction with the static NewL or NewLC methods the new instance is 
       
    40 * initialized with the stored values (with the usage of the LoadL method).
       
    41 * Changes made are stored in the associated file if the SaveL method 
       
    42 * is called. It is possible that there are more than one instances of this 
       
    43 * class. The instances manipulate on the same CenRep.
       
    44 *
       
    45 * The instances do not update their settings values from the Repository 
       
    46 * automatically if it is modified. If an instance's owner wants that the 
       
    47 * settings values be up-to-date, then it should call LoadL or reconstruct a 
       
    48 * new CPushMtmSettings object.
       
    49 */
       
    50 class CPushMtmSettings : public CBase
       
    51     {
       
    52     public: // Type definitions
       
    53 
       
    54         enum TServiceLoading    ///< Service loading type
       
    55             {
       
    56             EAutomatic,         ///< Automatic loading
       
    57             EManual             ///< Manual loading
       
    58             };
       
    59 
       
    60     public: // Constructors and destructor
       
    61 
       
    62         /**
       
    63         * Two-phased constructor.
       
    64         * @return New CPushMtmSettings object.
       
    65         */
       
    66         IMPORT_C static CPushMtmSettings* NewL();
       
    67 
       
    68         /**
       
    69         * Two-phased constructor.
       
    70         * @return New CPushMtmSettings object.
       
    71         */
       
    72         IMPORT_C static CPushMtmSettings* NewLC();
       
    73 
       
    74         /**
       
    75         * Destructor.
       
    76         */
       
    77         IMPORT_C virtual ~CPushMtmSettings();
       
    78 
       
    79     public: // New functions
       
    80 
       
    81         // ==================== Setters =====================
       
    82 
       
    83         /**
       
    84         * Set service reception.
       
    85         * @param aReceive If this parameter is ETrue, service 
       
    86         *        reception is on. Otherwise it is off.
       
    87         * @return none
       
    88         */
       
    89         IMPORT_C void SetServiceReception( TBool aReceive );
       
    90 
       
    91         /**
       
    92         * Set service loading type.
       
    93         * @param aType Service loading type.
       
    94         * @return none
       
    95         */
       
    96         IMPORT_C void SetServiceLoadingType( TServiceLoading aType );
       
    97 
       
    98         // ==================== Getters =====================
       
    99 
       
   100         /**
       
   101         * Return wap push service reception setting.
       
   102         * @return Message reception setting.
       
   103         *         It is ETrue, if setting is on.
       
   104         *         It is EFalse, if setting is off.
       
   105         */
       
   106         IMPORT_C TBool ServiceReception() const;
       
   107 
       
   108         /**
       
   109         * Return wap push service loading type setting.
       
   110         * @return Service loading type setting.
       
   111         */
       
   112         IMPORT_C TServiceLoading ServiceLoadingType() const;
       
   113 
       
   114         /**
       
   115         * Return the 'White list' i.e. list of the addresses of push 
       
   116         * initiators from where we accept push messages.
       
   117         * @return The push initiator list.
       
   118         */
       
   119         IMPORT_C CPushInitiatorList& PushInitiatorList() const;
       
   120 
       
   121         // ==================== Saving and loading =====================
       
   122 
       
   123         /**
       
   124         * The data stored in the permanent store is internalized into the 
       
   125         * instance of this class.
       
   126         * The existing values will be overwritten.
       
   127         * @return none
       
   128         */
       
   129         IMPORT_C void LoadL();
       
   130 
       
   131         /**
       
   132         * Save changes if one ore more of then have been changed.
       
   133         * @param aForce Force saving to permanent store.
       
   134         * @return None.
       
   135         */
       
   136         IMPORT_C void SaveL( const TBool aForce = EFalse );
       
   137 
       
   138         /**
       
   139         * Restore factory settings from the Shared Data.
       
   140         * Note that it issues SaveL() to persist the settings!
       
   141         * @return None.
       
   142         */
       
   143         IMPORT_C void RestoreFactorySettingsL();
       
   144 
       
   145     private: // Constructors
       
   146         
       
   147         /**
       
   148         * Symbian OS constructor.
       
   149         */
       
   150         void ConstructL();
       
   151 
       
   152         /**
       
   153         * Constructor.
       
   154         */
       
   155         CPushMtmSettings();
       
   156 
       
   157     private: // New functions
       
   158 
       
   159         /**
       
   160         * Reset data members.
       
   161         * It is called at the beginning of LoadL(), for example.
       
   162         * @return none
       
   163         */
       
   164         void Reset();
       
   165 
       
   166         /**
       
   167         * Externalize into the Repository.
       
   168         * @param aRepository Central Repository
       
   169         * @return none
       
   170         */
       
   171         void ExternalizeL( CRepository& aRepository ) const;
       
   172 
       
   173         /**
       
   174         * Internalize from the Repository.
       
   175         * @param aRepository Central Repository
       
   176         * @return none
       
   177         */
       
   178         void InternalizeL( CRepository& aRepository );
       
   179 
       
   180         /**
       
   181         * Parse and process the streamed White List.
       
   182         * @param aStreamedBuf The streamed White List.
       
   183         * @return None.
       
   184         */
       
   185         void ParseAndProcessWhiteListBufL( const TDesC& aStreamedBuf );
       
   186 
       
   187     private: // Data
       
   188 
       
   189         TBool               iServiceReception; ///< Setting value.
       
   190         TServiceLoading     iServiceLoadingType; ///< Setting value.
       
   191         CPushInitiatorList* iPushInitiatorList; ///< The 'white list'. Owned.
       
   192 
       
   193         /// The following members indicate if a value has been changed.
       
   194         TBool               iServiceReceptionChanged;
       
   195         TBool               iServiceLoadingTypeChanged;
       
   196 
       
   197         TBool               iFeatureManagerInitialized;
       
   198     };
       
   199 
       
   200 #endif // PUSHMTMSETTINGS_H
       
   201 
       
   202 // End of File