Merge lp:~ken-vandine/ubuntu-system-settings/lp1537029 into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Jonas G. Drange
Approved revision: 1586
Merged at revision: 1588
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/lp1537029
Merge into: lp:ubuntu-system-settings
Diff against target: 312 lines (+30/-132)
10 files modified
plugins/about/CMakeLists.txt (+0/-2)
plugins/about/PageComponent.qml (+7/-6)
plugins/about/networkabout.cpp (+0/-72)
plugins/about/networkabout.h (+0/-49)
plugins/about/plugin.cpp (+0/-2)
plugins/bluetooth/PageComponent.qml (+1/-1)
plugins/bluetooth/bluetooth.cpp (+6/-0)
plugins/bluetooth/bluetooth.h (+11/-0)
plugins/bluetooth/devicemodel.cpp (+2/-0)
plugins/bluetooth/devicemodel.h (+3/-0)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/lp1537029
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+283664@code.launchpad.net

Commit message

Exposed adapterAddress in the bluetooth plugin to be used to get the address in the about plugin

Description of the change

Exposed adapterAddress in the bluetooth plugin to be used to get the address in the about plugin. Removed the old NetworkAbout plugin provided by the about panel, it was using the bluez4 interface. We'll just get the property from the bluetooth panel.

To post a comment you must log in.
1585. By Ken VanDine

Expose adapterName as a property and emit change notifications

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1586. By Ken VanDine

removed unused NetworkAbout, we're now getting the bluetooth properties from the bluetooth plugin

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

I love it! Killing code and bugs at the same time.

Correct address on both device and desktop (i.e. addr match between ui and $ bluetoothctl).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/about/CMakeLists.txt'
2--- plugins/about/CMakeLists.txt 2015-08-19 13:54:40 +0000
3+++ plugins/about/CMakeLists.txt 2016-01-22 19:58:05 +0000
4@@ -23,11 +23,9 @@
5 plugin.cpp
6 storageabout.cpp
7 click.cpp
8- networkabout.cpp
9 plugin.h
10 storageabout.h
11 click.h
12- networkabout.h
13 ${QML_SOURCES} # So they show up in Qt designer.
14 )
15
16
17=== modified file 'plugins/about/PageComponent.qml'
18--- plugins/about/PageComponent.qml 2015-10-29 15:48:06 +0000
19+++ plugins/about/PageComponent.qml 2016-01-22 19:58:05 +0000
20@@ -25,6 +25,7 @@
21 import Ubuntu.Components.ListItems 1.3 as ListItem
22 import Ubuntu.SystemSettings.StorageAbout 1.0
23 import Ubuntu.SystemSettings.Update 1.0
24+import Ubuntu.SystemSettings.Bluetooth 1.0
25 import MeeGo.QOfono 0.2
26
27 ItemPage {
28@@ -39,6 +40,10 @@
29 id: backendInfos
30 }
31
32+ UbuntuBluetoothPanel {
33+ id: bluetooth
34+ }
35+
36 DeviceInfo {
37 id: deviceInfos
38 }
39@@ -48,10 +53,6 @@
40 onModemsChanged: root.modemsSorted = modems.slice(0).sort()
41 }
42
43- NetworkAbout {
44- id: network
45- }
46-
47 NetworkInfo {
48 id: wlinfo
49 }
50@@ -136,8 +137,8 @@
51 ListItem.SingleValue {
52 id: bthwaddr
53 text: i18n.tr("Bluetooth address")
54- value: network.bluetoothMacAddress
55- visible: network.bluetoothMacAddress
56+ value: bluetooth.adapterAddress
57+ visible: bluetooth.adapterAddress
58 showDivider: false
59 }
60
61
62=== removed file 'plugins/about/networkabout.cpp'
63--- plugins/about/networkabout.cpp 2014-12-11 14:04:51 +0000
64+++ plugins/about/networkabout.cpp 1970-01-01 00:00:00 +0000
65@@ -1,72 +0,0 @@
66-/*
67- * This file is part of system-settings
68- *
69- * Copyright (C) 2014 Canonical Ltd.
70- *
71- * Contact: Jonas G. Drange <jonas.drange@canonical.com>
72- *
73- * This program is free software: you can redistribute it and/or modify it
74- * under the terms of the GNU General Public License version 3, as published
75- * by the Free Software Foundation.
76- *
77- * This program is distributed in the hope that it will be useful, but
78- * WITHOUT ANY WARRANTY; without even the implied warranties of
79- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
80- * PURPOSE. See the GNU General Public License for more details.
81- *
82- * You should have received a copy of the GNU General Public License along
83- * with this program. If not, see <http://www.gnu.org/licenses/>.
84- */
85-
86-#include <QDebug>
87-#include <QDBusReply>
88-
89-#include "networkabout.h"
90-
91-NetworkAbout::NetworkAbout(QObject *parent)
92- : QObject(parent),
93- m_systemBusConnection(QDBusConnection::systemBus())
94-{
95-
96- setupBluetoothMacAddress();
97-}
98-
99-void NetworkAbout::setupBluetoothMacAddress()
100-{
101- QDBusInterface bluezManagerInterface (
102- "org.bluez",
103- "/",
104- "org.bluez.Manager",
105- m_systemBusConnection,
106- this);
107-
108- if (!bluezManagerInterface.isValid()) {
109- return;
110- }
111-
112- QDBusReply<QDBusObjectPath> defaultDevice = bluezManagerInterface.call("DefaultAdapter");
113-
114- if (!defaultDevice.isValid()) {
115- return;
116- }
117-
118- QDBusInterface adapterInterface (
119- "org.bluez",
120- defaultDevice.value().path(),
121- "org.bluez.Adapter",
122- m_systemBusConnection,
123- this);
124-
125- QDBusReply<QVariantMap> props = adapterInterface.call("GetProperties");
126-
127- if (!props.isValid()) {
128- return;
129- }
130-
131- m_bluetoothMacAddress = props.value()["Address"].toString();
132-}
133-
134-QString NetworkAbout::bluetoothMacAddress()
135-{
136- return m_bluetoothMacAddress;
137-}
138
139=== removed file 'plugins/about/networkabout.h'
140--- plugins/about/networkabout.h 2014-12-11 14:04:51 +0000
141+++ plugins/about/networkabout.h 1970-01-01 00:00:00 +0000
142@@ -1,49 +0,0 @@
143-/*
144- * This file is part of system-settings
145- *
146- * Copyright (C) 2014 Canonical Ltd.
147- *
148- * Contact: Jonas G. Drange <jonas.drange@canonical.com>
149- *
150- * This program is free software: you can redistribute it and/or modify it
151- * under the terms of the GNU General Public License version 3, as published
152- * by the Free Software Foundation.
153- *
154- * This program is distributed in the hope that it will be useful, but
155- * WITHOUT ANY WARRANTY; without even the implied warranties of
156- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
157- * PURPOSE. See the GNU General Public License for more details.
158- *
159- * You should have received a copy of the GNU General Public License along
160- * with this program. If not, see <http://www.gnu.org/licenses/>.
161- */
162-
163-#ifndef NETWORKABOUT_H
164-#define NETWORKABOUT_H
165-
166-#include <QObject>
167-#include <QStringList>
168-#include <QtDBus/QDBusInterface>
169-
170-
171-class NetworkAbout : public QObject
172-{
173- Q_OBJECT
174- Q_PROPERTY( QString bluetoothMacAddress
175- READ bluetoothMacAddress
176- NOTIFY bluetoothMacAddressChanged )
177-
178-public:
179- explicit NetworkAbout (QObject *parent = 0);
180- QString bluetoothMacAddress();
181-
182-Q_SIGNALS:
183- void bluetoothMacAddressChanged(QString addresses);
184-
185-private:
186- QString m_bluetoothMacAddress;
187- void setupBluetoothMacAddress();
188- QDBusConnection m_systemBusConnection;
189-};
190-
191-#endif // NETWORKABOUT_H
192
193=== modified file 'plugins/about/plugin.cpp'
194--- plugins/about/plugin.cpp 2014-09-04 00:58:34 +0000
195+++ plugins/about/plugin.cpp 2016-01-22 19:58:05 +0000
196@@ -23,7 +23,6 @@
197 #include <QtQml/QQmlContext>
198 #include "click.h"
199 #include "storageabout.h"
200-#include "networkabout.h"
201
202
203 void BackendPlugin::registerTypes(const char *uri)
204@@ -32,7 +31,6 @@
205
206 qRegisterMetaType<ClickModel::Roles>();
207 qmlRegisterType<ClickModel>(uri, 1, 0, "ClickRoles");
208- qmlRegisterType<NetworkAbout>(uri, 1, 0, "NetworkAbout");
209 qmlRegisterType<StorageAbout>(uri, 1, 0, "UbuntuStorageAboutPanel");
210 }
211
212
213=== modified file 'plugins/bluetooth/PageComponent.qml'
214--- plugins/bluetooth/PageComponent.qml 2015-11-20 08:47:27 +0000
215+++ plugins/bluetooth/PageComponent.qml 2016-01-22 19:58:05 +0000
216@@ -260,7 +260,7 @@
217 topMargin: units.gu(1)
218 }
219 height: units.gu(3)
220- text: backend.discoverable ? backend.adapterName() : ""
221+ text: backend.discoverable ? backend.adapterName : ""
222 color: "darkgrey"
223 visible: backend.discoverable
224 enabled: false
225
226=== modified file 'plugins/bluetooth/bluetooth.cpp'
227--- plugins/bluetooth/bluetooth.cpp 2015-11-30 20:53:22 +0000
228+++ plugins/bluetooth/bluetooth.cpp 2016-01-22 19:58:05 +0000
229@@ -65,6 +65,12 @@
230
231 QObject::connect(&m_devices, SIGNAL(devicePairingDone(Device*,bool)),
232 this, SIGNAL(devicePairingDone(Device*,bool)));
233+
234+ QObject::connect(&m_devices, SIGNAL(adapterNameChanged()),
235+ this, SIGNAL(adapterNameChanged()));
236+
237+ QObject::connect(&m_devices, SIGNAL(adapterAddressChanged()),
238+ this, SIGNAL(adapterAddressChanged()));
239 }
240
241 void Bluetooth::setSelectedDevice(const QString &address)
242
243=== modified file 'plugins/bluetooth/bluetooth.h'
244--- plugins/bluetooth/bluetooth.h 2015-10-26 13:19:47 +0000
245+++ plugins/bluetooth/bluetooth.h 2016-01-22 19:58:05 +0000
246@@ -64,12 +64,22 @@
247 READ isDiscoverable
248 NOTIFY discoverableChanged)
249
250+ Q_PROPERTY (QString adapterName
251+ READ adapterName
252+ NOTIFY adapterNameChanged)
253+
254+ Q_PROPERTY (QString adapterAddress
255+ READ adapterAddress
256+ NOTIFY adapterAddressChanged)
257+
258 Q_SIGNALS:
259 void selectedDeviceChanged();
260 void poweredChanged(bool powered);
261 void discoveringChanged(bool isActive);
262 void discoverableChanged(bool isActive);
263 void devicePairingDone(Device *device, bool success);
264+ void adapterNameChanged();
265+ void adapterAddressChanged();
266
267 public:
268 explicit Bluetooth(QObject *parent = nullptr);
269@@ -77,6 +87,7 @@
270 ~Bluetooth() {}
271
272 Q_INVOKABLE QString adapterName() const { return m_devices.adapterName(); }
273+ Q_INVOKABLE QString adapterAddress() const { return m_devices.adapterAddress(); }
274 Q_INVOKABLE void setSelectedDevice(const QString &address);
275 Q_INVOKABLE void connectDevice(const QString &address);
276 Q_INVOKABLE void disconnectDevice();
277
278=== modified file 'plugins/bluetooth/devicemodel.cpp'
279--- plugins/bluetooth/devicemodel.cpp 2015-11-11 11:48:28 +0000
280+++ plugins/bluetooth/devicemodel.cpp 2016-01-22 19:58:05 +0000
281@@ -366,8 +366,10 @@
282 {
283 if (key == "Name") {
284 m_adapterName = value.toString();
285+ Q_EMIT(adapterNameChanged());
286 } else if (key == "Address") {
287 m_adapterAddress = value.toString();
288+ Q_EMIT(adapterAddressChanged());
289 } else if (key == "Pairable") {
290 m_isPairable = value.toBool();
291 } else if (key == "Discoverable") {
292
293=== modified file 'plugins/bluetooth/devicemodel.h'
294--- plugins/bluetooth/devicemodel.h 2015-10-26 13:19:47 +0000
295+++ plugins/bluetooth/devicemodel.h 2016-01-22 19:58:05 +0000
296@@ -68,6 +68,7 @@
297 QSharedPointer<Device> getDeviceFromAddress(const QString &address);
298 QSharedPointer<Device> getDeviceFromPath(const QString &path);
299 QString adapterName() const { return m_adapterName; }
300+ QString adapterAddress() const { return m_adapterAddress; }
301
302 public:
303 bool isPowered() const { return m_isPowered; }
304@@ -84,6 +85,8 @@
305 void discoveringChanged(bool isDiscovering);
306 void discoverableChanged(bool isDiscoverable);
307 void devicePairingDone(Device *device, bool success);
308+ void adapterNameChanged();
309+ void adapterAddressChanged();
310
311 private:
312 QDBusConnection m_dbus;

Subscribers

People subscribed via source and target branches