1 /* |
|
2 * Copyright (c) 2010 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 __CONNECTIONVIEW_H__ |
|
19 #define __CONNECTIONVIEW_H__ |
|
20 |
|
21 #include <QObject> |
|
22 #include <QSharedPointer> |
|
23 #include <HbMainWindow> |
|
24 #include <HbDialog> |
|
25 #include <QStringList> |
|
26 #include <HbWidget> |
|
27 #include <QtNetwork> |
|
28 #include <QGraphicsLinearLayout> |
|
29 #include <HbGroupBox> |
|
30 #include <HbScrollArea> |
|
31 #include <HbToolBar> |
|
32 #include <HbLabel> |
|
33 #include <qnetworksession.h> |
|
34 #include <qnetworkconfigmanager.h> |
|
35 |
|
36 // Forward declarations |
|
37 class HbTranslator; |
|
38 |
|
39 |
|
40 QTM_USE_NAMESPACE |
|
41 |
|
42 class QSignalMapper; |
|
43 |
|
44 const QString bearer2G = "2G"; |
|
45 const QString bearerWCDMA = "WCDMA"; |
|
46 const QString bearerHSPA = "HSPA"; |
|
47 const QString bearerCDMA2000 = "CDMA2000"; |
|
48 const int timerValue = 3000; |
|
49 |
|
50 class ConnectionView: public HbMainWindow |
|
51 { |
|
52 Q_OBJECT |
|
53 |
|
54 public: |
|
55 /* Constructor */ |
|
56 ConnectionView(); |
|
57 |
|
58 /* Destructor */ |
|
59 ~ConnectionView(); |
|
60 |
|
61 /** |
|
62 * This is the re-implemented timerEvent function used to trigger |
|
63 * closing of the application. It is received every time the set timer expires. |
|
64 */ |
|
65 void timerEvent(QTimerEvent * /*event*/); |
|
66 |
|
67 private slots: |
|
68 /* Handles the changes in the cellular data connections */ |
|
69 void handleConfigurationChanged(const QNetworkConfiguration& config); |
|
70 |
|
71 /* Disonnects the iap given as a parameter */ |
|
72 void disconnectSelectedIap(int iapId); |
|
73 |
|
74 /* Disconnects all the cellular iaps */ |
|
75 void disconnectAll(); |
|
76 |
|
77 /* |
|
78 * Does the actual stopping of the sessions, once the session's |
|
79 * opened-signal is received |
|
80 */ |
|
81 void stopSessions(); |
|
82 |
|
83 /* Deletes the sender when the session opening fails */ |
|
84 void errorSessions(QNetworkSession::SessionError); |
|
85 |
|
86 private: |
|
87 |
|
88 /* Constructs the view */ |
|
89 void createView(); |
|
90 |
|
91 /* |
|
92 * Creates group boxes into the view for all the active cellular |
|
93 * connections. |
|
94 */ |
|
95 void createGroupBoxesForConnections(); |
|
96 |
|
97 /* |
|
98 * Updates the list of active cellular connections into the |
|
99 * list received as a reference parameter. |
|
100 */ |
|
101 void getActiveCellularConnections(QList<QNetworkConfiguration> &activeConfigurations); |
|
102 |
|
103 /* |
|
104 * Creates a single groupbox for the iap given as a paremeters. Attaches the |
|
105 * group boxes disconnect button to the disconnectSelectedIap slot |
|
106 */ |
|
107 void addGroupBox(int iapId, QString iapName); |
|
108 |
|
109 /* Clears the groupboxes from the view */ |
|
110 void clearGroupBoxView(); |
|
111 |
|
112 private: |
|
113 /* Pointer to network configuration manager */ |
|
114 QNetworkConfigurationManager* mNetConfigurationManager; |
|
115 |
|
116 /* Pointer to the main view of the window */ |
|
117 HbView *mMainView; |
|
118 |
|
119 /* Pointer to the secondary view of the window */ |
|
120 HbView *mNoConnView; |
|
121 |
|
122 /* The main vertical layout which contains the group box container */ |
|
123 QGraphicsLinearLayout* mMainLayout; |
|
124 |
|
125 /* The scroll area of the view */ |
|
126 HbScrollArea *mScrollArea; |
|
127 |
|
128 /* The layout into which the groupboxes are inserted */ |
|
129 QGraphicsLinearLayout *mBoxLayout; |
|
130 |
|
131 /* |
|
132 * Pointer to the signalmapper used in mapping the disconnect buttons clicks |
|
133 * to the disconnectSelectedIap function |
|
134 */ |
|
135 QSignalMapper *mSignalMapper; |
|
136 |
|
137 /* The amount of active cellular data connections */ |
|
138 int mConnectionCount; |
|
139 |
|
140 /* The toolbar on the view */ |
|
141 HbToolBar *mToolBar; |
|
142 |
|
143 /* The id of the timer used to close the application */ |
|
144 int mClosingTimer; |
|
145 |
|
146 /* Translator for the localisation Text Id's */ |
|
147 QSharedPointer<HbTranslator> mTranslator; |
|
148 |
|
149 /* definition for unit test purposes */ |
|
150 friend class TestConnectionView; |
|
151 |
|
152 }; |
|
153 |
|
154 |
|
155 #endif // __CONNECTIONVIEW_H__ |
|