Merge lp:~jonas-drange/ubuntu-system-settings/rtm-1399723 into lp:ubuntu-system-settings/rtm-14.09

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 955
Merged at revision: 957
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/rtm-1399723
Merge into: lp:ubuntu-system-settings/rtm-14.09
Diff against target: 109 lines (+7/-33)
3 files modified
plugins/about/PageComponent.qml (+7/-2)
plugins/about/networkabout.cpp (+0/-23)
plugins/about/networkabout.h (+0/-8)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/rtm-1399723
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ken VanDine Approve
Review via email: mp+245957@code.launchpad.net

Commit message

[about] use networkinfo to pull the wifi device MAC

Description of the change

[about] use networkinfo to pull the wifi device MAC

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good!

review: Approve
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
1=== modified file 'plugins/about/PageComponent.qml'
2--- plugins/about/PageComponent.qml 2014-11-12 16:03:25 +0000
3+++ plugins/about/PageComponent.qml 2015-01-09 13:20:46 +0000
4@@ -61,6 +61,10 @@
5 id: network
6 }
7
8+ NetworkInfo {
9+ id: wlinfo
10+ }
11+
12 Flickable {
13 id: scrollWidget
14 anchors.fill: parent
15@@ -122,9 +126,10 @@
16 }
17
18 ListItem.SingleValue {
19+ property string address: wlinfo.macAddress(NetworkInfo.WlanMode, 0)
20 text: i18n.tr("Wi-Fi address")
21- value: network.networkMacAddresses[0]
22- visible: network.networkMacAddresses.length > 0
23+ value: address ? address.toUpperCase() : ""
24+ visible: address
25 showDivider: bthwaddr.visible
26 }
27
28
29=== modified file 'plugins/about/networkabout.cpp'
30--- plugins/about/networkabout.cpp 2014-08-28 10:33:41 +0000
31+++ plugins/about/networkabout.cpp 2015-01-09 13:20:46 +0000
32@@ -28,27 +28,9 @@
33 m_systemBusConnection(QDBusConnection::systemBus())
34 {
35
36- setupNetworkMacAddresses();
37 setupBluetoothMacAddress();
38 }
39
40-void NetworkAbout::setupNetworkMacAddresses()
41-{
42- QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
43- int count = ifaces.count();
44-
45- QString str = QString();
46- for(int i=0;i<count;i++)
47- {
48- QNetworkInterface iface = ifaces.at(i);
49- str = iface.hardwareAddress();
50- // add interfaces that are not loopback
51- if (!iface.flags().testFlag(QNetworkInterface::IsLoopBack)) {
52- m_networkMacAddresses << str;
53- }
54- }
55-}
56-
57 void NetworkAbout::setupBluetoothMacAddress()
58 {
59 QDBusInterface bluezManagerInterface (
60@@ -84,11 +66,6 @@
61 m_bluetoothMacAddress = props.value()["Address"].toString();
62 }
63
64-QStringList NetworkAbout::networkMacAddresses()
65-{
66- return m_networkMacAddresses;
67-}
68-
69 QString NetworkAbout::bluetoothMacAddress()
70 {
71 return m_bluetoothMacAddress;
72
73=== modified file 'plugins/about/networkabout.h'
74--- plugins/about/networkabout.h 2014-08-28 10:33:41 +0000
75+++ plugins/about/networkabout.h 2015-01-09 13:20:46 +0000
76@@ -23,33 +23,25 @@
77
78 #include <QObject>
79 #include <QStringList>
80-#include <QtNetwork>
81 #include <QtDBus/QDBusInterface>
82
83
84 class NetworkAbout : public QObject
85 {
86 Q_OBJECT
87- Q_PROPERTY( QStringList networkMacAddresses
88- READ networkMacAddresses
89- NOTIFY networkMacAddressesChanged )
90 Q_PROPERTY( QString bluetoothMacAddress
91 READ bluetoothMacAddress
92 NOTIFY bluetoothMacAddressChanged )
93
94 public:
95 explicit NetworkAbout (QObject *parent = 0);
96- QStringList networkMacAddresses();
97 QString bluetoothMacAddress();
98
99 Q_SIGNALS:
100- void networkMacAddressesChanged(QStringList addresses);
101 void bluetoothMacAddressChanged(QString addresses);
102
103 private:
104- QStringList m_networkMacAddresses;
105 QString m_bluetoothMacAddress;
106- void setupNetworkMacAddresses();
107 void setupBluetoothMacAddress();
108 QDBusConnection m_systemBusConnection;
109 };

Subscribers

People subscribed via source and target branches