|
1 /* |
|
2 * Copyright (c) 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 * Symbian specific settings handling |
|
19 */ |
|
20 |
|
21 #include <QCoreApplication> |
|
22 #include <QVariant> |
|
23 #include <QList> |
|
24 #include <QMetaType> |
|
25 |
|
26 #include "cxesettingsmodel.h" |
|
27 #include "cxefeaturemanagerimp.h" |
|
28 #include "cxutils.h" |
|
29 #include "cxeerror.h" |
|
30 |
|
31 |
|
32 /* |
|
33 * CxeFeatureManagerImp::isFeatureSupported |
|
34 */ |
|
35 CxeError::Id CxeFeatureManagerImp::isFeatureSupported(const QString& key, bool& supported) const |
|
36 { |
|
37 CX_DEBUG_ENTER_FUNCTION(); |
|
38 |
|
39 QVariant value; |
|
40 CxeError::Id err = mSettingsModel.getRuntimeValue(key, value); |
|
41 if (err == CxeError::None) { |
|
42 QList<QVariant> values = qVariantValue<QList<QVariant> >(value); |
|
43 supported = values[0].toInt(); |
|
44 } else { |
|
45 supported = false; |
|
46 } |
|
47 |
|
48 CX_DEBUG_EXIT_FUNCTION(); |
|
49 |
|
50 return err; |
|
51 } |
|
52 |
|
53 |
|
54 |
|
55 /* |
|
56 * CxeFeatureManagerImp::configuredValues |
|
57 */ |
|
58 CxeError::Id CxeFeatureManagerImp::configuredValues(const QString& key,QList<int>& values) |
|
59 { |
|
60 CX_DEBUG_ENTER_FUNCTION(); |
|
61 |
|
62 values.clear(); |
|
63 |
|
64 QVariant variant; |
|
65 CxeError::Id err = mSettingsModel.getRuntimeValue(key, variant); |
|
66 |
|
67 if(CxeError::None == err) { |
|
68 QVariantList list; |
|
69 list = qVariantValue<QVariantList>(variant); |
|
70 |
|
71 CX_DEBUG( ("CxeFeatureManagerImp::configuredValues <> count: %d",list.count() ) ); |
|
72 |
|
73 foreach (QVariant value, list ) { |
|
74 // go through the settings list. |
|
75 QString dataString = value.toString(); |
|
76 bool isInt; |
|
77 int intValue = dataString.toInt(&isInt,0); // 0 denotes base, check the API |
|
78 |
|
79 if (isInt) { |
|
80 CX_DEBUG( ("CxeFeatureManagerImp::configuredValues <> value = %d",intValue) ); |
|
81 values.append(intValue); |
|
82 } else { |
|
83 err = CxeError::NotSupported; |
|
84 } |
|
85 } |
|
86 list.clear(); |
|
87 } |
|
88 |
|
89 CX_DEBUG_EXIT_FUNCTION(); |
|
90 return err; |
|
91 } |
|
92 |
|
93 |
|
94 /* |
|
95 *CxeFeatureManagerImp::CxeFeatureManagerImp |
|
96 */ |
|
97 CxeFeatureManagerImp::CxeFeatureManagerImp(CxeSettingsModel& settingsModel) |
|
98 : mSettingsModel(settingsModel) |
|
99 { |
|
100 CX_DEBUG_ENTER_FUNCTION(); |
|
101 CX_DEBUG_EXIT_FUNCTION(); |
|
102 } |
|
103 |
|
104 |
|
105 /* |
|
106 *CxeFeatureManagerImp::~CxeFeatureManagerImp |
|
107 */ |
|
108 CxeFeatureManagerImp::~CxeFeatureManagerImp() |
|
109 { |
|
110 CX_DEBUG_ENTER_FUNCTION(); |
|
111 CX_DEBUG_EXIT_FUNCTION(); |
|
112 } |
|
113 |
|
114 |
|
115 // end of file |