Merge lp:~seb128/ubuntu-system-settings/bluetooth-working-pairing-only into lp:ubuntu-system-settings

Proposed by Sebastien Bacher on 2015-02-10
Status: Merged
Approved by: Ken VanDine on 2015-02-20
Approved revision: 1300
Merged at revision: 1328
Proposed branch: lp:~seb128/ubuntu-system-settings/bluetooth-working-pairing-only
Merge into: lp:ubuntu-system-settings
Diff against target: 78 lines (+28/-0)
4 files modified
plugins/bluetooth/PageComponent.qml (+1/-0)
plugins/bluetooth/bluetooth.cpp (+18/-0)
plugins/bluetooth/bluetooth.h (+1/-0)
tests/plugins/bluetooth/tst_bluetooth.cpp (+8/-0)
To merge this branch: bzr merge lp:~seb128/ubuntu-system-settings/bluetooth-working-pairing-only
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre 2015-02-20 Approve on 2015-02-20
PS Jenkins bot continuous-integration Needs Fixing on 2015-02-10
Ubuntu Touch System Settings 2015-02-10 Pending
Review via email: mp+249172@code.launchpad.net

Commit Message

bluetooth: disable pairing for unsupported device types, the current UI
let users click on the button but doesn't do anything out of closing
the page, better to show the button as unactive instead

Description of the Change

bluetooth: disable pairing for unsupported device types, the current UI
let users click on the button but doesn't do anything out of closing
the page, better to show the button as unactive instead

that sort of revert https://code.launchpad.net/~mathieu-tl/ubuntu-system-settings/unbreak-hid/+merge/243592 but adding the new types to not add the issue the commit was fixing back

To post a comment you must log in.
Mathieu Trudel-Lapierre (cyphermox) wrote :

It's fine, let's just hope we're not forgetting some other device we want to pair with real soon, but those are indeed the devices currently expected to be working/supported.

review: Approve

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 2015-02-04 16:32:54 +0000
3+++ plugins/bluetooth/PageComponent.qml 2015-02-10 11:27:22 +0000
4@@ -450,6 +450,7 @@
5 pageStack.pop();
6 }
7 visible: backend.selectedDevice ? true : false
8+ enabled: backend.isSupportedType(backend.selectedDevice.type)
9 }
10 }
11 ListItem.SingleControl {
12
13=== modified file 'plugins/bluetooth/bluetooth.cpp'
14--- plugins/bluetooth/bluetooth.cpp 2014-12-12 21:00:02 +0000
15+++ plugins/bluetooth/bluetooth.cpp 2015-02-10 11:27:22 +0000
16@@ -88,6 +88,24 @@
17 m_devices.stopDiscovery();
18 }
19
20+bool Bluetooth::isSupportedType(const int type)
21+{
22+ switch((Device::Type)type) {
23+
24+ case Device::Type::Headset:
25+ case Device::Type::Headphones:
26+ case Device::Type::Speakers:
27+ case Device::Type::Carkit:
28+ case Device::Type::OtherAudio:
29+ case Device::Type::Keyboard:
30+ case Device::Type::Mouse:
31+ return true;
32+
33+ default:
34+ return false;
35+ }
36+}
37+
38 /***
39 ****
40 ***/
41
42=== modified file 'plugins/bluetooth/bluetooth.h'
43--- plugins/bluetooth/bluetooth.h 2014-12-03 20:34:39 +0000
44+++ plugins/bluetooth/bluetooth.h 2015-02-10 11:27:22 +0000
45@@ -82,6 +82,7 @@
46 Q_INVOKABLE void toggleDiscovery();
47 Q_INVOKABLE void startDiscovery();
48 Q_INVOKABLE void stopDiscovery();
49+ Q_INVOKABLE static bool isSupportedType(const int type);
50
51 public:
52 Agent * getAgent();
53
54=== modified file 'tests/plugins/bluetooth/tst_bluetooth.cpp'
55--- tests/plugins/bluetooth/tst_bluetooth.cpp 2014-12-12 21:00:02 +0000
56+++ tests/plugins/bluetooth/tst_bluetooth.cpp 2015-02-10 11:27:22 +0000
57@@ -42,6 +42,7 @@
58 void testStartDiscovery();
59 void testStopDiscovery();
60 void testToggleDiscovery();
61+ void testIsSupportedType();
62 void testIsDiscovering();
63 void cleanup();
64
65@@ -141,6 +142,13 @@
66 QCOMPARE(result.toBool(), false);
67 }
68
69+void BluetoothTest::testIsSupportedType()
70+{
71+ QCOMPARE(Bluetooth::isSupportedType(Device::Type::Headset), true);
72+ QCOMPARE(Bluetooth::isSupportedType(Device::Type::Keyboard), true);
73+ QCOMPARE(Bluetooth::isSupportedType(Device::Type::Tablet), false);
74+}
75+
76 void BluetoothTest::testIsDiscovering()
77 {
78 m_bluetooth->stopDiscovery();

Subscribers

People subscribed via source and target branches