messagingfw/alwaysonline/AlwaysOnlineManager/inc/AOCenRepControl.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 /*
       
     2 * Copyright (c) 2006 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: AlwaysOnline server central repository controller
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAOCENREPCONTROL_H
       
    20 #define CAOCENREPCONTROL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "AlwaysOnlineManager.h"
       
    26 
       
    27 // CONSTANTS
       
    28 // MACROS
       
    29 // DATA TYPES
       
    30 // FUNCTION PROTOTYPES
       
    31 // FORWARD DECLARATIONS
       
    32 // CLASS DECLARATION
       
    33 
       
    34 
       
    35 /**
       
    36 * Utility class for always online to easily handle central repository.
       
    37 *
       
    38 * @since S60 3.1
       
    39 */
       
    40 class CAOCenRepControl : public CBase
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Creates object from CAOCenRepControl and leaves it to cleanup stack
       
    46         * @since S60 3.1
       
    47         * @return, Constructed object
       
    48         */
       
    49         static CAOCenRepControl* NewLC( CAlwaysOnlineManager& aCallBack );
       
    50 
       
    51         /**
       
    52         * Create object from CAOCenRepControl
       
    53         * @since S60 3.1
       
    54         * @return, Constructed object
       
    55         */
       
    56         static CAOCenRepControl* NewL( CAlwaysOnlineManager& aCallBack );
       
    57 
       
    58         /**
       
    59         * Destructor
       
    60         * @since S60 3.1
       
    61         */
       
    62         virtual ~CAOCenRepControl();
       
    63 
       
    64     public: // New functions
       
    65 
       
    66         /**
       
    67         * Recreates CoreAppUi CenRep session and start notifiers.
       
    68         * @since S60 3.0
       
    69         */
       
    70         void ReCreateCoreAppUiCenRepSessionL();
       
    71             
       
    72         /**
       
    73         * Sets cenrep key.
       
    74         * @since S60 3.1
       
    75         * @param aRepository, cenrep repository
       
    76         * @param aKeyId, key to set
       
    77         * @param aValue, value
       
    78         * @return TInt, result
       
    79         */
       
    80         TInt SetCenRepKey( 
       
    81             const TUid& aRepository, 
       
    82             const TUint32 aKeyId, 
       
    83             TInt aValue );
       
    84         
       
    85         /**
       
    86         * Gets cenrep key.
       
    87         * @since S60 3.1
       
    88         * @param aRepository, cenrep repository
       
    89         * @param aKeyId key to get
       
    90         * @param aValue, value to return
       
    91         * @return TInt, result
       
    92         */    
       
    93         TInt GetCenRepKey( 
       
    94             const TUid& aRepository, 
       
    95             const TUint32 aKeyId, 
       
    96             TInt& aValue );
       
    97 
       
    98         /**
       
    99         * Deletes cenrep key.
       
   100         * @since S60 3.1
       
   101         * @param aRepository, cenrep repository
       
   102         * @param aKeyId, key to get
       
   103         * @return TInt, result
       
   104         */   
       
   105         TInt DelCenRepKey(
       
   106             const TUid& aRepository,
       
   107             const TUint32 aKeyId );
       
   108 
       
   109         /**
       
   110         * Update the array, which contains disabled plugin's UIDs
       
   111         * @param aDisabledPluginUidsArray, UIDs array
       
   112         * @since S60 3.1
       
   113         */
       
   114         void UpdateDisabledPluginsUids( 
       
   115             CArrayFixFlat<TUid>& aDisabledPluginUidsArray );
       
   116 
       
   117         /**
       
   118         * Adds or removes plugin's UID from cenrep and updates
       
   119         * the total count of disabled plugins.
       
   120         * @since S60 3.1
       
   121         * @param const aPlugin, UID to add/remove
       
   122         * @param aDisable, add or remove?
       
   123         */
       
   124         void SetPluginStatus( const TUid& aPlugin, TBool aDisable );
       
   125         
       
   126         /**
       
   127         * Gets first free key from cenrep.
       
   128         * @since S60 3.1
       
   129         * @param aFreeKey, free cenrep key
       
   130         * @return TBool, did it found?
       
   131         */
       
   132         TBool GetFirstFreeKey( TUint32& aFreeKey );
       
   133         
       
   134         /**
       
   135         * Gets the key, which contains certain UID.
       
   136         * @since S60 3.1
       
   137         * @param aValue, value to search
       
   138         * @param aKey, free cenrep key
       
   139         * @return TBool, did it found?
       
   140         */
       
   141         TBool GetKeyWithValue( const TUid& aValue, TUint32& aKey );
       
   142         
       
   143         /**
       
   144         * @since S60 3.1
       
   145         * @param aIncrease, increase or decrease?
       
   146         * @return TInt, result
       
   147         */
       
   148         TInt UpdateDisabledPluginsCount( TBool aIncrease );
       
   149 
       
   150     public: // Functions from base classes
       
   151 
       
   152     protected:  // Constructors
       
   153 
       
   154         /**
       
   155         * Default constructor for classCAOCenRepControl
       
   156         * @since S60 3.1
       
   157         * @return, Constructed object
       
   158         */
       
   159         CAOCenRepControl( CAlwaysOnlineManager& aCallBack );
       
   160 
       
   161         /**
       
   162         * Symbian 2-phase constructor
       
   163         * @since S60 3.1
       
   164         */
       
   165         void ConstructL();
       
   166 
       
   167     private:  // New functions
       
   168 
       
   169         /**
       
   170         * Creates CoreAppUi CenRep session and start notifiers.
       
   171         * @since S60 3.0
       
   172         */
       
   173         void CreateCoreAppUiCenRepSessionL();
       
   174         
       
   175         /**
       
   176         * Creates AoServer CenRep session.
       
   177         * @since S60 3.1
       
   178         */
       
   179         void CreateAoServerCenRepSessionL();
       
   180 
       
   181     private:  // Functions from base classes
       
   182 
       
   183     private:    // Data
       
   184         // Call back class for iCoreAppUiCenRepNotifier
       
   185         CAlwaysOnlineManager&           iCallBack;
       
   186         // Central Repository session for KCRUidCoreApplicationUIs
       
   187         CRepository*                    iCoreAppUiCenRepSession;
       
   188         // Central Repository session for KCRUidAOSettings
       
   189         CRepository*                    iAoServerCenRepSession;
       
   190         // Notifier to listen changes of offline state
       
   191         CCenRepNotifyHandler*           iCoreAppUiCenRepNotifier;
       
   192     };
       
   193 
       
   194 #endif //  CAOCENREPCONTROL_H
       
   195 
       
   196 // End of File