wvuing/IMPSServiceSettingsUI/SharedDataSrc/CIMPSCenrepHandler.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Central repository handler for IMPSCommonUI
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CIMPSCENREPHANDLER_H
       
    19 #define __CIMPSCENREPHANDLER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "MIMPSSharedData.h"
       
    25 #include "MIMPSPropertyNotificationObserver.h"
       
    26 #include "IMPSSharedDataDefs.h"
       
    27 
       
    28 //#include <e32property.h>    // RProperty
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MIMPSSharedDataObserver;
       
    32 class CIMPSCenrepObserver;
       
    33 class CRepository;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  Shared data handler
       
    39 *
       
    40 *  @lib WVServiceSettingsUi.dll
       
    41 *  @since 2.6
       
    42 */
       
    43 NONSHARABLE_CLASS( CIMPSCenrepHandler ) : public CBase,
       
    44         public MIMPSSharedData,
       
    45         public MIMPSPropertyNotificationObserver
       
    46     {
       
    47 public: // New functions
       
    48     /**
       
    49     * Two-phased constructor.
       
    50     * @param aResourceId the resource of the setting page
       
    51     * @param aSelectionItemList the selection item list of the setting page
       
    52     */
       
    53     static CIMPSCenrepHandler* NewL( MIMPSSharedDataObserver* aObserver, const TUid aUid );
       
    54 
       
    55 private: // constructor and destructor
       
    56 
       
    57     /**
       
    58     * C++ default constructor.
       
    59     */
       
    60     CIMPSCenrepHandler( MIMPSSharedDataObserver* aObserver );
       
    61 
       
    62     /**
       
    63      * Symbian OS constructor.
       
    64      */
       
    65     void ConstructL( const TUid aUid );
       
    66 
       
    67     /**
       
    68     * Destructor.
       
    69     */
       
    70     virtual ~CIMPSCenrepHandler();
       
    71 
       
    72 
       
    73 private: //Functions from base classes
       
    74 
       
    75     /**
       
    76     * From MIMPSSharedData
       
    77     * @see MIMPSSharedData
       
    78     */
       
    79     TInt SubscribeChange( const TUid aUid, const TIMPSSharedKeys aKey );
       
    80 
       
    81     /**
       
    82     * From MIMPSSharedData
       
    83     * @see MIMPSSharedData
       
    84     */
       
    85     TInt SubscribeSet( const TUid aUid, const TIMPSSharedKeys aKey );
       
    86 
       
    87     /**
       
    88     * From MIMPSSharedData
       
    89     * @see MIMPSSharedData
       
    90     */
       
    91     void UnSubscribe( const TUid aUid, const TIMPSSharedKeys aKey );
       
    92 
       
    93     /**
       
    94     * From MIMPSSharedData
       
    95     * @see MIMPSSharedData
       
    96     */
       
    97     TInt GetStringKey( const TIMPSSharedKeys aKey, TDes& aValue );
       
    98 
       
    99     /**
       
   100     * From MIMPSSharedData
       
   101     * @see MIMPSSharedData
       
   102     */
       
   103     TInt GetIntKey( const TIMPSSharedKeys aKey, TInt& aValue );
       
   104 
       
   105     /**
       
   106     * From MIMPSSharedData
       
   107     * @see MIMPSSharedData
       
   108     */
       
   109     TInt SetStringKey( const TIMPSSharedKeys aKey, const TDesC& aValue );
       
   110 
       
   111     /**
       
   112     * From MIMPSSharedData
       
   113     * @see MIMPSSharedData
       
   114     */
       
   115     TInt SetIntKey( const TIMPSSharedKeys aKey, TInt aValue );
       
   116 
       
   117     /**
       
   118     * From MIMPSSharedData
       
   119     * @see MIMPSSharedData
       
   120     */
       
   121     TInt Signal( const TIMPSSharedKeys aKey );
       
   122 
       
   123     /**
       
   124     * From MIMPSSharedData
       
   125     * @see MIMPSSharedData
       
   126     */
       
   127     TInt CancelSignal( const TIMPSSharedKeys aKey );
       
   128 
       
   129     /**
       
   130     * From MIMPSPropertyNotificationObserver
       
   131     * @see MIMPSPropertyNotificationObserver
       
   132     */
       
   133     void HandlePropertyNotificationEventL( TUid aCategory, TUint aKey );
       
   134 
       
   135     /**
       
   136     * From MSharedDataNotifyHandler
       
   137     * Converts shared data keys to TIMPSSharedKeys
       
   138     * @param aKey keyword
       
   139     * @return error code
       
   140     */
       
   141     TInt ConvertSharedDataKey( const TDesC& aSrc, TIMPSSharedKeys& aDest );
       
   142 
       
   143 private: // new functions
       
   144 
       
   145     /**
       
   146     * Does the actual subscribing
       
   147     * @param aUid the uid of the property
       
   148     * @param aKey the key of the property
       
   149     */
       
   150     void DoSubscribeChangeL( const TUid aUid, const TIMPSSharedKeys aKey );
       
   151 
       
   152     /**
       
   153     * Does the actual subscribing
       
   154     * @param aUid the uid of the property
       
   155     * @param aKey the key of the property
       
   156     */
       
   157     void DoSubscribeSetL( const TUid aUid, const TIMPSSharedKeys aKey );
       
   158 
       
   159     /**
       
   160     * Does the actual signalling
       
   161     * @param aKey the key to signal
       
   162     */
       
   163     void DoSignalL( const TIMPSSharedKeys aKey );
       
   164 
       
   165     /**
       
   166     * Does the actual cancelling
       
   167     * @param aKey the key to cancel the signal from
       
   168     */
       
   169     void DoCancelSignalL( const TIMPSSharedKeys aKey );
       
   170 
       
   171     /**
       
   172     * Converts the shared data keys to TIMPSSharedKeys
       
   173     * @param aKey the key from the enumeration that clients use
       
   174     * @param aSharedDataKey the shared data key
       
   175     * @return KErrNone if found, KErrNotFound if not found
       
   176     */
       
   177     TInt MapKeysToClient( TIMPSSharedKeys& aKey, const TDesC& aSharedDataKey );
       
   178 
       
   179     /**
       
   180     * Creates the array of key mappings
       
   181     */
       
   182     void AppendKeyPairsL( );
       
   183 
       
   184     /**
       
   185     * Appends a key pair into the array of keys
       
   186     * @param aKey the key from the enumeration that clients use
       
   187     * @param aSharedDataKey the shared data key
       
   188     */
       
   189     void DoAppendKeyPairL( TIMPSSharedKeys aKey, const TDesC& aSharedDataKey );
       
   190 
       
   191 
       
   192 
       
   193 private:    // Data
       
   194     // Doesn't own: observer for the shared data.
       
   195     MIMPSSharedDataObserver* iObserver;
       
   196 
       
   197     // identifier of the ini file we are interested in
       
   198     TUid iUid;
       
   199 
       
   200     // Owns: array of property observers
       
   201     RPointerArray<CIMPSCenrepObserver> iCenrepObservers;
       
   202 
       
   203     //Array of key pairs
       
   204     RArray<TIMPSSharedKeyPairs> iKeys;
       
   205 
       
   206     // Owns: central repository
       
   207     CRepository*			iRepository;
       
   208     };
       
   209 
       
   210 #endif      // __CIMPSCENREPHANDLER_H
       
   211 
       
   212 // End of File