Merge lp:~jonas-drange/ubuntu-system-settings/show-ip-and-mac into lp:ubuntu-system-settings
- show-ip-and-mac
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Ken VanDine | ||||
Approved revision: | 954 | ||||
Merged at revision: | 991 | ||||
Proposed branch: | lp:~jonas-drange/ubuntu-system-settings/show-ip-and-mac | ||||
Merge into: | lp:ubuntu-system-settings | ||||
Diff against target: |
549 lines (+393/-8) 10 files modified
plugins/about/CMakeLists.txt (+11/-2) plugins/about/PageComponent.qml (+19/-0) plugins/about/networkabout.cpp (+95/-0) plugins/about/networkabout.h (+57/-0) plugins/about/plugin.cpp (+3/-1) plugins/wifi/AccessPoint.qml (+12/-0) plugins/wifi/CMakeLists.txt (+1/-0) plugins/wifi/NetworkDetailsBrief.qml (+79/-0) plugins/wifi/wifidbushelper.cpp (+104/-4) plugins/wifi/wifidbushelper.h (+12/-1) |
||||
To merge this branch: | bzr merge lp:~jonas-drange/ubuntu-system-settings/show-ip-and-mac | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Ken VanDine | Approve | ||
Review via email:
|
Commit message
[about/wifi] adding mac addresses for bt and wifi, and ip for wifi
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:949
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:951
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sebastien Bacher (seb128) wrote : | # |
Thanks, I didn't do a real review but the listitem need to have their text set as translatable (e.g using i18.tr() for the strings)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sebastien Bacher (seb128) wrote : | # |
could you also link to the corresponding bug so it gets closed on upload?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:953
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ken VanDine (ken-vandine) wrote : | # |
The title on the NetworkDetailsBrief page should be the wireless network name according to the design.
- 954. By Jonas G. Drange
-
translatable strings, naming panel network name
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ken VanDine (ken-vandine) wrote : | # |
Looks good, thanks!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:954
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:954
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sebastien Bacher (seb128) wrote : | # |
Works fine, thanks
Preview Diff
1 | === modified file 'plugins/about/CMakeLists.txt' | |||
2 | --- plugins/about/CMakeLists.txt 2014-07-22 20:21:24 +0000 | |||
3 | +++ plugins/about/CMakeLists.txt 2014-08-29 18:12:46 +0000 | |||
4 | @@ -18,8 +18,17 @@ | |||
5 | 18 | ) | 18 | ) |
6 | 19 | 19 | ||
7 | 20 | add_library(UbuntuStorageAboutPanel MODULE | 20 | add_library(UbuntuStorageAboutPanel MODULE |
10 | 21 | plugin.cpp storageabout.cpp click.cpp plugin.h storageabout.h click.h | 21 | plugin.cpp |
11 | 22 | ${QML_SOURCES}) # So they show up in Qt designer. | 22 | storageabout.cpp |
12 | 23 | click.cpp | ||
13 | 24 | networkabout.cpp | ||
14 | 25 | plugin.h | ||
15 | 26 | storageabout.h | ||
16 | 27 | click.h | ||
17 | 28 | networkabout.h | ||
18 | 29 | ${QML_SOURCES} # So they show up in Qt designer. | ||
19 | 30 | ) | ||
20 | 31 | |||
21 | 23 | qt5_use_modules(UbuntuStorageAboutPanel Qml Quick DBus) | 32 | qt5_use_modules(UbuntuStorageAboutPanel Qml Quick DBus) |
22 | 24 | target_link_libraries(UbuntuStorageAboutPanel | 33 | target_link_libraries(UbuntuStorageAboutPanel |
23 | 25 | ${ANDR_PROP_LDFLAGS} ${GLIB_LDFLAGS} ${GIO_LDFLAGS}) | 34 | ${ANDR_PROP_LDFLAGS} ${GLIB_LDFLAGS} ${GIO_LDFLAGS}) |
24 | 26 | 35 | ||
25 | === modified file 'plugins/about/PageComponent.qml' | |||
26 | --- plugins/about/PageComponent.qml 2014-08-06 13:54:52 +0000 | |||
27 | +++ plugins/about/PageComponent.qml 2014-08-29 18:12:46 +0000 | |||
28 | @@ -55,6 +55,10 @@ | |||
29 | 55 | modemPath: manager.modems[0] | 55 | modemPath: manager.modems[0] |
30 | 56 | } | 56 | } |
31 | 57 | 57 | ||
32 | 58 | NetworkAbout { | ||
33 | 59 | id: network | ||
34 | 60 | } | ||
35 | 61 | |||
36 | 58 | Flickable { | 62 | Flickable { |
37 | 59 | id: scrollWidget | 63 | id: scrollWidget |
38 | 60 | anchors.fill: parent | 64 | anchors.fill: parent |
39 | @@ -118,6 +122,21 @@ | |||
40 | 118 | visible: imeiNumber | 122 | visible: imeiNumber |
41 | 119 | } | 123 | } |
42 | 120 | 124 | ||
43 | 125 | ListItem.SingleValue { | ||
44 | 126 | text: i18n.tr("Wi-Fi address") | ||
45 | 127 | value: network.networkMacAddresses[0] | ||
46 | 128 | visible: network.networkMacAddresses.length > 0 | ||
47 | 129 | showDivider: bthwaddr.visible | ||
48 | 130 | } | ||
49 | 131 | |||
50 | 132 | ListItem.SingleValue { | ||
51 | 133 | id: bthwaddr | ||
52 | 134 | text: i18n.tr("Bluetooth address") | ||
53 | 135 | value: network.bluetoothMacAddress | ||
54 | 136 | visible: network.bluetoothMacAddress | ||
55 | 137 | showDivider: false | ||
56 | 138 | } | ||
57 | 139 | |||
58 | 121 | ListItem.Divider {} | 140 | ListItem.Divider {} |
59 | 122 | 141 | ||
60 | 123 | ListItem.Standard { | 142 | ListItem.Standard { |
61 | 124 | 143 | ||
62 | === added file 'plugins/about/networkabout.cpp' | |||
63 | --- plugins/about/networkabout.cpp 1970-01-01 00:00:00 +0000 | |||
64 | +++ plugins/about/networkabout.cpp 2014-08-29 18:12:46 +0000 | |||
65 | @@ -0,0 +1,95 @@ | |||
66 | 1 | /* | ||
67 | 2 | * This file is part of system-settings | ||
68 | 3 | * | ||
69 | 4 | * Copyright (C) 2014 Canonical Ltd. | ||
70 | 5 | * | ||
71 | 6 | * Contact: Jonas G. Drange <jonas.drange@canonical.com> | ||
72 | 7 | * | ||
73 | 8 | * This program is free software: you can redistribute it and/or modify it | ||
74 | 9 | * under the terms of the GNU General Public License version 3, as published | ||
75 | 10 | * by the Free Software Foundation. | ||
76 | 11 | * | ||
77 | 12 | * This program is distributed in the hope that it will be useful, but | ||
78 | 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
79 | 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
80 | 15 | * PURPOSE. See the GNU General Public License for more details. | ||
81 | 16 | * | ||
82 | 17 | * You should have received a copy of the GNU General Public License along | ||
83 | 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
84 | 19 | */ | ||
85 | 20 | |||
86 | 21 | #include <QDebug> | ||
87 | 22 | #include <QDBusReply> | ||
88 | 23 | |||
89 | 24 | #include "networkabout.h" | ||
90 | 25 | |||
91 | 26 | NetworkAbout::NetworkAbout(QObject *parent) | ||
92 | 27 | : QObject(parent), | ||
93 | 28 | m_systemBusConnection(QDBusConnection::systemBus()) | ||
94 | 29 | { | ||
95 | 30 | |||
96 | 31 | setupNetworkMacAddresses(); | ||
97 | 32 | setupBluetoothMacAddress(); | ||
98 | 33 | } | ||
99 | 34 | |||
100 | 35 | void NetworkAbout::setupNetworkMacAddresses() | ||
101 | 36 | { | ||
102 | 37 | QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces(); | ||
103 | 38 | int count = ifaces.count(); | ||
104 | 39 | |||
105 | 40 | QString str = QString(); | ||
106 | 41 | for(int i=0;i<count;i++) | ||
107 | 42 | { | ||
108 | 43 | QNetworkInterface iface = ifaces.at(i); | ||
109 | 44 | str = iface.hardwareAddress(); | ||
110 | 45 | // add interfaces that are not loopback | ||
111 | 46 | if (!iface.flags().testFlag(QNetworkInterface::IsLoopBack)) { | ||
112 | 47 | m_networkMacAddresses << str; | ||
113 | 48 | } | ||
114 | 49 | } | ||
115 | 50 | } | ||
116 | 51 | |||
117 | 52 | void NetworkAbout::setupBluetoothMacAddress() | ||
118 | 53 | { | ||
119 | 54 | QDBusInterface bluezManagerInterface ( | ||
120 | 55 | "org.bluez", | ||
121 | 56 | "/", | ||
122 | 57 | "org.bluez.Manager", | ||
123 | 58 | m_systemBusConnection, | ||
124 | 59 | this); | ||
125 | 60 | |||
126 | 61 | if (!bluezManagerInterface.isValid()) { | ||
127 | 62 | return; | ||
128 | 63 | } | ||
129 | 64 | |||
130 | 65 | QDBusReply<QDBusObjectPath> defaultDevice = bluezManagerInterface.call("DefaultAdapter"); | ||
131 | 66 | |||
132 | 67 | if (!defaultDevice.isValid()) { | ||
133 | 68 | return; | ||
134 | 69 | } | ||
135 | 70 | |||
136 | 71 | QDBusInterface adapterInterface ( | ||
137 | 72 | "org.bluez", | ||
138 | 73 | defaultDevice.value().path(), | ||
139 | 74 | "org.bluez.Adapter", | ||
140 | 75 | m_systemBusConnection, | ||
141 | 76 | this); | ||
142 | 77 | |||
143 | 78 | QDBusReply<QVariantMap> props = adapterInterface.call("GetProperties"); | ||
144 | 79 | |||
145 | 80 | if (!props.isValid()) { | ||
146 | 81 | return; | ||
147 | 82 | } | ||
148 | 83 | |||
149 | 84 | m_bluetoothMacAddress = props.value()["Address"].toString(); | ||
150 | 85 | } | ||
151 | 86 | |||
152 | 87 | QStringList NetworkAbout::networkMacAddresses() | ||
153 | 88 | { | ||
154 | 89 | return m_networkMacAddresses; | ||
155 | 90 | } | ||
156 | 91 | |||
157 | 92 | QString NetworkAbout::bluetoothMacAddress() | ||
158 | 93 | { | ||
159 | 94 | return m_bluetoothMacAddress; | ||
160 | 95 | } | ||
161 | 0 | 96 | ||
162 | === added file 'plugins/about/networkabout.h' | |||
163 | --- plugins/about/networkabout.h 1970-01-01 00:00:00 +0000 | |||
164 | +++ plugins/about/networkabout.h 2014-08-29 18:12:46 +0000 | |||
165 | @@ -0,0 +1,57 @@ | |||
166 | 1 | /* | ||
167 | 2 | * This file is part of system-settings | ||
168 | 3 | * | ||
169 | 4 | * Copyright (C) 2014 Canonical Ltd. | ||
170 | 5 | * | ||
171 | 6 | * Contact: Jonas G. Drange <jonas.drange@canonical.com> | ||
172 | 7 | * | ||
173 | 8 | * This program is free software: you can redistribute it and/or modify it | ||
174 | 9 | * under the terms of the GNU General Public License version 3, as published | ||
175 | 10 | * by the Free Software Foundation. | ||
176 | 11 | * | ||
177 | 12 | * This program is distributed in the hope that it will be useful, but | ||
178 | 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
179 | 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
180 | 15 | * PURPOSE. See the GNU General Public License for more details. | ||
181 | 16 | * | ||
182 | 17 | * You should have received a copy of the GNU General Public License along | ||
183 | 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
184 | 19 | */ | ||
185 | 20 | |||
186 | 21 | #ifndef NETWORKABOUT_H | ||
187 | 22 | #define NETWORKABOUT_H | ||
188 | 23 | |||
189 | 24 | #include <QObject> | ||
190 | 25 | #include <QStringList> | ||
191 | 26 | #include <QtNetwork> | ||
192 | 27 | #include <QtDBus/QDBusInterface> | ||
193 | 28 | |||
194 | 29 | |||
195 | 30 | class NetworkAbout : public QObject | ||
196 | 31 | { | ||
197 | 32 | Q_OBJECT | ||
198 | 33 | Q_PROPERTY( QStringList networkMacAddresses | ||
199 | 34 | READ networkMacAddresses | ||
200 | 35 | NOTIFY networkMacAddressesChanged ) | ||
201 | 36 | Q_PROPERTY( QString bluetoothMacAddress | ||
202 | 37 | READ bluetoothMacAddress | ||
203 | 38 | NOTIFY bluetoothMacAddressChanged ) | ||
204 | 39 | |||
205 | 40 | public: | ||
206 | 41 | explicit NetworkAbout (QObject *parent = 0); | ||
207 | 42 | QStringList networkMacAddresses(); | ||
208 | 43 | QString bluetoothMacAddress(); | ||
209 | 44 | |||
210 | 45 | Q_SIGNALS: | ||
211 | 46 | void networkMacAddressesChanged(QStringList addresses); | ||
212 | 47 | void bluetoothMacAddressChanged(QString addresses); | ||
213 | 48 | |||
214 | 49 | private: | ||
215 | 50 | QStringList m_networkMacAddresses; | ||
216 | 51 | QString m_bluetoothMacAddress; | ||
217 | 52 | void setupNetworkMacAddresses(); | ||
218 | 53 | void setupBluetoothMacAddress(); | ||
219 | 54 | QDBusConnection m_systemBusConnection; | ||
220 | 55 | }; | ||
221 | 56 | |||
222 | 57 | #endif // NETWORKABOUT_H | ||
223 | 0 | 58 | ||
224 | === modified file 'plugins/about/plugin.cpp' | |||
225 | --- plugins/about/plugin.cpp 2014-07-23 13:37:06 +0000 | |||
226 | +++ plugins/about/plugin.cpp 2014-08-29 18:12:46 +0000 | |||
227 | @@ -23,14 +23,16 @@ | |||
228 | 23 | #include <QtQml/QQmlContext> | 23 | #include <QtQml/QQmlContext> |
229 | 24 | #include "click.h" | 24 | #include "click.h" |
230 | 25 | #include "storageabout.h" | 25 | #include "storageabout.h" |
231 | 26 | #include "networkabout.h" | ||
232 | 26 | 27 | ||
233 | 27 | 28 | ||
234 | 28 | void BackendPlugin::registerTypes(const char *uri) | 29 | void BackendPlugin::registerTypes(const char *uri) |
235 | 29 | { | 30 | { |
236 | 30 | Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.StorageAbout")); | 31 | Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.StorageAbout")); |
238 | 31 | 32 | ||
239 | 32 | qRegisterMetaType<ClickModel::Roles>(); | 33 | qRegisterMetaType<ClickModel::Roles>(); |
240 | 33 | qmlRegisterType<ClickModel>(uri, 1, 0, "ClickRoles"); | 34 | qmlRegisterType<ClickModel>(uri, 1, 0, "ClickRoles"); |
241 | 35 | qmlRegisterType<NetworkAbout>(uri, 1, 0, "NetworkAbout"); | ||
242 | 34 | qmlRegisterType<StorageAbout>(uri, 1, 0, "UbuntuStorageAboutPanel"); | 36 | qmlRegisterType<StorageAbout>(uri, 1, 0, "UbuntuStorageAboutPanel"); |
243 | 35 | } | 37 | } |
244 | 36 | 38 | ||
245 | 37 | 39 | ||
246 | === modified file 'plugins/wifi/AccessPoint.qml' | |||
247 | --- plugins/wifi/AccessPoint.qml 2013-11-28 15:09:15 +0000 | |||
248 | +++ plugins/wifi/AccessPoint.qml 2014-08-29 18:12:46 +0000 | |||
249 | @@ -34,6 +34,11 @@ | |||
250 | 34 | onCheckedChanged: { | 34 | onCheckedChanged: { |
251 | 35 | // Can't rely on binding. Checked is assigned on click. | 35 | // Can't rely on binding. Checked is assigned on click. |
252 | 36 | checkBoxActive.checked = checked; | 36 | checkBoxActive.checked = checked; |
253 | 37 | |||
254 | 38 | // if stack has NetworkDetailsBrief, pop it | ||
255 | 39 | if (pageStack.depth === 3) { | ||
256 | 40 | pageStack.pop(); | ||
257 | 41 | } | ||
258 | 37 | } | 42 | } |
259 | 38 | 43 | ||
260 | 39 | iconName: { | 44 | iconName: { |
261 | @@ -65,4 +70,11 @@ | |||
262 | 65 | accessPoint.activate(); | 70 | accessPoint.activate(); |
263 | 66 | } | 71 | } |
264 | 67 | } | 72 | } |
265 | 73 | progression: checked | ||
266 | 74 | onClicked: { | ||
267 | 75 | if (checked) { | ||
268 | 76 | pageStack.push(Qt.resolvedUrl("NetworkDetailsBrief.qml"), | ||
269 | 77 | {networkName : text, accessPoint: accessPoint}) | ||
270 | 78 | } | ||
271 | 79 | } | ||
272 | 68 | } | 80 | } |
273 | 69 | 81 | ||
274 | === modified file 'plugins/wifi/CMakeLists.txt' | |||
275 | --- plugins/wifi/CMakeLists.txt 2014-06-18 14:16:53 +0000 | |||
276 | +++ plugins/wifi/CMakeLists.txt 2014-08-29 18:12:46 +0000 | |||
277 | @@ -7,6 +7,7 @@ | |||
278 | 7 | IndicatorBase.qml | 7 | IndicatorBase.qml |
279 | 8 | MenuItemFactory.qml | 8 | MenuItemFactory.qml |
280 | 9 | NetworkDetails.qml | 9 | NetworkDetails.qml |
281 | 10 | NetworkDetailsBrief.qml | ||
282 | 10 | OtherNetwork.qml | 11 | OtherNetwork.qml |
283 | 11 | PageComponent.qml | 12 | PageComponent.qml |
284 | 12 | PreviousNetworks.qml | 13 | PreviousNetworks.qml |
285 | 13 | 14 | ||
286 | === added file 'plugins/wifi/NetworkDetailsBrief.qml' | |||
287 | --- plugins/wifi/NetworkDetailsBrief.qml 1970-01-01 00:00:00 +0000 | |||
288 | +++ plugins/wifi/NetworkDetailsBrief.qml 2014-08-29 18:12:46 +0000 | |||
289 | @@ -0,0 +1,79 @@ | |||
290 | 1 | /* | ||
291 | 2 | * This file is part of system-settings | ||
292 | 3 | * | ||
293 | 4 | * Copyright (C) 2014 Canonical Ltd. | ||
294 | 5 | * | ||
295 | 6 | * Contact: Jonas G. Drange <jonas.drange@canonical.com> | ||
296 | 7 | * | ||
297 | 8 | * This program is free software: you can redistribute it and/or modify it | ||
298 | 9 | * under the terms of the GNU General Public License version 3, as published | ||
299 | 10 | * by the Free Software Foundation. | ||
300 | 11 | * | ||
301 | 12 | * This program is distributed in the hope that it will be useful, but | ||
302 | 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
303 | 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
304 | 15 | * PURPOSE. See the GNU General Public License for more details. | ||
305 | 16 | * | ||
306 | 17 | * You should have received a copy of the GNU General Public License along | ||
307 | 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
308 | 19 | */ | ||
309 | 20 | |||
310 | 21 | import QtQuick 2.0 | ||
311 | 22 | import QtQuick.Layouts 1.1 | ||
312 | 23 | import SystemSettings 1.0 | ||
313 | 24 | import Ubuntu.Components 0.1 | ||
314 | 25 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
315 | 26 | import Ubuntu.SystemSettings.Wifi 1.0 | ||
316 | 27 | |||
317 | 28 | ItemPage { | ||
318 | 29 | |||
319 | 30 | property string networkName | ||
320 | 31 | property var accessPoint | ||
321 | 32 | |||
322 | 33 | title: networkName | ||
323 | 34 | |||
324 | 35 | Column { | ||
325 | 36 | |||
326 | 37 | anchors.fill: parent | ||
327 | 38 | |||
328 | 39 | ListItem.Divider {} | ||
329 | 40 | |||
330 | 41 | Button { | ||
331 | 42 | text : i18n.tr("Disconnect") | ||
332 | 43 | anchors { | ||
333 | 44 | left: parent.left | ||
334 | 45 | right: parent.right | ||
335 | 46 | margins: units.gu(2) | ||
336 | 47 | } | ||
337 | 48 | onClicked: { | ||
338 | 49 | if (DbusHelper.deactivateConnection()) { | ||
339 | 50 | accessPoint.checked = false; | ||
340 | 51 | accessPoint.checkedChanged(false) | ||
341 | 52 | } | ||
342 | 53 | |||
343 | 54 | } | ||
344 | 55 | } | ||
345 | 56 | |||
346 | 57 | ListItem.Standard { | ||
347 | 58 | text: i18n.tr("IP address") | ||
348 | 59 | id: addressItem | ||
349 | 60 | control: TextField { | ||
350 | 61 | text: DbusHelper.wifiIp4Address | ||
351 | 62 | readOnly: true | ||
352 | 63 | horizontalAlignment: TextInput.AlignRight | ||
353 | 64 | width: addressItem.width/2 | ||
354 | 65 | persistentSelection: true | ||
355 | 66 | font.pixelSize: units.dp(16) | ||
356 | 67 | font.weight: Font.Light | ||
357 | 68 | font.family: "Ubuntu" | ||
358 | 69 | color: "#AAAAAA" | ||
359 | 70 | maximumLength: 20 | ||
360 | 71 | focus: true | ||
361 | 72 | clip: true | ||
362 | 73 | opacity: 0.9 | ||
363 | 74 | cursorVisible: false | ||
364 | 75 | hasClearButton: false | ||
365 | 76 | } | ||
366 | 77 | } | ||
367 | 78 | } | ||
368 | 79 | } | ||
369 | 0 | 80 | ||
370 | === modified file 'plugins/wifi/wifidbushelper.cpp' | |||
371 | --- plugins/wifi/wifidbushelper.cpp 2014-07-23 13:53:48 +0000 | |||
372 | +++ plugins/wifi/wifidbushelper.cpp 2014-08-29 18:12:46 +0000 | |||
373 | @@ -23,15 +23,20 @@ | |||
374 | 23 | #include <QtDebug> | 23 | #include <QtDebug> |
375 | 24 | #include <QDBusInterface> | 24 | #include <QDBusInterface> |
376 | 25 | #include <algorithm> | 25 | #include <algorithm> |
377 | 26 | #include <arpa/inet.h> | ||
378 | 26 | 27 | ||
379 | 27 | #include "nm_manager_proxy.h" | 28 | #include "nm_manager_proxy.h" |
380 | 28 | #include "nm_settings_proxy.h" | 29 | #include "nm_settings_proxy.h" |
381 | 29 | #include "nm_settings_connection_proxy.h" | 30 | #include "nm_settings_connection_proxy.h" |
382 | 30 | 31 | ||
383 | 32 | #define NM_SERVICE "org.freedesktop.NetworkManager" | ||
384 | 33 | #define NM_PATH "/org/freedesktop/NetworkManager" | ||
385 | 34 | |||
386 | 31 | typedef QMap<QString,QVariantMap> ConfigurationData; | 35 | typedef QMap<QString,QVariantMap> ConfigurationData; |
387 | 32 | Q_DECLARE_METATYPE(ConfigurationData) | 36 | Q_DECLARE_METATYPE(ConfigurationData) |
388 | 33 | 37 | ||
390 | 34 | WifiDbusHelper::WifiDbusHelper(QObject *parent) : QObject(parent) | 38 | WifiDbusHelper::WifiDbusHelper(QObject *parent) : QObject(parent), |
391 | 39 | m_systemBusConnection(QDBusConnection::systemBus()) | ||
392 | 35 | { | 40 | { |
393 | 36 | qDBusRegisterMetaType<ConfigurationData>(); | 41 | qDBusRegisterMetaType<ConfigurationData>(); |
394 | 37 | } | 42 | } |
395 | @@ -43,9 +48,9 @@ | |||
396 | 43 | return; | 48 | return; |
397 | 44 | } | 49 | } |
398 | 45 | 50 | ||
402 | 46 | OrgFreedesktopNetworkManagerInterface mgr("org.freedesktop.NetworkManager", | 51 | OrgFreedesktopNetworkManagerInterface mgr(NM_SERVICE, |
403 | 47 | "/org/freedesktop/NetworkManager", | 52 | NM_PATH, |
404 | 48 | QDBusConnection::systemBus()); | 53 | m_systemBusConnection); |
405 | 49 | 54 | ||
406 | 50 | QMap<QString, QVariantMap> configuration; | 55 | QMap<QString, QVariantMap> configuration; |
407 | 51 | 56 | ||
408 | @@ -115,6 +120,53 @@ | |||
409 | 115 | tmp); | 120 | tmp); |
410 | 116 | } | 121 | } |
411 | 117 | 122 | ||
412 | 123 | QString WifiDbusHelper::getWifiIpAddress() | ||
413 | 124 | { | ||
414 | 125 | OrgFreedesktopNetworkManagerInterface mgr(NM_SERVICE, | ||
415 | 126 | NM_PATH, | ||
416 | 127 | m_systemBusConnection); | ||
417 | 128 | |||
418 | 129 | // find the first wlan adapter for now | ||
419 | 130 | auto reply1 = mgr.GetDevices(); | ||
420 | 131 | reply1.waitForFinished(); | ||
421 | 132 | if(!reply1.isValid()) { | ||
422 | 133 | qWarning() << "Could not get network device: " << reply1.error().message() << "\n"; | ||
423 | 134 | return QString(); | ||
424 | 135 | } | ||
425 | 136 | auto devices = reply1.value(); | ||
426 | 137 | int ip4addr; | ||
427 | 138 | |||
428 | 139 | QDBusObjectPath dev; | ||
429 | 140 | for (const auto &d : devices) { | ||
430 | 141 | QDBusInterface iface("org.freedesktop.NetworkManager", | ||
431 | 142 | d.path(), | ||
432 | 143 | "org.freedesktop.NetworkManager.Device", | ||
433 | 144 | m_systemBusConnection); | ||
434 | 145 | |||
435 | 146 | auto type_v = iface.property("DeviceType"); | ||
436 | 147 | if (type_v.toUInt() == 2 /* NM_DEVICE_TYPE_WIFI */) { | ||
437 | 148 | ip4addr = iface.property("Ip4Address").toInt(); | ||
438 | 149 | dev = d; | ||
439 | 150 | break; | ||
440 | 151 | } | ||
441 | 152 | } | ||
442 | 153 | |||
443 | 154 | if (dev.path().isEmpty()) { | ||
444 | 155 | // didn't find a wifi device | ||
445 | 156 | return QString(); | ||
446 | 157 | } | ||
447 | 158 | |||
448 | 159 | if (!ip4addr) { | ||
449 | 160 | // no ip address | ||
450 | 161 | return QString(); | ||
451 | 162 | } | ||
452 | 163 | |||
453 | 164 | |||
454 | 165 | struct in_addr ip_addr; | ||
455 | 166 | ip_addr.s_addr = ip4addr; | ||
456 | 167 | return QString(inet_ntoa(ip_addr)); | ||
457 | 168 | } | ||
458 | 169 | |||
459 | 118 | struct Network : public QObject | 170 | struct Network : public QObject |
460 | 119 | { | 171 | { |
461 | 120 | struct DontCare : public std::exception {}; | 172 | struct DontCare : public std::exception {}; |
462 | @@ -316,3 +368,51 @@ | |||
463 | 316 | qWarning() << "Error forgetting network: " << reply.error().message() << "\n"; | 368 | qWarning() << "Error forgetting network: " << reply.error().message() << "\n"; |
464 | 317 | } | 369 | } |
465 | 318 | } | 370 | } |
466 | 371 | |||
467 | 372 | bool WifiDbusHelper::deactivateConnection() { | ||
468 | 373 | OrgFreedesktopNetworkManagerInterface mgr(NM_SERVICE, | ||
469 | 374 | NM_PATH, | ||
470 | 375 | m_systemBusConnection); | ||
471 | 376 | // find the first wlan adapter for now | ||
472 | 377 | auto reply1 = mgr.GetDevices(); | ||
473 | 378 | reply1.waitForFinished(); | ||
474 | 379 | if(!reply1.isValid()) { | ||
475 | 380 | qWarning() << "deactivateConnection: Could not get network device: " << reply1.error().message() << "\n"; | ||
476 | 381 | return false; | ||
477 | 382 | } | ||
478 | 383 | auto devices = reply1.value(); | ||
479 | 384 | |||
480 | 385 | QDBusObjectPath activeConnection; | ||
481 | 386 | QDBusObjectPath dev; | ||
482 | 387 | for (const auto &d : devices) { | ||
483 | 388 | QDBusInterface iface(NM_SERVICE, | ||
484 | 389 | d.path(), | ||
485 | 390 | "org.freedesktop.NetworkManager.Device", | ||
486 | 391 | m_systemBusConnection); | ||
487 | 392 | |||
488 | 393 | auto type_v = iface.property("DeviceType"); | ||
489 | 394 | if (type_v.toUInt() == 2 /* NM_DEVICE_TYPE_WIFI */) { | ||
490 | 395 | activeConnection = qvariant_cast<QDBusObjectPath>(iface.property("ActiveConnection")); | ||
491 | 396 | dev = d; | ||
492 | 397 | break; | ||
493 | 398 | } | ||
494 | 399 | } | ||
495 | 400 | |||
496 | 401 | if (dev.path().isEmpty()) { | ||
497 | 402 | // didn't find a wifi device | ||
498 | 403 | return false; | ||
499 | 404 | } | ||
500 | 405 | |||
501 | 406 | if (activeConnection.path().isEmpty()) { | ||
502 | 407 | // no active connection | ||
503 | 408 | return false; | ||
504 | 409 | } | ||
505 | 410 | |||
506 | 411 | auto reply = mgr.DeactivateConnection(activeConnection); | ||
507 | 412 | reply.waitForFinished(); | ||
508 | 413 | if(!reply.isValid()) { | ||
509 | 414 | qWarning() << "Error deactivating connection: " << reply.error().message() << "\n"; | ||
510 | 415 | return false; | ||
511 | 416 | } | ||
512 | 417 | return true; | ||
513 | 418 | } | ||
514 | 319 | 419 | ||
515 | === modified file 'plugins/wifi/wifidbushelper.h' | |||
516 | --- plugins/wifi/wifidbushelper.h 2014-07-23 13:53:48 +0000 | |||
517 | +++ plugins/wifi/wifidbushelper.h 2014-08-29 18:12:46 +0000 | |||
518 | @@ -21,6 +21,7 @@ | |||
519 | 21 | #define WIFI_DBUS_HELPER | 21 | #define WIFI_DBUS_HELPER |
520 | 22 | 22 | ||
521 | 23 | #include <QObject> | 23 | #include <QObject> |
522 | 24 | #include <QtDBus> | ||
523 | 24 | 25 | ||
524 | 25 | /** | 26 | /** |
525 | 26 | * For sending specific dbus messages from QML. | 27 | * For sending specific dbus messages from QML. |
526 | @@ -28,6 +29,9 @@ | |||
527 | 28 | 29 | ||
528 | 29 | class WifiDbusHelper final : public QObject { | 30 | class WifiDbusHelper final : public QObject { |
529 | 30 | Q_OBJECT | 31 | Q_OBJECT |
530 | 32 | Q_PROPERTY( QString wifiIp4Address | ||
531 | 33 | READ getWifiIpAddress | ||
532 | 34 | NOTIFY wifiIp4AddressChanged) | ||
533 | 31 | 35 | ||
534 | 32 | public: | 36 | public: |
535 | 33 | explicit WifiDbusHelper(QObject *parent = nullptr); | 37 | explicit WifiDbusHelper(QObject *parent = nullptr); |
536 | @@ -36,7 +40,14 @@ | |||
537 | 36 | Q_INVOKABLE void connect(QString ssid, int security, QString password); | 40 | Q_INVOKABLE void connect(QString ssid, int security, QString password); |
538 | 37 | Q_INVOKABLE QList<QStringList> getPreviouslyConnectedWifiNetworks(); | 41 | Q_INVOKABLE QList<QStringList> getPreviouslyConnectedWifiNetworks(); |
539 | 38 | Q_INVOKABLE void forgetConnection(const QString dbus_path); | 42 | Q_INVOKABLE void forgetConnection(const QString dbus_path); |
541 | 39 | 43 | Q_INVOKABLE bool deactivateConnection(); | |
542 | 44 | |||
543 | 45 | Q_SIGNALS: | ||
544 | 46 | void wifiIp4AddressChanged(QString wifiIp4Address); | ||
545 | 47 | |||
546 | 48 | private: | ||
547 | 49 | QDBusConnection m_systemBusConnection; | ||
548 | 50 | QString getWifiIpAddress(); | ||
549 | 40 | }; | 51 | }; |
550 | 41 | 52 | ||
551 | 42 | 53 |
PASSED: Continuous integration, rev:947 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/1322/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/4155 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 3166 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- i386-ci/ 514 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/3983 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/5407 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/5407/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 12250 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 2588 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/3453 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/3453/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/1322/ rebuild
http://