profilesservices/ProfileEngine/WrapperSrc/CProEngProfileEventDelegate.cpp
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Implementation of CProEngProfileEventDelegate
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CProEngProfileEventDelegate.h"
       
    22 #include    <MProEngProfileObserver.h>
       
    23 
       
    24 namespace
       
    25     {
       
    26     // CONSTANTS
       
    27     // Profile ID is encoded in the first byte of a Profiles Engine CR key
       
    28     const TInt KProEngProfileIdShift( 24 );
       
    29     const TUint32 KProEngProfileIdMask( 0xFF000000 );
       
    30     }
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CProEngProfileEventDelegate::CProEngProfileEventDelegate
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CProEngProfileEventDelegate::CProEngProfileEventDelegate(
       
    39         TUint32 aPartialCenRepKey,
       
    40         TUint32 aKeyMask,
       
    41         MProEngProfileObserver& aObserver )
       
    42     : CProEngCenRepObserverBase( aPartialCenRepKey, aKeyMask ),
       
    43       iObserver( aObserver )
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CProEngProfileEventDelegate::NewL
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CProEngProfileEventDelegate* CProEngProfileEventDelegate::NewL(
       
    52           TInt aProfileId,
       
    53           MProEngProfileObserver& aObserver )
       
    54     {
       
    55     CProEngProfileEventDelegate* self = new ( ELeave )
       
    56         CProEngProfileEventDelegate( ( aProfileId << KProEngProfileIdShift ),
       
    57                                      KProEngProfileIdMask, aObserver );
       
    58 
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62 
       
    63     return self;
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CProEngProfileEventDelegate::NotifyObserverL
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CProEngProfileEventDelegate::NotifyObserverL()
       
    71     {
       
    72     iObserver.HandleProfileModifiedL( ProfileId() );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CProEngProfileEventDelegate::NotifyError
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 void CProEngProfileEventDelegate::NotifyError( TInt aError )
       
    80     {
       
    81     iObserver.HandleProfileNotificationError( aError );
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CProEngProfileEventDelegate::NotifyError
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 TInt CProEngProfileEventDelegate::ProfileId() const
       
    89     {
       
    90     return ( iKey >> KProEngProfileIdShift );
       
    91     }
       
    92 
       
    93 //  End of File
       
    94