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 #include "infowidgetpreferences.h" |
|
19 #include "infowidgetlogging.h" |
|
20 |
|
21 |
|
22 /*! |
|
23 InfoWidgetPreferences::InfoWidgetPreferences() |
|
24 */ |
|
25 InfoWidgetPreferences::InfoWidgetPreferences(QObject *parent): |
|
26 QObject(parent) |
|
27 { |
|
28 DPRINT; |
|
29 } |
|
30 |
|
31 /*! |
|
32 InfoWidgetPreferences::~InfoWidgetPreferences() |
|
33 */ |
|
34 InfoWidgetPreferences::~InfoWidgetPreferences() |
|
35 { |
|
36 DPRINT; |
|
37 } |
|
38 |
|
39 /*! |
|
40 InfoWidgetPreferences::loadPreferences() |
|
41 */ |
|
42 void InfoWidgetPreferences::loadPreferences() |
|
43 { |
|
44 DPRINT; |
|
45 } |
|
46 |
|
47 /*! |
|
48 InfoWidgetPreferences::storePreferences() |
|
49 */ |
|
50 void InfoWidgetPreferences::storePreferences() |
|
51 { |
|
52 DPRINT; |
|
53 } |
|
54 |
|
55 /*! |
|
56 InfoWidgetPreferences::preference() |
|
57 */ |
|
58 QString InfoWidgetPreferences::preference(Option preferenceId) const |
|
59 { |
|
60 DPRINT << ": preference id: " << static_cast<int>(preferenceId); |
|
61 |
|
62 QString preferenceString; |
|
63 if (m_options.testFlag(preferenceId)) { |
|
64 preferenceString = DISPLAY_SETTING_ON; |
|
65 } else { |
|
66 preferenceString = DISPLAY_SETTING_OFF; |
|
67 } |
|
68 |
|
69 return preferenceString; |
|
70 } |
|
71 |
|
72 /*! |
|
73 InfoWidgetPreferences::setPreference() |
|
74 */ |
|
75 void InfoWidgetPreferences::setPreference(Option preferenceId, |
|
76 const QString& preferenceString) |
|
77 { |
|
78 DPRINT << ": preference id: " << static_cast<int>(preferenceId); |
|
79 DPRINT << ": preference string: " << preferenceString; |
|
80 DPRINT << ": initial options: " << m_options; |
|
81 |
|
82 if (preferenceString.compare(DISPLAY_SETTING_ON) == 0) { |
|
83 m_options |= preferenceId; |
|
84 } else { |
|
85 m_options &= ~preferenceId; |
|
86 } |
|
87 |
|
88 DPRINT << ": modified options: " << m_options; |
|
89 } |
|
90 |
|
91 /*! |
|
92 InfoWidgetPreferences::visibleItemCount() |
|
93 */ |
|
94 int InfoWidgetPreferences::visibleItemCount() |
|
95 { |
|
96 DPRINT << ": IN"; |
|
97 |
|
98 int visibleItems = 0; |
|
99 if (m_options.testFlag(DisplayHomeZone)){ |
|
100 visibleItems++; |
|
101 } |
|
102 if (m_options.testFlag(DisplayMcn)){ |
|
103 visibleItems++; |
|
104 } |
|
105 if (m_options.testFlag(DisplayActiveLine)){ |
|
106 visibleItems++; |
|
107 } |
|
108 if (m_options.testFlag(DisplaySatText)){ |
|
109 visibleItems++; |
|
110 } |
|
111 |
|
112 DPRINT << ": visible item count: " << visibleItems; |
|
113 return visibleItems; |
|
114 } |
|
115 |
|
116 // End of File. |
|
117 |
|