|
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 INFOWIDGETENGINE_H_ |
|
19 #define INFOWIDGETENGINE_H_ |
|
20 |
|
21 #include <QObject> |
|
22 #include <QString> |
|
23 #include "infowidgetpreferences.h" |
|
24 |
|
25 // Forward declarations |
|
26 class InfoWidgetNetworkHandler; |
|
27 class InfoWidgetSatHandler; |
|
28 class InfoWidgetLineHandler; |
|
29 |
|
30 // Class declaration |
|
31 class InfoWidgetEngine : public QObject |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 enum HandlerEntity { |
|
37 NotDefined = 0, |
|
38 NetworkHandler, |
|
39 SatHandler, |
|
40 LineHandler |
|
41 }; |
|
42 |
|
43 class ModelData { |
|
44 public: |
|
45 int mcnIndicatorType() const { return m_mcnIndicatorType; }; |
|
46 void setMcnIndicatorType(const int type){ m_mcnIndicatorType = type; }; |
|
47 |
|
48 int homeZoneIndicatorType() const { return m_homeZoneIndicatorType; }; |
|
49 void setHomeZoneIndicatorType(const int type){ m_homeZoneIndicatorType = type; }; |
|
50 |
|
51 int activeLine() const { return m_activeLine; }; |
|
52 void setActiveLine(const int line){ m_activeLine = line; }; |
|
53 |
|
54 const QString& mcnName() const { return m_mcnName; }; |
|
55 void setMcnName(const QString& name){ m_mcnName = name; }; |
|
56 |
|
57 const QString& serviceProviderName() const { return m_serviceProviderName; }; |
|
58 void setServiceProviderName(const QString& name){ m_serviceProviderName = name; }; |
|
59 |
|
60 bool serviceProviderNameDisplayRequired() const { |
|
61 return m_serviceProviderNameDisplayRequired; }; |
|
62 void setServiceProviderNameDisplayRequired(bool required){ |
|
63 m_serviceProviderNameDisplayRequired = required; }; |
|
64 |
|
65 const QString& homeZoneTextTag() const { return m_homeZoneTextTag; }; |
|
66 void setHomeZoneTextTag(const QString& tag){ m_homeZoneTextTag = tag; }; |
|
67 |
|
68 const QString& satDisplayText() const { return m_satDisplayText; }; |
|
69 void setSatDisplayText(const QString& text){ m_satDisplayText = text; }; |
|
70 |
|
71 private: |
|
72 int m_mcnIndicatorType; |
|
73 int m_homeZoneIndicatorType; |
|
74 int m_activeLine; |
|
75 bool m_serviceProviderNameDisplayRequired; |
|
76 |
|
77 QString m_mcnName; |
|
78 QString m_serviceProviderName; |
|
79 QString m_homeZoneTextTag; |
|
80 QString m_satDisplayText; |
|
81 }; |
|
82 |
|
83 public: |
|
84 InfoWidgetEngine(QObject *parent = NULL); |
|
85 ~InfoWidgetEngine(); |
|
86 |
|
87 const InfoWidgetEngine::ModelData &modelData() const; |
|
88 |
|
89 signals: |
|
90 void modelError(int operation, int errorCode); |
|
91 void modelChanged(); |
|
92 |
|
93 public slots: |
|
94 void updateNetworkDataToModel(); |
|
95 void updateSatDataToModel(); |
|
96 void updateLineDataToModel(); |
|
97 |
|
98 void handleNetworkError( |
|
99 int operation, |
|
100 int errorCode); |
|
101 void handleSatError(int operation, int errorCode); |
|
102 void handleLineError(int operation, int errorCode); |
|
103 |
|
104 void suspend(); |
|
105 void resume(); |
|
106 |
|
107 void handlePreferencesChanged( |
|
108 InfoWidgetPreferences::Options options); |
|
109 |
|
110 private: |
|
111 ModelData m_modelData; |
|
112 |
|
113 // Own |
|
114 QScopedPointer<InfoWidgetNetworkHandler> m_networkHandler; |
|
115 QScopedPointer<InfoWidgetSatHandler> m_satHandler; |
|
116 }; |
|
117 |
|
118 #endif /* INFOWIDGETENGINE_H_ */ |
|
119 |
|
120 |