|
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 #ifndef INFOWIDGETPREFERENCES_H |
|
19 #define INFOWIDGETPREFERENCES_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QStringList> |
|
23 #include <QFlags> |
|
24 |
|
25 // Preference string values |
|
26 const char DISPLAY_SETTING_ON[] = "On"; |
|
27 const char DISPLAY_SETTING_OFF[] = "Off"; |
|
28 |
|
29 // Class declaration |
|
30 class InfoWidgetPreferences : public QObject |
|
31 { |
|
32 Q_OBJECT |
|
33 |
|
34 public: |
|
35 enum DisplaySetting { |
|
36 DisplayOff = 0, |
|
37 DisplayOn |
|
38 }; |
|
39 |
|
40 enum Option { |
|
41 DisplayHomeZone = 0x1, |
|
42 DisplayMcn = 0x2, |
|
43 DisplayActiveLine = 0x4, |
|
44 DisplaySatText = 0x8, |
|
45 DisplaySpn = 0x10 |
|
46 }; |
|
47 Q_DECLARE_FLAGS(Options, Option) |
|
48 |
|
49 public: |
|
50 InfoWidgetPreferences(QObject *parent = NULL); |
|
51 ~InfoWidgetPreferences(); |
|
52 |
|
53 bool storePreferences(); |
|
54 void restorePreferences(); |
|
55 QStringList preferenceNames(); |
|
56 |
|
57 bool isPreferenceSet(Option preferenceId) const; |
|
58 QString preference(Option preferenceId) const; |
|
59 InfoWidgetPreferences::Options preferences() const; |
|
60 void setPreference(Option preferenceId, const QString &preferenceString); |
|
61 |
|
62 bool validate(); |
|
63 int visibleItemCount(); |
|
64 |
|
65 signals: |
|
66 void preferencesChanged(InfoWidgetPreferences::Options options); |
|
67 |
|
68 private: |
|
69 Q_DISABLE_COPY(InfoWidgetPreferences) |
|
70 |
|
71 InfoWidgetPreferences::Options m_options; |
|
72 InfoWidgetPreferences::Options m_validatedOptions; |
|
73 }; |
|
74 |
|
75 Q_DECLARE_OPERATORS_FOR_FLAGS(InfoWidgetPreferences::Options) |
|
76 |
|
77 #endif // INFOWIDGETPREFERENCES_H |
|
78 |