This file is indexed.

/usr/share/ubuntu/settings/system/qml-plugins/bluetooth/PageComponent.qml is in ubuntu-system-settings 0.1+14.04.20140411-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*
 * This file is part of ubuntu-system-settings
 *
 * Copyright (C) 2013 Canonical Ltd.
 *
 * Contact: Charles Kerr <charles.kerr@canonical.com>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 3, as published
 * by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QMenuModel 0.1
import QtQuick 2.0
import SystemSettings 1.0
import Ubuntu.Components 0.1
import Ubuntu.Components.Popups 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import Ubuntu.SystemSettings.Bluetooth 1.0


ItemPage {
    id: root
    UbuntuBluetoothPanel { id: backend }

    Component {
        id: confirmPasskeyDialog
        ConfirmPasskeyDialog { }
    }

    Component {
        id: providePasskeyDialog
        ProvidePasskeyDialog { }
    }

    Component {
        id: providePinCodeDialog
        ProvidePinCodeDialog { }
    }

    Connections {
        target: backend.agent
        onPasskeyConfirmationNeeded: {
            var popup = PopupUtils.open(confirmPasskeyDialog, root, {passkey: passkey, name: device.name})
            popup.canceled.connect(function() {target.confirmPasskey(tag, false)})
            popup.confirmed.connect(function() {target.confirmPasskey(tag, true)})
        }
        onPasskeyNeeded: {
            var popup = PopupUtils.open(providePasskeyDialog, root, {name: device.name})
            popup.canceled.connect(function() {target.providePasskey(tag, false, 0)})
            popup.provided.connect(function(passkey) {target.providePasskey(tag, true, passkey)})
        }
        onPinCodeNeeded: {
            var popup = PopupUtils.open(providePinCodeDialog, root, {name: device.name})
            popup.canceled.connect(function() {target.providePinCode(tag, false, "")})
            popup.provided.connect(function(pinCode) {target.providePinCode(tag, true, pinCode)})
        }
    }

    function getDisplayName(connection, displayName) {
      if (connection == Device.Connecting)
        // TRANSLATORS: %1 is the display name of the device that is connecting
        return i18n.tr("%1 (Connecting…)").arg(displayName);
      else if (connection == Device.Disconnecting)
        // TRANSLATORS: %1 is the display name of the device that is disconnecting
        return i18n.tr("%1 (Disconnecting…)").arg(displayName);
      else
        return displayName;
    }

    function getTypeString(type) {
        switch (type) {
        case Device.Computer:   return i18n.tr("Computer");
        case Device.Phone:      return i18n.tr("Phone");
        case Device.Modem:      return i18n.tr("Modem");
        case Device.Network:    return i18n.tr("Network");
        case Device.Headset:    return i18n.tr("Headset");
        case Device.Headphones: return i18n.tr("Headphones");
        case Device.Video:      return i18n.tr("Video");
        case Device.OtherAudio: return i18n.tr("Other Audio");
        case Device.Joypad:     return i18n.tr("Joypad");
        case Device.Keyboard:   return i18n.tr("Keyboard");
        case Device.Tablet:     return i18n.tr("Tablet");
        case Device.Mouse:      return i18n.tr("Mouse");
        case Device.Printer:    return i18n.tr("Printer");
        case Device.Camera:     return i18n.tr("Camera");
        default:                return i18n.tr("Other");
        }
    }

    function getSignalString(strength) {
        switch (strength) {
        case Device.Excellent: return i18n.tr("Excellent");
        case Device.Good:      return i18n.tr("Good");
        case Device.Fair:      return i18n.tr("Fair");
        case Device.Poor:      return i18n.tr("Poor");
        default:               return i18n.tr("None");
        }
    }

    Page {
        id: mainPage
        title: i18n.tr("Bluetooth")
        visible: true
        anchors.fill: parent

        Column {
            anchors.fill: parent

            QDBusActionGroup {
                id: bluetoothActionGroup
                busType: DBus.SessionBus
                busName: "com.canonical.indicator.bluetooth"
                objectPath: "/com/canonical/indicator/bluetooth"

                property variant enabled: action("bluetooth-enabled")

                Component.onCompleted: start()
            }

            ListItem.Standard {
                text: i18n.tr("Bluetooth")
                control: Switch {
                    id: btSwitch
                    // Cannot use onCheckedChanged as this triggers a loop
                    onClicked: bluetoothActionGroup.enabled.activate()
                }
                Component.onCompleted: clicked.connect(btSwitch.clicked)
            }

            Binding {
                target: btSwitch
                property: "checked"
                value: bluetoothActionGroup.enabled.state
            }

            //  Connnected Headset(s)

            ListItem.Standard {
                id: connectedHeader
                text: i18n.tr("Connected headset:")

                enabled: bluetoothActionGroup.enabled
                visible: connectedList.visible
            }

            ListView {
                id: connectedList
                width: parent.width
                height: connectedHeader.height * count

                visible: bluetoothActionGroup.enabled && (count > 0)

                model: backend.connectedHeadsets
                delegate: ListItem.Standard {
                    iconName: iconName
                    text: getDisplayName(connection, displayName)
                    onClicked: {
                        backend.setSelectedDevice(addressName);
                        pageStack.push(connectedHeadsetPage);
                    }
                }
            }

            //  Disconnnected Headset(s)

            ListItem.Standard {
                id: disconnectedHeader
                text: connectedList.visible ? i18n.tr("Connect a different headset:") : i18n.tr("Connect a headset:")
                enabled: bluetoothActionGroup.enabled
                control: ActivityIndicator {
                    visible: backend.discovering
                    running: true
                }
            }

            ListView {
                id: disconnectedList
                width: parent.width
                height: disconnectedHeader.height * count

                visible: bluetoothActionGroup.enabled && (count > 0)

                model: backend.disconnectedHeadsets
                delegate: ListItem.Standard {
                    iconName: iconName
                    text: getDisplayName(connection, displayName)
                    onClicked: {
                        backend.connectHeadset(addressName);
                    }
                }
            }
            ListItem.Standard {
                id: disconnectedNone
                text: i18n.tr("None detected")
                visible: !disconnectedList.visible
                enabled: !backend.discovering
            }
        }
    }

    Page {
        id: connectedHeadsetPage
        title: backend.selectedDevice ? backend.selectedDevice.name : i18n.tr("None")
        visible: false

        Column {
            anchors.fill: parent

            ListItem.SingleValue {
                text: i18n.tr("Name")
                value: backend.selectedDevice ? backend.selectedDevice.name : i18n.tr("None")
            }
            ListItem.SingleValue {
                text: i18n.tr("Type")
                value: getTypeString(backend.selectedDevice ? backend.selectedDevice.type : Device.OTHER)
            }
            ListItem.SingleValue {
                text: i18n.tr("Signal Strength")
                value: getSignalString(backend.selectedDevice ? backend.selectedDevice.strength : Device.None)
            }
            ListItem.SingleControl {
                control: Button {
                    text: i18n.tr("Disconnect")
                    width: parent.width - units.gu(8)
                    onClicked: {
                        backend.disconnectHeadset();
                        pageStack.pop();
                    }
                }
            }
        }
    }
}