commonutilities/common/inc/glxsettingsmodel.inl
branchRCL_3
changeset 59 8e5f6eea9c9f
equal deleted inserted replaced
57:ea65f74e6de4 59:8e5f6eea9c9f
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:  
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 //  CLASS HEADER
       
    22 #include "glxsettingsmodel.h"
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <centralrepository.h>
       
    26 #include <featmgr.h>
       
    27 
       
    28 //  INTERNAL INCLUDES
       
    29 #include <glxlog.h>
       
    30 
       
    31 namespace
       
    32     {
       
    33     const TUid KCRUidGallery = { 0x200009EE };
       
    34     }
       
    35 
       
    36 
       
    37 // ----------------------------------------------------------------------------
       
    38 // Retrieve value for a specific attribute uid
       
    39 // ----------------------------------------------------------------------------
       
    40 //
       
    41 template <typename T>
       
    42 inline T CGlxSettingsModel::ValueL(const TUint32& aSettingsId) 
       
    43     {
       
    44     GLX_LOG_INFO( "CGlxSettingsModel::ValueL" );
       
    45     CRepository* repository = CRepository::NewLC(KCRUidGallery);
       
    46     T retVal;
       
    47     User::LeaveIfError(repository->Get(aSettingsId, retVal));
       
    48     CleanupStack::PopAndDestroy(repository);
       
    49     repository = NULL;
       
    50     return retVal;
       
    51     }   
       
    52   
       
    53 // ----------------------------------------------------------------------------
       
    54 // Set the value for a specific attribute uid
       
    55 // ----------------------------------------------------------------------------
       
    56 //
       
    57 template<typename T> 
       
    58 inline void CGlxSettingsModel::SetValueL(const TUint32& aSettingsId, T aValue) 
       
    59 	{
       
    60 	GLX_LOG_INFO( "CGlxSettingsModel::SetValueL" );
       
    61 /*
       
    62     TAny* ptr = User::AllocL(sizeof(T));
       
    63     memcpy(ptr, &aValue, sizeof(T));
       
    64 */
       
    65     CRepository* repository = CRepository::NewLC(KCRUidGallery);
       
    66     User::LeaveIfError(repository->Set(aSettingsId, aValue));
       
    67     CleanupStack::PopAndDestroy(repository);
       
    68     repository = NULL;
       
    69    	}