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