Merge lp:~pete-woods/indicator-network/simplify-toggles into lp:indicator-network/15.10
- simplify-toggles
- Merge into trunk.15.10
Proposed by
Pete Woods
Status: | Merged |
---|---|
Approved by: | Pete Woods |
Approved revision: | 519 |
Merged at revision: | 505 |
Proposed branch: | lp:~pete-woods/indicator-network/simplify-toggles |
Merge into: | lp:indicator-network/15.10 |
Prerequisite: | lp:~pete-woods/indicator-network/wakelock-on-hotspot-active |
Diff against target: |
616 lines (+167/-201) (has conflicts) 12 files modified
src/indicator/connectivity-service/connectivity-service.cpp (+15/-16) src/indicator/nmofono/hotspot-manager.h (+2/-2) src/indicator/nmofono/kill-switch.cpp (+28/-21) src/indicator/nmofono/kill-switch.h (+1/-24) src/indicator/nmofono/link.h (+0/-6) src/indicator/nmofono/manager-impl.cpp (+67/-43) src/indicator/nmofono/manager-impl.h (+18/-2) src/indicator/nmofono/manager.h (+36/-3) src/indicator/nmofono/wifi/wifi-link-impl.cpp (+0/-67) src/indicator/nmofono/wifi/wifi-link-impl.h (+0/-3) src/indicator/nmofono/wwan/modem.cpp (+0/-10) src/indicator/nmofono/wwan/modem.h (+0/-4) Text conflict in debian/changelog |
To merge this branch: | bzr merge lp:~pete-woods/indicator-network/simplify-toggles |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Indicator Applet Developers | Pending | ||
Review via email:
|
Commit message
Simplify wifi/flight toggles
Description of the change
Simplify wifi/flight toggles
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/indicator/connectivity-service/connectivity-service.cpp' | |||
2 | --- src/indicator/connectivity-service/connectivity-service.cpp 2015-08-05 15:22:19 +0000 | |||
3 | +++ src/indicator/connectivity-service/connectivity-service.cpp 2015-08-05 15:22:19 +0000 | |||
4 | @@ -197,14 +197,13 @@ | |||
5 | 197 | connect(d->m_manager.get(), &Manager::wifiEnabledUpdated, d.get(), &Private::wifiEnabledUpdated); | 197 | connect(d->m_manager.get(), &Manager::wifiEnabledUpdated, d.get(), &Private::wifiEnabledUpdated); |
6 | 198 | connect(d->m_manager.get(), &Manager::unstoppableOperationHappeningUpdated, d.get(), &Private::unstoppableOperationHappeningUpdated); | 198 | connect(d->m_manager.get(), &Manager::unstoppableOperationHappeningUpdated, d.get(), &Private::unstoppableOperationHappeningUpdated); |
7 | 199 | 199 | ||
14 | 200 | auto hotspotManager = d->m_manager->hotspotManager(); | 200 | connect(d->m_manager.get(), &Manager::hotspotEnabledChanged, d.get(), &Private::hotspotEnabledUpdated); |
15 | 201 | connect(hotspotManager.get(), &HotspotManager::enabledChanged, d.get(), &Private::hotspotEnabledUpdated); | 201 | connect(d->m_manager.get(), &Manager::hotspotSsidChanged, d.get(), &Private::hotspotSsidUpdated); |
16 | 202 | connect(hotspotManager.get(), &HotspotManager::ssidChanged, d.get(), &Private::hotspotSsidUpdated); | 202 | connect(d->m_manager.get(), &Manager::hotspotPasswordChanged, d.get(), &Private::hotspotPasswordUpdated); |
17 | 203 | connect(hotspotManager.get(), &HotspotManager::passwordChanged, d.get(), &Private::hotspotPasswordUpdated); | 203 | connect(d->m_manager.get(), &Manager::hotspotModeChanged, d.get(), &Private::hotspotModeUpdated); |
18 | 204 | connect(hotspotManager.get(), &HotspotManager::modeChanged, d.get(), &Private::hotspotModeUpdated); | 204 | connect(d->m_manager.get(), &Manager::hotspotStoredChanged, d.get(), &Private::hotspotStoredUpdated); |
13 | 205 | connect(hotspotManager.get(), &HotspotManager::storedChanged, d.get(), &Private::hotspotStoredUpdated); | ||
19 | 206 | 205 | ||
21 | 207 | connect(hotspotManager.get(), &HotspotManager::reportError, d->m_privateService.get(), &PrivateService::ReportError); | 206 | connect(d->m_manager.get(), &Manager::reportError, d->m_privateService.get(), &PrivateService::ReportError); |
22 | 208 | 207 | ||
23 | 209 | d->updateNetworkingStatus(); | 208 | d->updateNetworkingStatus(); |
24 | 210 | 209 | ||
25 | @@ -257,22 +256,22 @@ | |||
26 | 257 | 256 | ||
27 | 258 | bool ConnectivityService::hotspotEnabled() const | 257 | bool ConnectivityService::hotspotEnabled() const |
28 | 259 | { | 258 | { |
30 | 260 | return d->m_manager->hotspotManager()->enabled(); | 259 | return d->m_manager->hotspotEnabled(); |
31 | 261 | } | 260 | } |
32 | 262 | 261 | ||
33 | 263 | QByteArray ConnectivityService::hotspotSsid() const | 262 | QByteArray ConnectivityService::hotspotSsid() const |
34 | 264 | { | 263 | { |
36 | 265 | return d->m_manager->hotspotManager()->ssid(); | 264 | return d->m_manager->hotspotSsid(); |
37 | 266 | } | 265 | } |
38 | 267 | 266 | ||
39 | 268 | QString ConnectivityService::hotspotMode() const | 267 | QString ConnectivityService::hotspotMode() const |
40 | 269 | { | 268 | { |
42 | 270 | return d->m_manager->hotspotManager()->mode(); | 269 | return d->m_manager->hotspotMode(); |
43 | 271 | } | 270 | } |
44 | 272 | 271 | ||
45 | 273 | bool ConnectivityService::hotspotStored() const | 272 | bool ConnectivityService::hotspotStored() const |
46 | 274 | { | 273 | { |
48 | 275 | return d->m_manager->hotspotManager()->stored(); | 274 | return d->m_manager->hotspotStored(); |
49 | 276 | } | 275 | } |
50 | 277 | 276 | ||
51 | 278 | PrivateService::PrivateService(ConnectivityService& parent) : | 277 | PrivateService::PrivateService(ConnectivityService& parent) : |
52 | @@ -304,27 +303,27 @@ | |||
53 | 304 | 303 | ||
54 | 305 | void PrivateService::SetHotspotEnabled(bool enabled) | 304 | void PrivateService::SetHotspotEnabled(bool enabled) |
55 | 306 | { | 305 | { |
57 | 307 | p.d->m_manager->hotspotManager()->setEnabled(enabled); | 306 | p.d->m_manager->setHotspotEnabled(enabled); |
58 | 308 | } | 307 | } |
59 | 309 | 308 | ||
60 | 310 | void PrivateService::SetHotspotSsid(const QByteArray &ssid) | 309 | void PrivateService::SetHotspotSsid(const QByteArray &ssid) |
61 | 311 | { | 310 | { |
63 | 312 | p.d->m_manager->hotspotManager()->setSsid(ssid); | 311 | p.d->m_manager->setHotspotSsid(ssid); |
64 | 313 | } | 312 | } |
65 | 314 | 313 | ||
66 | 315 | void PrivateService::SetHotspotPassword(const QString &password) | 314 | void PrivateService::SetHotspotPassword(const QString &password) |
67 | 316 | { | 315 | { |
69 | 317 | p.d->m_manager->hotspotManager()->setPassword(password); | 316 | p.d->m_manager->setHotspotPassword(password); |
70 | 318 | } | 317 | } |
71 | 319 | 318 | ||
72 | 320 | void PrivateService::SetHotspotMode(const QString &mode) | 319 | void PrivateService::SetHotspotMode(const QString &mode) |
73 | 321 | { | 320 | { |
75 | 322 | p.d->m_manager->hotspotManager()->setMode(mode); | 321 | p.d->m_manager->setHotspotMode(mode); |
76 | 323 | } | 322 | } |
77 | 324 | 323 | ||
78 | 325 | QString PrivateService::hotspotPassword() const | 324 | QString PrivateService::hotspotPassword() const |
79 | 326 | { | 325 | { |
81 | 327 | return p.d->m_manager->hotspotManager()->password(); | 326 | return p.d->m_manager->hotspotPassword(); |
82 | 328 | } | 327 | } |
83 | 329 | 328 | ||
84 | 330 | } | 329 | } |
85 | 331 | 330 | ||
86 | === modified file 'src/indicator/nmofono/hotspot-manager.h' | |||
87 | --- src/indicator/nmofono/hotspot-manager.h 2015-08-05 15:22:19 +0000 | |||
88 | +++ src/indicator/nmofono/hotspot-manager.h 2015-08-05 15:22:19 +0000 | |||
89 | @@ -123,8 +123,6 @@ | |||
90 | 123 | 123 | ||
91 | 124 | bool enabled() const; | 124 | bool enabled() const; |
92 | 125 | 125 | ||
93 | 126 | void setEnabled(bool); | ||
94 | 127 | |||
95 | 128 | bool stored() const; | 126 | bool stored() const; |
96 | 129 | 127 | ||
97 | 130 | QByteArray ssid() const; | 128 | QByteArray ssid() const; |
98 | @@ -155,6 +153,8 @@ | |||
99 | 155 | void reportError(int reason); | 153 | void reportError(int reason); |
100 | 156 | 154 | ||
101 | 157 | public Q_SLOTS: | 155 | public Q_SLOTS: |
102 | 156 | void setEnabled(bool); | ||
103 | 157 | |||
104 | 158 | void setSsid(const QByteArray&); | 158 | void setSsid(const QByteArray&); |
105 | 159 | 159 | ||
106 | 160 | void setPassword(const QString&); | 160 | void setPassword(const QString&); |
107 | 161 | 161 | ||
108 | === modified file 'src/indicator/nmofono/kill-switch.cpp' | |||
109 | --- src/indicator/nmofono/kill-switch.cpp 2015-04-23 13:22:55 +0000 | |||
110 | +++ src/indicator/nmofono/kill-switch.cpp 2015-08-05 15:22:19 +0000 | |||
111 | @@ -88,27 +88,34 @@ | |||
112 | 88 | } | 88 | } |
113 | 89 | 89 | ||
114 | 90 | void | 90 | void |
136 | 91 | KillSwitch::block() | 91 | KillSwitch::setBlock(bool block) |
137 | 92 | { | 92 | { |
138 | 93 | if (state() == KillSwitch::State::hard_blocked) | 93 | if (!block && state() == State::hard_blocked) |
139 | 94 | throw KillSwitch::exception::HardBlocked(); | 94 | { |
140 | 95 | 95 | qCritical() << __PRETTY_FUNCTION__ << "Killswitch is hard blocked."; | |
141 | 96 | try { | 96 | return; |
142 | 97 | if (!utils::getOrThrow(d->urfkill->Block(static_cast<uint>(Private::DeviceType::wlan), true))) | 97 | } |
143 | 98 | throw KillSwitch::exception::Failed("Failed to block killswitch"); | 98 | |
144 | 99 | } catch (std::exception &e) { | 99 | if (!block && state() != State::soft_blocked) |
145 | 100 | throw KillSwitch::exception::Failed(e.what()); | 100 | { |
146 | 101 | } | 101 | return; |
147 | 102 | } | 102 | } |
148 | 103 | 103 | ||
149 | 104 | void | 104 | if (block && state() != State::unblocked) |
150 | 105 | KillSwitch::unblock() | 105 | { |
151 | 106 | { | 106 | return; |
152 | 107 | try { | 107 | } |
153 | 108 | if (!utils::getOrThrow(d->urfkill->Block(static_cast<uint>(Private::DeviceType::wlan), false))) | 108 | |
154 | 109 | throw KillSwitch::exception::Failed("Failed to unblock killswitch"); | 109 | try |
155 | 110 | } catch (std::exception &e) { | 110 | { |
156 | 111 | throw KillSwitch::exception::Failed(e.what()); | 111 | if (!utils::getOrThrow(d->urfkill->Block(static_cast<uint>(Private::DeviceType::wlan), block))) |
157 | 112 | { | ||
158 | 113 | throw std::runtime_error("Failed to block killswitch"); | ||
159 | 114 | } | ||
160 | 115 | } | ||
161 | 116 | catch (std::exception &e) | ||
162 | 117 | { | ||
163 | 118 | qCritical() << __PRETTY_FUNCTION__ << e.what(); | ||
164 | 112 | } | 119 | } |
165 | 113 | } | 120 | } |
166 | 114 | 121 | ||
167 | 115 | 122 | ||
168 | === modified file 'src/indicator/nmofono/kill-switch.h' | |||
169 | --- src/indicator/nmofono/kill-switch.h 2015-04-14 11:20:17 +0000 | |||
170 | +++ src/indicator/nmofono/kill-switch.h 2015-08-05 15:22:19 +0000 | |||
171 | @@ -37,24 +37,6 @@ | |||
172 | 37 | public: | 37 | public: |
173 | 38 | typedef std::shared_ptr<KillSwitch> Ptr; | 38 | typedef std::shared_ptr<KillSwitch> Ptr; |
174 | 39 | 39 | ||
175 | 40 | struct exception | ||
176 | 41 | { | ||
177 | 42 | struct HardBlocked : public std::runtime_error | ||
178 | 43 | { | ||
179 | 44 | HardBlocked() | ||
180 | 45 | : std::runtime_error("Killswitch is hard blocked.") | ||
181 | 46 | {} | ||
182 | 47 | }; | ||
183 | 48 | |||
184 | 49 | struct Failed : public std::runtime_error | ||
185 | 50 | { | ||
186 | 51 | Failed() = delete; | ||
187 | 52 | Failed(std::string what) | ||
188 | 53 | : std::runtime_error(what) | ||
189 | 54 | {} | ||
190 | 55 | }; | ||
191 | 56 | }; | ||
192 | 57 | |||
193 | 58 | enum class State | 40 | enum class State |
194 | 59 | { | 41 | { |
195 | 60 | not_available = -1, | 42 | not_available = -1, |
196 | @@ -68,12 +50,7 @@ | |||
197 | 68 | KillSwitch(const QDBusConnection& systemBus); | 50 | KillSwitch(const QDBusConnection& systemBus); |
198 | 69 | ~KillSwitch(); | 51 | ~KillSwitch(); |
199 | 70 | 52 | ||
206 | 71 | /// @throws exception::Failed if the switch fails to block | 53 | void setBlock(bool block); |
201 | 72 | void block(); | ||
202 | 73 | |||
203 | 74 | /// @throws exception::HardBlocked if trying to unblock when switch is hard blocked | ||
204 | 75 | /// @throws exception::Failed if the switch fails to unblock | ||
205 | 76 | void unblock(); | ||
207 | 77 | 54 | ||
208 | 78 | State state() const; | 55 | State state() const; |
209 | 79 | bool flightMode(bool enable); | 56 | bool flightMode(bool enable); |
210 | 80 | 57 | ||
211 | === modified file 'src/indicator/nmofono/link.h' | |||
212 | --- src/indicator/nmofono/link.h 2015-04-14 11:20:17 +0000 | |||
213 | +++ src/indicator/nmofono/link.h 2015-08-05 15:22:19 +0000 | |||
214 | @@ -92,12 +92,6 @@ | |||
215 | 92 | }; | 92 | }; |
216 | 93 | 93 | ||
217 | 94 | /// @private | 94 | /// @private |
218 | 95 | virtual void enable() = 0; | ||
219 | 96 | |||
220 | 97 | /// @private | ||
221 | 98 | virtual void disable() = 0; | ||
222 | 99 | |||
223 | 100 | /// @private | ||
224 | 101 | virtual Type type() const = 0; | 95 | virtual Type type() const = 0; |
225 | 102 | 96 | ||
226 | 103 | /// @private | 97 | /// @private |
227 | 104 | 98 | ||
228 | === modified file 'src/indicator/nmofono/manager-impl.cpp' | |||
229 | --- src/indicator/nmofono/manager-impl.cpp 2015-08-05 15:22:19 +0000 | |||
230 | +++ src/indicator/nmofono/manager-impl.cpp 2015-08-05 15:22:19 +0000 | |||
231 | @@ -244,6 +244,13 @@ | |||
232 | 244 | connect(d->m_killSwitch.get(), &KillSwitch::stateChanged, d.get(), &Private::updateHasWifi); | 244 | connect(d->m_killSwitch.get(), &KillSwitch::stateChanged, d.get(), &Private::updateHasWifi); |
233 | 245 | 245 | ||
234 | 246 | d->m_hotspotManager = make_shared<HotspotManager>(systemConnection); | 246 | d->m_hotspotManager = make_shared<HotspotManager>(systemConnection); |
235 | 247 | connect(d->m_hotspotManager.get(), &HotspotManager::enabledChanged, this, &Manager::hotspotEnabledChanged); | ||
236 | 248 | connect(d->m_hotspotManager.get(), &HotspotManager::ssidChanged, this, &Manager::hotspotSsidChanged); | ||
237 | 249 | connect(d->m_hotspotManager.get(), &HotspotManager::passwordChanged, this, &Manager::hotspotPasswordChanged); | ||
238 | 250 | connect(d->m_hotspotManager.get(), &HotspotManager::modeChanged, this, &Manager::hotspotModeChanged); | ||
239 | 251 | connect(d->m_hotspotManager.get(), &HotspotManager::storedChanged, this, &Manager::hotspotStoredChanged); | ||
240 | 252 | |||
241 | 253 | connect(d->m_hotspotManager.get(), &HotspotManager::reportError, this, &Manager::reportError); | ||
242 | 247 | 254 | ||
243 | 248 | connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::DeviceAdded, this, &ManagerImpl::device_added); | 255 | connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::DeviceAdded, this, &ManagerImpl::device_added); |
244 | 249 | QList<QDBusObjectPath> devices(d->nm->GetDevices()); | 256 | QList<QDBusObjectPath> devices(d->nm->GetDevices()); |
245 | @@ -256,16 +263,7 @@ | |||
246 | 256 | connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::PropertiesChanged, this, &ManagerImpl::nm_properties_changed); | 263 | connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::PropertiesChanged, this, &ManagerImpl::nm_properties_changed); |
247 | 257 | 264 | ||
248 | 258 | connect(d->m_killSwitch.get(), &KillSwitch::flightModeChanged, d.get(), &Private::setFlightMode); | 265 | connect(d->m_killSwitch.get(), &KillSwitch::flightModeChanged, d.get(), &Private::setFlightMode); |
259 | 259 | try | 266 | d->setFlightMode(d->m_killSwitch->isFlightMode()); |
250 | 260 | { | ||
251 | 261 | d->setFlightMode(d->m_killSwitch->isFlightMode()); | ||
252 | 262 | } | ||
253 | 263 | catch (exception const& e) | ||
254 | 264 | { | ||
255 | 265 | cerr << __PRETTY_FUNCTION__ << ": " << e.what() << endl; | ||
256 | 266 | cerr << "Failed to retrieve initial flight mode state, assuming state is false." << endl; | ||
257 | 267 | d->setFlightMode(false); | ||
258 | 268 | } | ||
260 | 269 | 267 | ||
261 | 270 | /// @todo set by the default connections. | 268 | /// @todo set by the default connections. |
262 | 271 | d->m_characteristics = Link::Characteristics::empty; | 269 | d->m_characteristics = Link::Characteristics::empty; |
263 | @@ -418,48 +416,23 @@ | |||
264 | 418 | } | 416 | } |
265 | 419 | 417 | ||
266 | 420 | 418 | ||
268 | 421 | bool | 419 | void |
269 | 422 | ManagerImpl::setWifiEnabled(bool enabled) | 420 | ManagerImpl::setWifiEnabled(bool enabled) |
270 | 423 | { | 421 | { |
271 | 424 | if (!d->m_hasWifi) | 422 | if (!d->m_hasWifi) |
272 | 425 | { | 423 | { |
274 | 426 | return false; | 424 | return; |
275 | 427 | } | 425 | } |
276 | 428 | 426 | ||
277 | 429 | if (d->m_wifiEnabled == enabled) | 427 | if (d->m_wifiEnabled == enabled) |
278 | 430 | { | 428 | { |
280 | 431 | return false; | 429 | return; |
281 | 432 | } | 430 | } |
282 | 433 | 431 | ||
283 | 434 | bool success = true; | ||
284 | 435 | d->setUnstoppableOperationHappening(true); | 432 | d->setUnstoppableOperationHappening(true); |
310 | 436 | 433 | d->m_killSwitch->setBlock(!enabled); | |
311 | 437 | try | 434 | d->nm->setWirelessEnabled(enabled); |
287 | 438 | { | ||
288 | 439 | if (enabled) | ||
289 | 440 | { | ||
290 | 441 | if (d->m_killSwitch->state() == KillSwitch::State::soft_blocked) | ||
291 | 442 | { | ||
292 | 443 | // try to unblock. throws if fails. | ||
293 | 444 | d->m_killSwitch->unblock(); | ||
294 | 445 | } | ||
295 | 446 | } | ||
296 | 447 | else | ||
297 | 448 | { | ||
298 | 449 | if (d->m_killSwitch->state() == KillSwitch::State::unblocked) { | ||
299 | 450 | // block the device. that will disable it also | ||
300 | 451 | d->m_killSwitch->block(); | ||
301 | 452 | } | ||
302 | 453 | } | ||
303 | 454 | d->nm->setWirelessEnabled(enabled); | ||
304 | 455 | } | ||
305 | 456 | catch (runtime_error &e) | ||
306 | 457 | { | ||
307 | 458 | qWarning() << __PRETTY_FUNCTION__ << ": " << e.what(); | ||
308 | 459 | success = false; | ||
309 | 460 | } | ||
312 | 461 | d->setUnstoppableOperationHappening(false); | 435 | d->setUnstoppableOperationHappening(false); |
313 | 462 | return success; | ||
314 | 463 | } | 436 | } |
315 | 464 | 437 | ||
316 | 465 | bool | 438 | bool |
317 | @@ -557,9 +530,60 @@ | |||
318 | 557 | return d->m_ofonoLinks.values().toSet(); | 530 | return d->m_ofonoLinks.values().toSet(); |
319 | 558 | } | 531 | } |
320 | 559 | 532 | ||
324 | 560 | HotspotManager::SPtr ManagerImpl::hotspotManager() const | 533 | bool |
325 | 561 | { | 534 | ManagerImpl::hotspotEnabled() const |
326 | 562 | return d->m_hotspotManager; | 535 | { |
327 | 536 | return d->m_hotspotManager->enabled(); | ||
328 | 537 | } | ||
329 | 538 | |||
330 | 539 | bool | ||
331 | 540 | ManagerImpl::hotspotStored() const | ||
332 | 541 | { | ||
333 | 542 | return d->m_hotspotManager->stored(); | ||
334 | 543 | } | ||
335 | 544 | |||
336 | 545 | QByteArray | ||
337 | 546 | ManagerImpl::hotspotSsid() const | ||
338 | 547 | { | ||
339 | 548 | return d->m_hotspotManager->ssid(); | ||
340 | 549 | } | ||
341 | 550 | |||
342 | 551 | QString | ||
343 | 552 | ManagerImpl::hotspotPassword() const | ||
344 | 553 | { | ||
345 | 554 | return d->m_hotspotManager->password(); | ||
346 | 555 | } | ||
347 | 556 | |||
348 | 557 | QString | ||
349 | 558 | ManagerImpl::hotspotMode() const | ||
350 | 559 | { | ||
351 | 560 | return d->m_hotspotManager->mode(); | ||
352 | 561 | } | ||
353 | 562 | |||
354 | 563 | void | ||
355 | 564 | ManagerImpl::setHotspotEnabled(bool enabled) | ||
356 | 565 | { | ||
357 | 566 | d->setUnstoppableOperationHappening(true); | ||
358 | 567 | d->m_hotspotManager->setEnabled(enabled); | ||
359 | 568 | d->setUnstoppableOperationHappening(false); | ||
360 | 569 | } | ||
361 | 570 | |||
362 | 571 | void | ||
363 | 572 | ManagerImpl::setHotspotSsid(const QByteArray& ssid) | ||
364 | 573 | { | ||
365 | 574 | d->m_hotspotManager->setSsid(ssid); | ||
366 | 575 | } | ||
367 | 576 | |||
368 | 577 | void | ||
369 | 578 | ManagerImpl::setHotspotPassword(const QString& password) | ||
370 | 579 | { | ||
371 | 580 | d->m_hotspotManager->setPassword(password); | ||
372 | 581 | } | ||
373 | 582 | |||
374 | 583 | void | ||
375 | 584 | ManagerImpl::setHotspotMode(const QString& mode) | ||
376 | 585 | { | ||
377 | 586 | d->m_hotspotManager->setMode(mode); | ||
378 | 563 | } | 587 | } |
379 | 564 | 588 | ||
380 | 565 | } | 589 | } |
381 | 566 | 590 | ||
382 | === modified file 'src/indicator/nmofono/manager-impl.h' | |||
383 | --- src/indicator/nmofono/manager-impl.h 2015-08-05 15:22:19 +0000 | |||
384 | +++ src/indicator/nmofono/manager-impl.h 2015-08-05 15:22:19 +0000 | |||
385 | @@ -51,7 +51,7 @@ | |||
386 | 51 | bool hasWifi() const override; | 51 | bool hasWifi() const override; |
387 | 52 | bool wifiEnabled() const override; | 52 | bool wifiEnabled() const override; |
388 | 53 | 53 | ||
390 | 54 | bool setWifiEnabled(bool) override; | 54 | void setWifiEnabled(bool) override; |
391 | 55 | 55 | ||
392 | 56 | bool roaming() const override; | 56 | bool roaming() const override; |
393 | 57 | 57 | ||
394 | @@ -66,7 +66,23 @@ | |||
395 | 66 | void unlockAllModems() override; | 66 | void unlockAllModems() override; |
396 | 67 | void unlockModemByName(const QString &name) override; | 67 | void unlockModemByName(const QString &name) override; |
397 | 68 | 68 | ||
399 | 69 | HotspotManager::SPtr hotspotManager() const; | 69 | bool hotspotEnabled() const override; |
400 | 70 | |||
401 | 71 | bool hotspotStored() const override; | ||
402 | 72 | |||
403 | 73 | QByteArray hotspotSsid() const override; | ||
404 | 74 | |||
405 | 75 | QString hotspotPassword() const override; | ||
406 | 76 | |||
407 | 77 | QString hotspotMode() const override; | ||
408 | 78 | |||
409 | 79 | void setHotspotEnabled(bool) override; | ||
410 | 80 | |||
411 | 81 | void setHotspotSsid(const QByteArray&) override; | ||
412 | 82 | |||
413 | 83 | void setHotspotPassword(const QString&) override; | ||
414 | 84 | |||
415 | 85 | void setHotspotMode(const QString&) override; | ||
416 | 70 | 86 | ||
417 | 71 | private Q_SLOTS: | 87 | private Q_SLOTS: |
418 | 72 | void device_added(const QDBusObjectPath &path); | 88 | void device_added(const QDBusObjectPath &path); |
419 | 73 | 89 | ||
420 | === modified file 'src/indicator/nmofono/manager.h' | |||
421 | --- src/indicator/nmofono/manager.h 2015-08-05 15:22:19 +0000 | |||
422 | +++ src/indicator/nmofono/manager.h 2015-08-05 15:22:19 +0000 | |||
423 | @@ -87,8 +87,6 @@ | |||
424 | 87 | Q_PROPERTY(bool unstoppableOperationHappening READ unstoppableOperationHappening NOTIFY unstoppableOperationHappeningUpdated) | 87 | Q_PROPERTY(bool unstoppableOperationHappening READ unstoppableOperationHappening NOTIFY unstoppableOperationHappeningUpdated) |
425 | 88 | virtual bool unstoppableOperationHappening() const = 0; | 88 | virtual bool unstoppableOperationHappening() const = 0; |
426 | 89 | 89 | ||
427 | 90 | virtual HotspotManager::SPtr hotspotManager() const = 0; | ||
428 | 91 | |||
429 | 92 | /// @private | 90 | /// @private |
430 | 93 | Q_PROPERTY(QSet<Link::Ptr> links READ links NOTIFY linksUpdated) | 91 | Q_PROPERTY(QSet<Link::Ptr> links READ links NOTIFY linksUpdated) |
431 | 94 | virtual QSet<Link::Ptr> links() const = 0; | 92 | virtual QSet<Link::Ptr> links() const = 0; |
432 | @@ -130,6 +128,21 @@ | |||
433 | 130 | 128 | ||
434 | 131 | virtual void unlockModemByName(const QString &name) = 0; | 129 | virtual void unlockModemByName(const QString &name) = 0; |
435 | 132 | 130 | ||
436 | 131 | Q_PROPERTY(bool hotspotEnabled READ hotspotEnabled WRITE setHotspotEnabled NOTIFY hotspotEnabledChanged) | ||
437 | 132 | virtual bool hotspotEnabled() const = 0; | ||
438 | 133 | |||
439 | 134 | Q_PROPERTY(bool hotspotStored READ hotspotStored NOTIFY hotspotStoredChanged) | ||
440 | 135 | virtual bool hotspotStored() const = 0; | ||
441 | 136 | |||
442 | 137 | Q_PROPERTY(QByteArray hotspotSsid READ hotspotSsid WRITE setHotspotSsid NOTIFY hotspotSsidChanged) | ||
443 | 138 | virtual QByteArray hotspotSsid() const = 0; | ||
444 | 139 | |||
445 | 140 | Q_PROPERTY(QString hotspotPassword READ hotspotPassword WRITE setHotspotPassword NOTIFY hotspotPasswordChanged) | ||
446 | 141 | virtual QString hotspotPassword() const = 0; | ||
447 | 142 | |||
448 | 143 | Q_PROPERTY(QString hotspotMode READ hotspotMode WRITE setHotspotMode NOTIFY hotspotModeChanged) | ||
449 | 144 | virtual QString hotspotMode() const = 0; | ||
450 | 145 | |||
451 | 133 | Q_SIGNALS: | 146 | Q_SIGNALS: |
452 | 134 | void flightModeUpdated(FlightModeStatus); | 147 | void flightModeUpdated(FlightModeStatus); |
453 | 135 | 148 | ||
454 | @@ -143,13 +156,33 @@ | |||
455 | 143 | 156 | ||
456 | 144 | void wifiEnabledUpdated(bool); | 157 | void wifiEnabledUpdated(bool); |
457 | 145 | 158 | ||
458 | 159 | void hotspotEnabledChanged(bool enabled); | ||
459 | 160 | |||
460 | 161 | void hotspotStoredChanged(bool stored); | ||
461 | 162 | |||
462 | 163 | void hotspotSsidChanged(const QByteArray& ssid); | ||
463 | 164 | |||
464 | 165 | void hotspotPasswordChanged(const QString& password); | ||
465 | 166 | |||
466 | 167 | void hotspotModeChanged(const QString& mode); | ||
467 | 168 | |||
468 | 169 | void reportError(int reason); | ||
469 | 170 | |||
470 | 146 | void unstoppableOperationHappeningUpdated(bool); | 171 | void unstoppableOperationHappeningUpdated(bool); |
471 | 147 | 172 | ||
472 | 148 | public Q_SLOTS: | 173 | public Q_SLOTS: |
474 | 149 | virtual bool setWifiEnabled(bool) = 0; | 174 | virtual void setWifiEnabled(bool) = 0; |
475 | 150 | 175 | ||
476 | 151 | virtual void setFlightMode(bool) = 0; | 176 | virtual void setFlightMode(bool) = 0; |
477 | 152 | 177 | ||
478 | 178 | virtual void setHotspotEnabled(bool) = 0; | ||
479 | 179 | |||
480 | 180 | virtual void setHotspotSsid(const QByteArray&) = 0; | ||
481 | 181 | |||
482 | 182 | virtual void setHotspotPassword(const QString&) = 0; | ||
483 | 183 | |||
484 | 184 | virtual void setHotspotMode(const QString&) = 0; | ||
485 | 185 | |||
486 | 153 | protected: | 186 | protected: |
487 | 154 | /** | 187 | /** |
488 | 155 | * @brief The default constructor is protected. | 188 | * @brief The default constructor is protected. |
489 | 156 | 189 | ||
490 | === modified file 'src/indicator/nmofono/wifi/wifi-link-impl.cpp' | |||
491 | --- src/indicator/nmofono/wifi/wifi-link-impl.cpp 2015-07-08 08:49:30 +0000 | |||
492 | +++ src/indicator/nmofono/wifi/wifi-link-impl.cpp 2015-08-05 15:22:19 +0000 | |||
493 | @@ -316,73 +316,6 @@ | |||
494 | 316 | WifiLinkImpl::~WifiLinkImpl() | 316 | WifiLinkImpl::~WifiLinkImpl() |
495 | 317 | {} | 317 | {} |
496 | 318 | 318 | ||
497 | 319 | void | ||
498 | 320 | WifiLinkImpl::enable() | ||
499 | 321 | { | ||
500 | 322 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | ||
501 | 323 | qDebug() << __PRETTY_FUNCTION__; | ||
502 | 324 | #endif | ||
503 | 325 | |||
504 | 326 | try { | ||
505 | 327 | if (d->m_killSwitch->state() != KillSwitch::State::unblocked) { | ||
506 | 328 | // try to unblock. throws if fails. | ||
507 | 329 | d->m_killSwitch->unblock(); | ||
508 | 330 | } | ||
509 | 331 | d->m_nm->setWirelessEnabled(true); | ||
510 | 332 | d->m_dev->setAutoconnect(true); | ||
511 | 333 | } catch(runtime_error &e) { | ||
512 | 334 | /// @todo when toggling enable()/disable() rapidly the default timeout of | ||
513 | 335 | /// 1 second in dbus::core::Property is not long enough.. | ||
514 | 336 | /// just ignore for now and get dbus-cpp to have larger timeout. | ||
515 | 337 | cerr << __PRETTY_FUNCTION__ << ": " << e.what() << endl; | ||
516 | 338 | } | ||
517 | 339 | |||
518 | 340 | #if 0 | ||
519 | 341 | /** @todo: | ||
520 | 342 | * NetworkManager 0.9.9 allows doing this below and letting NM to figure out the best connection: | ||
521 | 343 | * | ||
522 | 344 | * m_nm.activate_connection(dbus::types::ObjectPath("/"), | ||
523 | 345 | * m_dev.object->path(), | ||
524 | 346 | * core::dbus::typ es::ObjectPath("/")); | ||
525 | 347 | * | ||
526 | 348 | * for now we get somewhat similar result by toggling the Autoconnect property, | ||
527 | 349 | * but this breaks the possible setting we will have for autoconnecting later. | ||
528 | 350 | */ | ||
529 | 351 | m_dev.autoconnect->set(true); | ||
530 | 352 | m_disabled = false; | ||
531 | 353 | #endif | ||
532 | 354 | } | ||
533 | 355 | |||
534 | 356 | void | ||
535 | 357 | WifiLinkImpl::disable() | ||
536 | 358 | { | ||
537 | 359 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | ||
538 | 360 | cout << __PRETTY_FUNCTION__ << endl; | ||
539 | 361 | #endif | ||
540 | 362 | |||
541 | 363 | /// @todo for now just disable wireless completely. | ||
542 | 364 | /// this only works properly when there is one wifi adapter on the system | ||
543 | 365 | try { | ||
544 | 366 | if (d->m_killSwitch->state() == KillSwitch::State::unblocked) { | ||
545 | 367 | // block the device. that will disable it also | ||
546 | 368 | d->m_killSwitch->block(); | ||
547 | 369 | return; | ||
548 | 370 | } | ||
549 | 371 | d->m_nm->setWirelessEnabled(false); | ||
550 | 372 | d->m_dev->setAutoconnect(false); | ||
551 | 373 | } catch(runtime_error &e) { | ||
552 | 374 | /// @todo when toggling enable()/disable() rapidly the default timeout of | ||
553 | 375 | /// 1 second in dbus::core::Property is not long enough.. | ||
554 | 376 | /// just ignore for now and get dbus-cpp to have larger timeout. | ||
555 | 377 | qWarning() << __PRETTY_FUNCTION__ << ": " << QString::fromStdString(e.what()); | ||
556 | 378 | } | ||
557 | 379 | |||
558 | 380 | #if 0 | ||
559 | 381 | /** @todo remove this after NM 0.9.9 is available. check comment in enable() */ | ||
560 | 382 | m_dev.disconnect(); | ||
561 | 383 | #endif | ||
562 | 384 | } | ||
563 | 385 | |||
564 | 386 | Link::Type | 319 | Link::Type |
565 | 387 | WifiLinkImpl::type() const | 320 | WifiLinkImpl::type() const |
566 | 388 | { | 321 | { |
567 | 389 | 322 | ||
568 | === modified file 'src/indicator/nmofono/wifi/wifi-link-impl.h' | |||
569 | --- src/indicator/nmofono/wifi/wifi-link-impl.h 2015-04-14 11:20:17 +0000 | |||
570 | +++ src/indicator/nmofono/wifi/wifi-link-impl.h 2015-08-05 15:22:19 +0000 | |||
571 | @@ -43,9 +43,6 @@ | |||
572 | 43 | ~WifiLinkImpl(); | 43 | ~WifiLinkImpl(); |
573 | 44 | 44 | ||
574 | 45 | // public API | 45 | // public API |
575 | 46 | void enable() override; | ||
576 | 47 | void disable() override; | ||
577 | 48 | |||
578 | 49 | Type type() const override; | 46 | Type type() const override; |
579 | 50 | Id id() const override; | 47 | Id id() const override; |
580 | 51 | QString name() const override; | 48 | QString name() const override; |
581 | 52 | 49 | ||
582 | === modified file 'src/indicator/nmofono/wwan/modem.cpp' | |||
583 | --- src/indicator/nmofono/wwan/modem.cpp 2015-06-18 12:28:05 +0000 | |||
584 | +++ src/indicator/nmofono/wwan/modem.cpp 2015-08-05 15:22:19 +0000 | |||
585 | @@ -671,16 +671,6 @@ | |||
586 | 671 | return WwanType::GSM; | 671 | return WwanType::GSM; |
587 | 672 | } | 672 | } |
588 | 673 | 673 | ||
589 | 674 | void | ||
590 | 675 | Modem::enable() | ||
591 | 676 | { | ||
592 | 677 | } | ||
593 | 678 | |||
594 | 679 | void | ||
595 | 680 | Modem::disable() | ||
596 | 681 | { | ||
597 | 682 | } | ||
598 | 683 | |||
599 | 684 | Link::Type | 674 | Link::Type |
600 | 685 | Modem::type() const | 675 | Modem::type() const |
601 | 686 | { | 676 | { |
602 | 687 | 677 | ||
603 | === modified file 'src/indicator/nmofono/wwan/modem.h' | |||
604 | --- src/indicator/nmofono/wwan/modem.h 2015-06-18 12:28:05 +0000 | |||
605 | +++ src/indicator/nmofono/wwan/modem.h 2015-08-05 15:22:19 +0000 | |||
606 | @@ -132,10 +132,6 @@ | |||
607 | 132 | 132 | ||
608 | 133 | WwanType wwanType() const override; | 133 | WwanType wwanType() const override; |
609 | 134 | 134 | ||
610 | 135 | void enable() override; | ||
611 | 136 | |||
612 | 137 | void disable() override; | ||
613 | 138 | |||
614 | 139 | Type type() const override; | 135 | Type type() const override; |
615 | 140 | 136 | ||
616 | 141 | std::uint32_t characteristics() const override; | 137 | std::uint32_t characteristics() const override; |
PASSED: Continuous integration, rev:519 jenkins. qa.ubuntu. com/job/ indicator- network- ci/381/ jenkins. qa.ubuntu. com/job/ indicator- network- wily-amd64- ci/33 jenkins. qa.ubuntu. com/job/ indicator- network- wily-armhf- ci/33 jenkins. qa.ubuntu. com/job/ indicator- network- wily-armhf- ci/33/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- network- ci/381/ rebuild
http://