PECengine/AttributeLibrary2/SrcWVAttributes/PEngInfoLinkSupport.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 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:  Wireless Village InfoLink attribute support selector.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "PEngInfoLinkSupport.h"
       
    20 #include "PresenceDebugPrint.h"
       
    21 #include <centralrepository.h>
       
    22 #include <PresenceEngineInternalCRKeys.h>
       
    23 #include <E32Base.h>
       
    24 
       
    25 
       
    26 
       
    27 // ============================ LOCAL FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // DoInfoLinkSupported()
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 void DoInfoLinkSupportedL( TBool& aInfoLinkSupported )
       
    34     {
       
    35     aInfoLinkSupported = ETrue;
       
    36 
       
    37     TInt supportValue;
       
    38     CRepository* cenRep = CRepository::NewLC( KCRUIDPresenceEngineVariation );
       
    39     TInt err = cenRep->Get( KPEngVariationInfoLinkSupported,
       
    40                             supportValue );
       
    41     CleanupStack::PopAndDestroy(); //cenRep
       
    42 
       
    43     if ( err == KErrNone )
       
    44         {
       
    45         if ( supportValue == EPEngVariationInfoLinkNotSupported )
       
    46             {
       
    47             aInfoLinkSupported = EFalse;
       
    48             }
       
    49         }
       
    50     }
       
    51 
       
    52 
       
    53 // ============================ MEMBER FUNCTIONS ===============================
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // PEngInfoLinkSupport::InfoLinkSupportedL()
       
    57 // -----------------------------------------------------------------------------
       
    58 EXPORT_C TBool PEngInfoLinkSupport::InfoLinkSupportedL()
       
    59     {
       
    60     PENG_DP( D_PENG_LIT( "PEngInfoLinkSupport::InfoLinkSupportedL() - from PE CenRep" ) );
       
    61 
       
    62 
       
    63     TBool infoLinkSupported = ETrue;
       
    64     TRAPD( err, DoInfoLinkSupportedL( infoLinkSupported ) );
       
    65     if ( err != KErrNotFound )
       
    66         {
       
    67         User::LeaveIfError( err );
       
    68         }
       
    69 
       
    70     PENG_DP( D_PENG_LIT( "PEngInfoLinkSupport::InfoLinkSupportedL() - %d" ),
       
    71              infoLinkSupported );
       
    72 
       
    73     return infoLinkSupported;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // PEngInfoLinkSupport::SetInfoLinkSupportedL()
       
    78 // -----------------------------------------------------------------------------
       
    79 EXPORT_C void PEngInfoLinkSupport::SetInfoLinkSupportedL( TBool aSupport )
       
    80     {
       
    81     PENG_DP( D_PENG_LIT( "PEngInfoLinkSupport::SetVersionL() - Setting %d to PE CenRep" ), aSupport );
       
    82 
       
    83 
       
    84     TInt protocolValue = EPEngVariationInfoLinkNotSupported;
       
    85     if ( aSupport )
       
    86         {
       
    87         protocolValue = EPEngVariationInfoLinkSupported;
       
    88         }
       
    89 
       
    90     CRepository* cenRep = CRepository::NewLC( KCRUIDPresenceEngineVariation );
       
    91     User::LeaveIfError( cenRep->Set( KPEngVariationInfoLinkSupported, protocolValue ) );
       
    92     CleanupStack::PopAndDestroy(); //cenRep
       
    93 
       
    94 
       
    95     PENG_DP( D_PENG_LIT( "PEngInfoLinkSupport::SetVersionL() - done" ) );
       
    96     }
       
    97 
       
    98 
       
    99 //  End of File
       
   100 
       
   101 
       
   102