Merge lp:~pete-woods/indicator-network/simplify-toggles into lp:indicator-network/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
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Indicator Applet Developers Pending
Review via email: mp+267052@code.launchpad.net

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
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
=== modified file 'src/indicator/connectivity-service/connectivity-service.cpp'
--- src/indicator/connectivity-service/connectivity-service.cpp 2015-08-05 15:22:19 +0000
+++ src/indicator/connectivity-service/connectivity-service.cpp 2015-08-05 15:22:19 +0000
@@ -197,14 +197,13 @@
197 connect(d->m_manager.get(), &Manager::wifiEnabledUpdated, d.get(), &Private::wifiEnabledUpdated);197 connect(d->m_manager.get(), &Manager::wifiEnabledUpdated, d.get(), &Private::wifiEnabledUpdated);
198 connect(d->m_manager.get(), &Manager::unstoppableOperationHappeningUpdated, d.get(), &Private::unstoppableOperationHappeningUpdated);198 connect(d->m_manager.get(), &Manager::unstoppableOperationHappeningUpdated, d.get(), &Private::unstoppableOperationHappeningUpdated);
199199
200 auto hotspotManager = d->m_manager->hotspotManager();200 connect(d->m_manager.get(), &Manager::hotspotEnabledChanged, d.get(), &Private::hotspotEnabledUpdated);
201 connect(hotspotManager.get(), &HotspotManager::enabledChanged, d.get(), &Private::hotspotEnabledUpdated);201 connect(d->m_manager.get(), &Manager::hotspotSsidChanged, d.get(), &Private::hotspotSsidUpdated);
202 connect(hotspotManager.get(), &HotspotManager::ssidChanged, d.get(), &Private::hotspotSsidUpdated);202 connect(d->m_manager.get(), &Manager::hotspotPasswordChanged, d.get(), &Private::hotspotPasswordUpdated);
203 connect(hotspotManager.get(), &HotspotManager::passwordChanged, d.get(), &Private::hotspotPasswordUpdated);203 connect(d->m_manager.get(), &Manager::hotspotModeChanged, d.get(), &Private::hotspotModeUpdated);
204 connect(hotspotManager.get(), &HotspotManager::modeChanged, d.get(), &Private::hotspotModeUpdated);204 connect(d->m_manager.get(), &Manager::hotspotStoredChanged, d.get(), &Private::hotspotStoredUpdated);
205 connect(hotspotManager.get(), &HotspotManager::storedChanged, d.get(), &Private::hotspotStoredUpdated);
206205
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);
208207
209 d->updateNetworkingStatus();208 d->updateNetworkingStatus();
210209
@@ -257,22 +256,22 @@
257256
258bool ConnectivityService::hotspotEnabled() const257bool ConnectivityService::hotspotEnabled() const
259{258{
260 return d->m_manager->hotspotManager()->enabled();259 return d->m_manager->hotspotEnabled();
261}260}
262261
263QByteArray ConnectivityService::hotspotSsid() const262QByteArray ConnectivityService::hotspotSsid() const
264{263{
265 return d->m_manager->hotspotManager()->ssid();264 return d->m_manager->hotspotSsid();
266}265}
267266
268QString ConnectivityService::hotspotMode() const267QString ConnectivityService::hotspotMode() const
269{268{
270 return d->m_manager->hotspotManager()->mode();269 return d->m_manager->hotspotMode();
271}270}
272271
273bool ConnectivityService::hotspotStored() const272bool ConnectivityService::hotspotStored() const
274{273{
275 return d->m_manager->hotspotManager()->stored();274 return d->m_manager->hotspotStored();
276}275}
277276
278PrivateService::PrivateService(ConnectivityService& parent) :277PrivateService::PrivateService(ConnectivityService& parent) :
@@ -304,27 +303,27 @@
304303
305void PrivateService::SetHotspotEnabled(bool enabled)304void PrivateService::SetHotspotEnabled(bool enabled)
306{305{
307 p.d->m_manager->hotspotManager()->setEnabled(enabled);306 p.d->m_manager->setHotspotEnabled(enabled);
308}307}
309308
310void PrivateService::SetHotspotSsid(const QByteArray &ssid)309void PrivateService::SetHotspotSsid(const QByteArray &ssid)
311{310{
312 p.d->m_manager->hotspotManager()->setSsid(ssid);311 p.d->m_manager->setHotspotSsid(ssid);
313}312}
314313
315void PrivateService::SetHotspotPassword(const QString &password)314void PrivateService::SetHotspotPassword(const QString &password)
316{315{
317 p.d->m_manager->hotspotManager()->setPassword(password);316 p.d->m_manager->setHotspotPassword(password);
318}317}
319318
320void PrivateService::SetHotspotMode(const QString &mode)319void PrivateService::SetHotspotMode(const QString &mode)
321{320{
322 p.d->m_manager->hotspotManager()->setMode(mode);321 p.d->m_manager->setHotspotMode(mode);
323}322}
324323
325QString PrivateService::hotspotPassword() const324QString PrivateService::hotspotPassword() const
326{325{
327 return p.d->m_manager->hotspotManager()->password();326 return p.d->m_manager->hotspotPassword();
328}327}
329328
330}329}
331330
=== modified file 'src/indicator/nmofono/hotspot-manager.h'
--- src/indicator/nmofono/hotspot-manager.h 2015-08-05 15:22:19 +0000
+++ src/indicator/nmofono/hotspot-manager.h 2015-08-05 15:22:19 +0000
@@ -123,8 +123,6 @@
123123
124 bool enabled() const;124 bool enabled() const;
125125
126 void setEnabled(bool);
127
128 bool stored() const;126 bool stored() const;
129127
130 QByteArray ssid() const;128 QByteArray ssid() const;
@@ -155,6 +153,8 @@
155 void reportError(int reason);153 void reportError(int reason);
156154
157public Q_SLOTS:155public Q_SLOTS:
156 void setEnabled(bool);
157
158 void setSsid(const QByteArray&);158 void setSsid(const QByteArray&);
159159
160 void setPassword(const QString&);160 void setPassword(const QString&);
161161
=== modified file 'src/indicator/nmofono/kill-switch.cpp'
--- src/indicator/nmofono/kill-switch.cpp 2015-04-23 13:22:55 +0000
+++ src/indicator/nmofono/kill-switch.cpp 2015-08-05 15:22:19 +0000
@@ -88,27 +88,34 @@
88}88}
8989
90void90void
91KillSwitch::block()91KillSwitch::setBlock(bool block)
92{92{
93 if (state() == KillSwitch::State::hard_blocked)93 if (!block && state() == State::hard_blocked)
94 throw KillSwitch::exception::HardBlocked();94 {
9595 qCritical() << __PRETTY_FUNCTION__ << "Killswitch is hard blocked.";
96 try {96 return;
97 if (!utils::getOrThrow(d->urfkill->Block(static_cast<uint>(Private::DeviceType::wlan), true)))97 }
98 throw KillSwitch::exception::Failed("Failed to block killswitch");98
99 } catch (std::exception &e) {99 if (!block && state() != State::soft_blocked)
100 throw KillSwitch::exception::Failed(e.what());100 {
101 }101 return;
102}102 }
103103
104void104 if (block && state() != State::unblocked)
105KillSwitch::unblock()105 {
106{106 return;
107 try {107 }
108 if (!utils::getOrThrow(d->urfkill->Block(static_cast<uint>(Private::DeviceType::wlan), false)))108
109 throw KillSwitch::exception::Failed("Failed to unblock killswitch");109 try
110 } catch (std::exception &e) {110 {
111 throw KillSwitch::exception::Failed(e.what());111 if (!utils::getOrThrow(d->urfkill->Block(static_cast<uint>(Private::DeviceType::wlan), block)))
112 {
113 throw std::runtime_error("Failed to block killswitch");
114 }
115 }
116 catch (std::exception &e)
117 {
118 qCritical() << __PRETTY_FUNCTION__ << e.what();
112 }119 }
113}120}
114121
115122
=== modified file 'src/indicator/nmofono/kill-switch.h'
--- src/indicator/nmofono/kill-switch.h 2015-04-14 11:20:17 +0000
+++ src/indicator/nmofono/kill-switch.h 2015-08-05 15:22:19 +0000
@@ -37,24 +37,6 @@
37public:37public:
38 typedef std::shared_ptr<KillSwitch> Ptr;38 typedef std::shared_ptr<KillSwitch> Ptr;
3939
40 struct exception
41 {
42 struct HardBlocked : public std::runtime_error
43 {
44 HardBlocked()
45 : std::runtime_error("Killswitch is hard blocked.")
46 {}
47 };
48
49 struct Failed : public std::runtime_error
50 {
51 Failed() = delete;
52 Failed(std::string what)
53 : std::runtime_error(what)
54 {}
55 };
56 };
57
58 enum class State40 enum class State
59 {41 {
60 not_available = -1,42 not_available = -1,
@@ -68,12 +50,7 @@
68 KillSwitch(const QDBusConnection& systemBus);50 KillSwitch(const QDBusConnection& systemBus);
69 ~KillSwitch();51 ~KillSwitch();
7052
71 /// @throws exception::Failed if the switch fails to block53 void setBlock(bool block);
72 void block();
73
74 /// @throws exception::HardBlocked if trying to unblock when switch is hard blocked
75 /// @throws exception::Failed if the switch fails to unblock
76 void unblock();
7754
78 State state() const;55 State state() const;
79 bool flightMode(bool enable);56 bool flightMode(bool enable);
8057
=== modified file 'src/indicator/nmofono/link.h'
--- src/indicator/nmofono/link.h 2015-04-14 11:20:17 +0000
+++ src/indicator/nmofono/link.h 2015-08-05 15:22:19 +0000
@@ -92,12 +92,6 @@
92 };92 };
9393
94 /// @private94 /// @private
95 virtual void enable() = 0;
96
97 /// @private
98 virtual void disable() = 0;
99
100 /// @private
101 virtual Type type() const = 0;95 virtual Type type() const = 0;
10296
103 /// @private97 /// @private
10498
=== modified file 'src/indicator/nmofono/manager-impl.cpp'
--- src/indicator/nmofono/manager-impl.cpp 2015-08-05 15:22:19 +0000
+++ src/indicator/nmofono/manager-impl.cpp 2015-08-05 15:22:19 +0000
@@ -244,6 +244,13 @@
244 connect(d->m_killSwitch.get(), &KillSwitch::stateChanged, d.get(), &Private::updateHasWifi);244 connect(d->m_killSwitch.get(), &KillSwitch::stateChanged, d.get(), &Private::updateHasWifi);
245245
246 d->m_hotspotManager = make_shared<HotspotManager>(systemConnection);246 d->m_hotspotManager = make_shared<HotspotManager>(systemConnection);
247 connect(d->m_hotspotManager.get(), &HotspotManager::enabledChanged, this, &Manager::hotspotEnabledChanged);
248 connect(d->m_hotspotManager.get(), &HotspotManager::ssidChanged, this, &Manager::hotspotSsidChanged);
249 connect(d->m_hotspotManager.get(), &HotspotManager::passwordChanged, this, &Manager::hotspotPasswordChanged);
250 connect(d->m_hotspotManager.get(), &HotspotManager::modeChanged, this, &Manager::hotspotModeChanged);
251 connect(d->m_hotspotManager.get(), &HotspotManager::storedChanged, this, &Manager::hotspotStoredChanged);
252
253 connect(d->m_hotspotManager.get(), &HotspotManager::reportError, this, &Manager::reportError);
247254
248 connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::DeviceAdded, this, &ManagerImpl::device_added);255 connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::DeviceAdded, this, &ManagerImpl::device_added);
249 QList<QDBusObjectPath> devices(d->nm->GetDevices());256 QList<QDBusObjectPath> devices(d->nm->GetDevices());
@@ -256,16 +263,7 @@
256 connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::PropertiesChanged, this, &ManagerImpl::nm_properties_changed);263 connect(d->nm.get(), &OrgFreedesktopNetworkManagerInterface::PropertiesChanged, this, &ManagerImpl::nm_properties_changed);
257264
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 try266 d->setFlightMode(d->m_killSwitch->isFlightMode());
260 {
261 d->setFlightMode(d->m_killSwitch->isFlightMode());
262 }
263 catch (exception const& e)
264 {
265 cerr << __PRETTY_FUNCTION__ << ": " << e.what() << endl;
266 cerr << "Failed to retrieve initial flight mode state, assuming state is false." << endl;
267 d->setFlightMode(false);
268 }
269267
270 /// @todo set by the default connections.268 /// @todo set by the default connections.
271 d->m_characteristics = Link::Characteristics::empty;269 d->m_characteristics = Link::Characteristics::empty;
@@ -418,48 +416,23 @@
418}416}
419417
420418
421bool419void
422ManagerImpl::setWifiEnabled(bool enabled)420ManagerImpl::setWifiEnabled(bool enabled)
423{421{
424 if (!d->m_hasWifi)422 if (!d->m_hasWifi)
425 {423 {
426 return false;424 return;
427 }425 }
428426
429 if (d->m_wifiEnabled == enabled)427 if (d->m_wifiEnabled == enabled)
430 {428 {
431 return false;429 return;
432 }430 }
433431
434 bool success = true;
435 d->setUnstoppableOperationHappening(true);432 d->setUnstoppableOperationHappening(true);
436433 d->m_killSwitch->setBlock(!enabled);
437 try434 d->nm->setWirelessEnabled(enabled);
438 {
439 if (enabled)
440 {
441 if (d->m_killSwitch->state() == KillSwitch::State::soft_blocked)
442 {
443 // try to unblock. throws if fails.
444 d->m_killSwitch->unblock();
445 }
446 }
447 else
448 {
449 if (d->m_killSwitch->state() == KillSwitch::State::unblocked) {
450 // block the device. that will disable it also
451 d->m_killSwitch->block();
452 }
453 }
454 d->nm->setWirelessEnabled(enabled);
455 }
456 catch (runtime_error &e)
457 {
458 qWarning() << __PRETTY_FUNCTION__ << ": " << e.what();
459 success = false;
460 }
461 d->setUnstoppableOperationHappening(false);435 d->setUnstoppableOperationHappening(false);
462 return success;
463}436}
464437
465bool438bool
@@ -557,9 +530,60 @@
557 return d->m_ofonoLinks.values().toSet();530 return d->m_ofonoLinks.values().toSet();
558}531}
559532
560HotspotManager::SPtr ManagerImpl::hotspotManager() const533bool
561{534ManagerImpl::hotspotEnabled() const
562 return d->m_hotspotManager;535{
536 return d->m_hotspotManager->enabled();
537}
538
539bool
540ManagerImpl::hotspotStored() const
541{
542 return d->m_hotspotManager->stored();
543}
544
545QByteArray
546ManagerImpl::hotspotSsid() const
547{
548 return d->m_hotspotManager->ssid();
549}
550
551QString
552ManagerImpl::hotspotPassword() const
553{
554 return d->m_hotspotManager->password();
555}
556
557QString
558ManagerImpl::hotspotMode() const
559{
560 return d->m_hotspotManager->mode();
561}
562
563void
564ManagerImpl::setHotspotEnabled(bool enabled)
565{
566 d->setUnstoppableOperationHappening(true);
567 d->m_hotspotManager->setEnabled(enabled);
568 d->setUnstoppableOperationHappening(false);
569}
570
571void
572ManagerImpl::setHotspotSsid(const QByteArray& ssid)
573{
574 d->m_hotspotManager->setSsid(ssid);
575}
576
577void
578ManagerImpl::setHotspotPassword(const QString& password)
579{
580 d->m_hotspotManager->setPassword(password);
581}
582
583void
584ManagerImpl::setHotspotMode(const QString& mode)
585{
586 d->m_hotspotManager->setMode(mode);
563}587}
564588
565}589}
566590
=== modified file 'src/indicator/nmofono/manager-impl.h'
--- src/indicator/nmofono/manager-impl.h 2015-08-05 15:22:19 +0000
+++ src/indicator/nmofono/manager-impl.h 2015-08-05 15:22:19 +0000
@@ -51,7 +51,7 @@
51 bool hasWifi() const override;51 bool hasWifi() const override;
52 bool wifiEnabled() const override;52 bool wifiEnabled() const override;
5353
54 bool setWifiEnabled(bool) override;54 void setWifiEnabled(bool) override;
5555
56 bool roaming() const override;56 bool roaming() const override;
5757
@@ -66,7 +66,23 @@
66 void unlockAllModems() override;66 void unlockAllModems() override;
67 void unlockModemByName(const QString &name) override;67 void unlockModemByName(const QString &name) override;
6868
69 HotspotManager::SPtr hotspotManager() const;69 bool hotspotEnabled() const override;
70
71 bool hotspotStored() const override;
72
73 QByteArray hotspotSsid() const override;
74
75 QString hotspotPassword() const override;
76
77 QString hotspotMode() const override;
78
79 void setHotspotEnabled(bool) override;
80
81 void setHotspotSsid(const QByteArray&) override;
82
83 void setHotspotPassword(const QString&) override;
84
85 void setHotspotMode(const QString&) override;
7086
71private Q_SLOTS:87private Q_SLOTS:
72 void device_added(const QDBusObjectPath &path);88 void device_added(const QDBusObjectPath &path);
7389
=== modified file 'src/indicator/nmofono/manager.h'
--- src/indicator/nmofono/manager.h 2015-08-05 15:22:19 +0000
+++ src/indicator/nmofono/manager.h 2015-08-05 15:22:19 +0000
@@ -87,8 +87,6 @@
87 Q_PROPERTY(bool unstoppableOperationHappening READ unstoppableOperationHappening NOTIFY unstoppableOperationHappeningUpdated)87 Q_PROPERTY(bool unstoppableOperationHappening READ unstoppableOperationHappening NOTIFY unstoppableOperationHappeningUpdated)
88 virtual bool unstoppableOperationHappening() const = 0;88 virtual bool unstoppableOperationHappening() const = 0;
8989
90 virtual HotspotManager::SPtr hotspotManager() const = 0;
91
92 /// @private90 /// @private
93 Q_PROPERTY(QSet<Link::Ptr> links READ links NOTIFY linksUpdated)91 Q_PROPERTY(QSet<Link::Ptr> links READ links NOTIFY linksUpdated)
94 virtual QSet<Link::Ptr> links() const = 0;92 virtual QSet<Link::Ptr> links() const = 0;
@@ -130,6 +128,21 @@
130128
131 virtual void unlockModemByName(const QString &name) = 0;129 virtual void unlockModemByName(const QString &name) = 0;
132130
131 Q_PROPERTY(bool hotspotEnabled READ hotspotEnabled WRITE setHotspotEnabled NOTIFY hotspotEnabledChanged)
132 virtual bool hotspotEnabled() const = 0;
133
134 Q_PROPERTY(bool hotspotStored READ hotspotStored NOTIFY hotspotStoredChanged)
135 virtual bool hotspotStored() const = 0;
136
137 Q_PROPERTY(QByteArray hotspotSsid READ hotspotSsid WRITE setHotspotSsid NOTIFY hotspotSsidChanged)
138 virtual QByteArray hotspotSsid() const = 0;
139
140 Q_PROPERTY(QString hotspotPassword READ hotspotPassword WRITE setHotspotPassword NOTIFY hotspotPasswordChanged)
141 virtual QString hotspotPassword() const = 0;
142
143 Q_PROPERTY(QString hotspotMode READ hotspotMode WRITE setHotspotMode NOTIFY hotspotModeChanged)
144 virtual QString hotspotMode() const = 0;
145
133Q_SIGNALS:146Q_SIGNALS:
134 void flightModeUpdated(FlightModeStatus);147 void flightModeUpdated(FlightModeStatus);
135148
@@ -143,13 +156,33 @@
143156
144 void wifiEnabledUpdated(bool);157 void wifiEnabledUpdated(bool);
145158
159 void hotspotEnabledChanged(bool enabled);
160
161 void hotspotStoredChanged(bool stored);
162
163 void hotspotSsidChanged(const QByteArray& ssid);
164
165 void hotspotPasswordChanged(const QString& password);
166
167 void hotspotModeChanged(const QString& mode);
168
169 void reportError(int reason);
170
146 void unstoppableOperationHappeningUpdated(bool);171 void unstoppableOperationHappeningUpdated(bool);
147172
148public Q_SLOTS:173public Q_SLOTS:
149 virtual bool setWifiEnabled(bool) = 0;174 virtual void setWifiEnabled(bool) = 0;
150175
151 virtual void setFlightMode(bool) = 0;176 virtual void setFlightMode(bool) = 0;
152177
178 virtual void setHotspotEnabled(bool) = 0;
179
180 virtual void setHotspotSsid(const QByteArray&) = 0;
181
182 virtual void setHotspotPassword(const QString&) = 0;
183
184 virtual void setHotspotMode(const QString&) = 0;
185
153protected:186protected:
154 /**187 /**
155 * @brief The default constructor is protected.188 * @brief The default constructor is protected.
156189
=== modified file 'src/indicator/nmofono/wifi/wifi-link-impl.cpp'
--- src/indicator/nmofono/wifi/wifi-link-impl.cpp 2015-07-08 08:49:30 +0000
+++ src/indicator/nmofono/wifi/wifi-link-impl.cpp 2015-08-05 15:22:19 +0000
@@ -316,73 +316,6 @@
316WifiLinkImpl::~WifiLinkImpl()316WifiLinkImpl::~WifiLinkImpl()
317{}317{}
318318
319void
320WifiLinkImpl::enable()
321{
322#ifdef INDICATOR_NETWORK_TRACE_MESSAGES
323 qDebug() << __PRETTY_FUNCTION__;
324#endif
325
326 try {
327 if (d->m_killSwitch->state() != KillSwitch::State::unblocked) {
328 // try to unblock. throws if fails.
329 d->m_killSwitch->unblock();
330 }
331 d->m_nm->setWirelessEnabled(true);
332 d->m_dev->setAutoconnect(true);
333 } catch(runtime_error &e) {
334 /// @todo when toggling enable()/disable() rapidly the default timeout of
335 /// 1 second in dbus::core::Property is not long enough..
336 /// just ignore for now and get dbus-cpp to have larger timeout.
337 cerr << __PRETTY_FUNCTION__ << ": " << e.what() << endl;
338 }
339
340#if 0
341 /** @todo:
342 * NetworkManager 0.9.9 allows doing this below and letting NM to figure out the best connection:
343 *
344 * m_nm.activate_connection(dbus::types::ObjectPath("/"),
345 * m_dev.object->path(),
346 * core::dbus::typ es::ObjectPath("/"));
347 *
348 * for now we get somewhat similar result by toggling the Autoconnect property,
349 * but this breaks the possible setting we will have for autoconnecting later.
350 */
351 m_dev.autoconnect->set(true);
352 m_disabled = false;
353#endif
354}
355
356void
357WifiLinkImpl::disable()
358{
359#ifdef INDICATOR_NETWORK_TRACE_MESSAGES
360 cout << __PRETTY_FUNCTION__ << endl;
361#endif
362
363 /// @todo for now just disable wireless completely.
364 /// this only works properly when there is one wifi adapter on the system
365 try {
366 if (d->m_killSwitch->state() == KillSwitch::State::unblocked) {
367 // block the device. that will disable it also
368 d->m_killSwitch->block();
369 return;
370 }
371 d->m_nm->setWirelessEnabled(false);
372 d->m_dev->setAutoconnect(false);
373 } catch(runtime_error &e) {
374 /// @todo when toggling enable()/disable() rapidly the default timeout of
375 /// 1 second in dbus::core::Property is not long enough..
376 /// just ignore for now and get dbus-cpp to have larger timeout.
377 qWarning() << __PRETTY_FUNCTION__ << ": " << QString::fromStdString(e.what());
378 }
379
380#if 0
381 /** @todo remove this after NM 0.9.9 is available. check comment in enable() */
382 m_dev.disconnect();
383#endif
384}
385
386Link::Type319Link::Type
387WifiLinkImpl::type() const320WifiLinkImpl::type() const
388{321{
389322
=== modified file 'src/indicator/nmofono/wifi/wifi-link-impl.h'
--- src/indicator/nmofono/wifi/wifi-link-impl.h 2015-04-14 11:20:17 +0000
+++ src/indicator/nmofono/wifi/wifi-link-impl.h 2015-08-05 15:22:19 +0000
@@ -43,9 +43,6 @@
43 ~WifiLinkImpl();43 ~WifiLinkImpl();
4444
45 // public API45 // public API
46 void enable() override;
47 void disable() override;
48
49 Type type() const override;46 Type type() const override;
50 Id id() const override;47 Id id() const override;
51 QString name() const override;48 QString name() const override;
5249
=== modified file 'src/indicator/nmofono/wwan/modem.cpp'
--- src/indicator/nmofono/wwan/modem.cpp 2015-06-18 12:28:05 +0000
+++ src/indicator/nmofono/wwan/modem.cpp 2015-08-05 15:22:19 +0000
@@ -671,16 +671,6 @@
671 return WwanType::GSM;671 return WwanType::GSM;
672}672}
673673
674void
675Modem::enable()
676{
677}
678
679void
680Modem::disable()
681{
682}
683
684Link::Type674Link::Type
685Modem::type() const675Modem::type() const
686{676{
687677
=== modified file 'src/indicator/nmofono/wwan/modem.h'
--- src/indicator/nmofono/wwan/modem.h 2015-06-18 12:28:05 +0000
+++ src/indicator/nmofono/wwan/modem.h 2015-08-05 15:22:19 +0000
@@ -132,10 +132,6 @@
132132
133 WwanType wwanType() const override;133 WwanType wwanType() const override;
134134
135 void enable() override;
136
137 void disable() override;
138
139 Type type() const override;135 Type type() const override;
140136
141 std::uint32_t characteristics() const override;137 std::uint32_t characteristics() const override;

Subscribers

People subscribed via source and target branches