author | hgs |
Fri, 06 Aug 2010 17:23:08 -0400 | |
changeset 9 | b39122337a00 |
parent 3 | 0954f5dd2cd0 |
permissions | -rw-r--r-- |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* |
3 | 5 |
* This program is free software: you can redistribute it and/or modify |
6 |
* it under the terms of the GNU Lesser General Public License as published by |
|
7 |
* the Free Software Foundation, version 2.1 of the License. |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU Lesser General Public License for more details. |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
3 | 14 |
* You should have received a copy of the GNU Lesser General Public License |
15 |
* along with this program. If not, |
|
16 |
* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
* |
3 | 18 |
* Description: |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
* |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
*/ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include "WebNetworkConnectionManager.h" |
3 | 22 |
#include "WebNetworkSession.h" |
9 | 23 |
#include "webpagecontroller.h" |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
namespace WRT { |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
|
3 | 27 |
/*! |
28 |
Constructs a WebNetworkConfigurationManager with the given \a parent. |
|
29 |
*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
WebNetworkConnectionManager::WebNetworkConnectionManager(QObject *parent) |
9 | 31 |
: QObject(parent), m_WebNetworkSession(0), m_offlined(false), m_roamingRejected(false) |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
{ |
3 | 33 |
// set up handlers for Network Configuration Manager signals |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
connect(&m_NetworkConfigurationManager, SIGNAL(updateCompleted()), |
3 | 35 |
this, SLOT(handleConfigurationUpdateCompleted())); |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
connect(&m_NetworkConfigurationManager, SIGNAL(configurationAdded(const QNetworkConfiguration&)), |
3 | 37 |
this, SLOT(handleConfigurationAdded(const QNetworkConfiguration&))); |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
connect(&m_NetworkConfigurationManager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)), |
3 | 39 |
this, SLOT(handleConfigurationRemoved(const QNetworkConfiguration&))); |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
connect(&m_NetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)), |
3 | 41 |
this, SLOT(handleOnlineStateChanged(bool))); |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
connect(&m_NetworkConfigurationManager, SIGNAL(configurationChanged(const QNetworkConfiguration&)), |
3 | 43 |
this, SLOT(handleConfigurationChanged(const QNetworkConfiguration&))); |
9 | 44 |
|
45 |
// listen to the signal when the secure page is no longer secure |
|
46 |
connect(WebPageController::getSingleton(), SIGNAL(hideSecureIcon()), |
|
47 |
this, SLOT(handleHideSecureIcon())); |
|
3 | 48 |
|
49 |
#ifdef QT_MOBILITY_SYSINFO |
|
50 |
// initialize the mapping between network mode string and SystemNetworkInfo::NetworkMode |
|
51 |
initializeMapString(); |
|
52 |
#endif // QT_MOBILITY_SYSINFO |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
|
3 | 55 |
/*! |
56 |
Frees the resources associated with the WebNetworkConfigurationManager object. |
|
57 |
*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
WebNetworkConnectionManager::~WebNetworkConnectionManager() |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
if (m_WebNetworkSession) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
deleteSession(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
|
3 | 64 |
/*! |
65 |
Initiates an update of all configurations. This may be used to initiate WLAN scans or other |
|
66 |
time consuming updates which may be required to obtain the correct state for configurations. |
|
67 |
||
68 |
This call is asynchronous. On completion of this update the updateCompleted() signal is |
|
69 |
emitted. If new configurations are discovered or old ones were removed or changed the update |
|
70 |
process may trigger the emission of one or multiple configurationAdded(), |
|
71 |
configurationRemoved() and configurationChanged() signals. |
|
72 |
||
73 |
If a configuration state changes as a result of this update all existing QNetworkConfiguration |
|
74 |
instances are updated automatically. |
|
75 |
*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
void WebNetworkConnectionManager::updateConfigurations() |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
m_NetworkConfigurationManager.updateConfigurations(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
|
3 | 81 |
/*! |
82 |
Returns the default configuration to be used. This function always returns a discovered |
|
83 |
configuration; otherwise an invalid configuration. Only configuration type SNAP is handled. |
|
84 |
||
85 |
In some cases it may be required to call updateConfigurations() and wait for the |
|
86 |
updateCompleted() signal before calling this function. |
|
87 |
*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
QNetworkConfiguration WebNetworkConnectionManager::defaultConfiguration() const |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
const bool canStartIAP = (m_NetworkConfigurationManager.capabilities() |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
& QNetworkConfigurationManager::CanStartAndStopInterfaces); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
QNetworkConfiguration config = m_NetworkConfigurationManager.defaultConfiguration(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
if (!config.isValid() || !canStartIAP) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
return config; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
95 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
switch(config.type()) { |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
97 |
case QNetworkConfiguration::InternetAccessPoint: |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
// no user interaction -> system starts IAP immediately |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
qDebug() << "IAP"; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
break; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
case QNetworkConfiguration::ServiceNetwork: |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
// no user interaction -> system determines best IAP in group and starts it |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
qDebug() << "SNAP"; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
break; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
case QNetworkConfiguration::UserChoice: |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
// IAP resolved by asking user as part of QNetworkSession::open() |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
qDebug() << "User Choice"; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
break; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
return config; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
|
3 | 114 |
/*! |
115 |
Create a Web Network Session using a QNetworkConfiguration and connect to its signals. |
|
116 |
||
117 |
*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
void WebNetworkConnectionManager::createSession(QNetworkConfiguration config) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
m_WebNetworkSession = new WebNetworkSession(config); |
3 | 121 |
|
122 |
// set up handlers for the WebNetworkSession signals |
|
123 |
connect(m_WebNetworkSession, SIGNAL(sessionConfigurationChanged(const QNetworkConfiguration &)), |
|
124 |
this, SLOT(handleSessionConfigurationChanged(const QNetworkConfiguration &))); |
|
9 | 125 |
connect(m_WebNetworkSession, SIGNAL(sessionRoamingRejected(void)), |
126 |
this, SLOT(handleSessionRoamingRejected(void))); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
|
3 | 129 |
/*! |
130 |
Delete a Web Network Session. |
|
131 |
||
132 |
*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
void WebNetworkConnectionManager::deleteSession(void) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
delete m_WebNetworkSession; |
3 | 136 |
m_WebNetworkSession = 0; |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
|
3 | 139 |
/*! |
140 |
Handle the updateCompleted signal from Network Configuration Manager. |
|
141 |
||
142 |
It creates a Web Network Session using the default configuration. |
|
143 |
*/ |
|
144 |
void WebNetworkConnectionManager::handleConfigurationUpdateCompleted() |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
{ |
9 | 146 |
qDebug() << "configurationUpdateCompleted:"; |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
if (m_WebNetworkSession) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
qDebug() << "Delete old network connection session"; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
deleteSession(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
|
9 | 153 |
qDebug() << "Create new network connection session"; |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
createSession(defaultConfiguration()); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
|
3 | 157 |
/*! |
158 |
Handle the configurationAdded signal from Network Configuration Manager. |
|
159 |
*/ |
|
160 |
void WebNetworkConnectionManager::handleConfigurationAdded(const QNetworkConfiguration& config) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
qDebug() << "Configuration" << config.name() << "Added"; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
|
3 | 165 |
/*! |
166 |
Handle the configurationRemoved signal from Network Configuration Manager |
|
167 |
*/ |
|
168 |
void WebNetworkConnectionManager::handleConfigurationRemoved(const QNetworkConfiguration& config) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
qDebug() << "Configuration" << config.name() << "Removed"; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
|
3 | 173 |
/*! |
174 |
Handle the onlineStateChanged signal from Network Configuration Manager. |
|
175 |
*/ |
|
176 |
void WebNetworkConnectionManager::handleOnlineStateChanged(bool isOnline) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
{ |
3 | 178 |
emit networkOnlineStateChanged(isOnline); |
179 |
||
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
if (!isOnline) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
qDebug() << "offline"; |
3 | 183 |
m_offlined = true; |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
else |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
qDebug() << "online"; |
3 | 188 |
m_offlined = false; |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
// flash icon to indicate the online state change with "online" and "offline". |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
|
3 | 193 |
/*! |
194 |
Handle the configurationChanged signal from Network Configuration Manager. |
|
195 |
*/ |
|
196 |
void WebNetworkConnectionManager::handleConfigurationChanged(const QNetworkConfiguration &config) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
{ |
3 | 198 |
qDebug() << "Configuration" << config.name() << "Changed"; |
199 |
qDebug() << "bearername:" << config.bearerName() << "type:" << config.type() << "state:" << config.state() << "purpose:" << config.purpose(); |
|
200 |
||
201 |
/* The QNetworkSession is closed becuase of previous offline condition. Re-open the session if |
|
202 |
the configuration matches the configurations hold by the QNetworkSession */ |
|
203 |
#ifdef NO_OFFLINED_BUG |
|
204 |
if (isOfflined()) |
|
205 |
{ |
|
206 |
#endif // NO_OFFLINED_BUG |
|
207 |
if (m_WebNetworkSession && !m_WebNetworkSession->isOpen()) |
|
208 |
{ |
|
209 |
QNetworkConfiguration sessionConfig = m_WebNetworkSession->configuration(); |
|
210 |
QList<QNetworkConfiguration> children = sessionConfig.children(); |
|
211 |
switch(sessionConfig.type()) |
|
212 |
{ |
|
213 |
case QNetworkConfiguration::ServiceNetwork: |
|
214 |
/* Traverse all configuration to find the matching configuration */ |
|
215 |
foreach(QNetworkConfiguration tmpConfig, children) |
|
216 |
{ |
|
217 |
if (config == tmpConfig) |
|
218 |
{ |
|
219 |
if ((config.state() == QNetworkConfiguration::Discovered) || |
|
220 |
(config.state() == QNetworkConfiguration::Active)) |
|
221 |
m_WebNetworkSession->open(); |
|
222 |
break; |
|
223 |
} |
|
224 |
} |
|
225 |
break; |
|
226 |
case QNetworkConfiguration::InternetAccessPoint: |
|
227 |
qDebug() << "InternetAccessPoint"; |
|
228 |
break; |
|
229 |
case QNetworkConfiguration::UserChoice: |
|
230 |
qDebug() << "UserChoice"; |
|
231 |
break; |
|
232 |
default: |
|
233 |
break; |
|
234 |
} |
|
235 |
} |
|
236 |
#ifdef NO_OFFLINED_BUG |
|
237 |
} |
|
238 |
#endif // NO_OFFLINED_BUG |
|
239 |
} |
|
240 |
||
241 |
/*! |
|
242 |
Handle the networkNameChanged signal from Network Configuration Manager and translate |
|
243 |
sessionConfiguration signal to networknameChanged. |
|
244 |
||
245 |
It a\ emits networkNameChanged signal for no cellular network connetion. |
|
246 |
*/ |
|
247 |
void WebNetworkConnectionManager::handleSessionConfigurationChanged(const QNetworkConfiguration &config) |
|
248 |
{ |
|
249 |
qDebug() << "handleSessionConfigurationChanged" << "bearername:" << config.bearerName(); |
|
250 |
||
251 |
#ifdef QT_MOBILITY_SYSINFO |
|
252 |
QSystemNetworkInfo::NetworkMode mode; |
|
253 |
mode = m_mapStringNetworkMode[config.bearerName()]; |
|
254 |
||
255 |
emit networkSessionNameChanged(mode, config.name()); |
|
256 |
#endif // QT_MOBILITY_SYSINFO |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
} |
3 | 258 |
|
9 | 259 |
void WebNetworkConnectionManager::handleSessionRoamingRejected(void) |
260 |
{ |
|
261 |
qDebug() << "roaming is rejected"; |
|
262 |
m_roamingRejected = true; |
|
263 |
} |
|
264 |
||
265 |
void WebNetworkConnectionManager::handleHideSecureIcon(void) |
|
266 |
{ |
|
267 |
qDebug() << "Switch to non-secure page"; |
|
268 |
// Update the configuration and restart session if the roaming has been |
|
269 |
// rejected and the page become unsecure. |
|
270 |
if (m_roamingRejected) |
|
271 |
{ |
|
272 |
m_NetworkConfigurationManager.updateConfigurations(); |
|
273 |
m_roamingRejected = false; |
|
274 |
} |
|
275 |
} |
|
276 |
||
3 | 277 |
#ifdef QT_MOBILITY_SYSINFO |
278 |
void WebNetworkConnectionManager::initializeMapString(void) |
|
279 |
{ |
|
280 |
m_mapStringNetworkMode["Ethernet"] = QSystemNetworkInfo::EthernetMode; |
|
281 |
m_mapStringNetworkMode["WLAN"] = QSystemNetworkInfo::WlanMode; |
|
282 |
m_mapStringNetworkMode["2G"] = QSystemNetworkInfo::GsmMode; |
|
283 |
m_mapStringNetworkMode["CDMA2000"] = QSystemNetworkInfo::CdmaMode; |
|
284 |
m_mapStringNetworkMode["WCDMA"] = QSystemNetworkInfo::WcdmaMode; |
|
285 |
m_mapStringNetworkMode["HSPA"] = QSystemNetworkInfo::UnknownMode; |
|
286 |
m_mapStringNetworkMode["Bluetooth"] = QSystemNetworkInfo::BluetoothMode; |
|
287 |
m_mapStringNetworkMode["WiMAX"] = QSystemNetworkInfo::WimaxMode; |
|
288 |
m_mapStringNetworkMode[""] = QSystemNetworkInfo::UnknownMode; |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
} |
3 | 290 |
#endif // QT_MOBILITY_SYSINFO |
291 |
||
292 |
} // WRT |
|
293 |