Merge lp:~rsalveti/ubuntu-system-settings/bluetooth-device-visibility-tweak-14.09 into lp:ubuntu-system-settings/rtm-14.09

Proposed by Ricardo Salveti
Status: Merged
Approved by: Ken VanDine
Approved revision: 1000
Merged at revision: 1000
Proposed branch: lp:~rsalveti/ubuntu-system-settings/bluetooth-device-visibility-tweak-14.09
Merge into: lp:ubuntu-system-settings/rtm-14.09
Diff against target: 75 lines (+25/-1)
4 files modified
plugins/bluetooth/PageComponent.qml (+18/-0)
plugins/bluetooth/bluetooth.cpp (+5/-0)
plugins/bluetooth/bluetooth.h (+1/-0)
plugins/bluetooth/devicemodel.h (+1/-1)
To merge this branch: bzr merge lp:~rsalveti/ubuntu-system-settings/bluetooth-device-visibility-tweak-14.09
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Ricardo Mendoza (community) Approve
Review via email: mp+252183@code.launchpad.net

Commit message

bluetooth: disable device visiblity when switching out, that way it's not
staying on if the settings are closed from the switcher or if the user switch
to another software

Description of the change

bluetooth: disable device visiblity when switching out, that way it's not
staying on if the settings are closed from the switcher or if the user switch
to another software

To post a comment you must log in.
Revision history for this message
Ricardo Mendoza (ricmm) wrote :

Code LGTM !

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good, thanks!

review: Approve
1001. By Ricardo Salveti

We don't have Qt.ApplicationSuspended with RTM's Qt, so use application.active instead

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/bluetooth/PageComponent.qml'
2--- plugins/bluetooth/PageComponent.qml 2014-11-18 19:37:24 +0000
3+++ plugins/bluetooth/PageComponent.qml 2015-03-06 23:52:32 +0000
4@@ -33,6 +33,24 @@
5
6 UbuntuBluetoothPanel { id: backend }
7
8+ Timer {
9+ id: discoverableTimer
10+ onTriggered: backend.trySetDiscoverable(true)
11+ }
12+
13+ /* Disable bt visiblity when switching out */
14+ Connections {
15+ target: Qt.application
16+ onActiveChanged: {
17+ if (Qt.application.active === false) {
18+ backend.trySetDiscoverable(false)
19+ }
20+ else {
21+ discoverableTimer.start()
22+ }
23+ }
24+ }
25+
26 Component {
27 id: confirmPasskeyDialog
28 ConfirmPasskeyDialog { }
29
30=== modified file 'plugins/bluetooth/bluetooth.cpp'
31--- plugins/bluetooth/bluetooth.cpp 2015-02-27 05:53:33 +0000
32+++ plugins/bluetooth/bluetooth.cpp 2015-03-06 23:52:32 +0000
33@@ -88,6 +88,11 @@
34 m_devices.stopDiscovery();
35 }
36
37+void Bluetooth::trySetDiscoverable(bool discoverable)
38+{
39+ m_devices.trySetDiscoverable(discoverable);
40+}
41+
42 bool Bluetooth::isSupportedType(const int type)
43 {
44 switch((Device::Type)type) {
45
46=== modified file 'plugins/bluetooth/bluetooth.h'
47--- plugins/bluetooth/bluetooth.h 2014-08-28 07:22:28 +0000
48+++ plugins/bluetooth/bluetooth.h 2015-03-06 23:52:32 +0000
49@@ -82,6 +82,7 @@
50 Q_INVOKABLE void startDiscovery();
51 Q_INVOKABLE void stopDiscovery();
52 Q_INVOKABLE static bool isSupportedType(const int type);
53+ Q_INVOKABLE void trySetDiscoverable(bool discoverable);
54
55 public:
56 Agent * getAgent();
57
58=== modified file 'plugins/bluetooth/devicemodel.h'
59--- plugins/bluetooth/devicemodel.h 2015-02-27 05:53:33 +0000
60+++ plugins/bluetooth/devicemodel.h 2015-03-06 23:52:32 +0000
61@@ -74,6 +74,7 @@
62 void stopDiscovery();
63 void startDiscovery();
64 void toggleDiscovery();
65+ void trySetDiscoverable(bool discoverable);
66
67 Q_SIGNALS:
68 void poweredChanged(bool powered);
69@@ -96,7 +97,6 @@
70 QTimer m_timer;
71 QTimer m_discoverableTimer;
72 void restartTimer();
73- void trySetDiscoverable(bool discoverable);
74 void setDiscoverable(bool discoverable);
75 void setPowered(bool powered);
76

Subscribers

People subscribed via source and target branches