diff --git a/src/applet/package/contents/ui/SwitchButton.qml b/src/applet/package/contents/ui/SwitchButton.qml index 529b23ca..99e4296c 100644 --- a/src/applet/package/contents/ui/SwitchButton.qml +++ b/src/applet/package/contents/ui/SwitchButton.qml @@ -1,68 +1,69 @@ /* Copyright 2014 Jan Grulich Copyright 2014-2015 David Rosca This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ import QtQuick 2.2 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents Item { id: switchButton property alias icon: switchButtonIcon.source property alias checked: switchButtonCheckbox.checked property alias enabled: switchButtonCheckbox.enabled + property alias tooltip: switchButtonCheckbox.tooltip signal clicked height: switchButtonCheckbox.height + Math.round(units.gridUnit / 2) width: switchButtonCheckbox.width + switchButtonIcon.width + units.gridUnit PlasmaComponents.CheckBox { id: switchButtonCheckbox anchors { left: parent.left leftMargin: units.smallSpacing verticalCenter: parent.verticalCenter } MouseArea { anchors.fill: parent onClicked: { if (switchButton.enabled) { switchButton.clicked(); } } } } PlasmaCore.IconItem { id: switchButtonIcon enabled: switchButtonCheckbox.checked anchors { left: switchButtonCheckbox.right top: switchButtonCheckbox.top bottom: switchButtonCheckbox.bottom } width: height } } diff --git a/src/applet/package/contents/ui/Toolbar.qml b/src/applet/package/contents/ui/Toolbar.qml index 7a6a3586..1d11df60 100644 --- a/src/applet/package/contents/ui/Toolbar.qml +++ b/src/applet/package/contents/ui/Toolbar.qml @@ -1,96 +1,97 @@ /* Copyright 2013-2014 Jan Grulich Copyright 2014-2015 David Rosca This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ import QtQuick 2.2 import org.kde.kquickcontrolsaddons 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.private.bluetooth 1.0 as PlasmaBt Item { id: toolbar height: btSwitchButton.height PlasmaCore.Svg { id: lineSvg imagePath: "widgets/line" } SwitchButton { id: btSwitchButton anchors { left: parent.left verticalCenter: parent.verticalCenter } checked: btManager.bluetoothOperational enabled: btManager.bluetoothBlocked || btManager.adapters.length icon: "preferences-system-bluetooth" + tooltip: i18n("Enable Bluetooth") onClicked: toggleBluetooth() } Row { id: rightButtons spacing: units.smallSpacing anchors { right: parent.right rightMargin: Math.round(units.gridUnit / 2) verticalCenter: parent.verticalCenter } PlasmaComponents.ToolButton { id: addDeviceButton iconSource: "list-add" tooltip: i18n("Add New Device...") onClicked: { PlasmaBt.LaunchApp.runCommand("bluedevil-wizard"); } } PlasmaComponents.ToolButton { id: openSettingsButton iconSource: "configure" tooltip: i18n("Configure Bluetooth...") onClicked: { KCMShell.open(["bluedevildevices", "bluedeviladapters", "bluedevilglobal"]); } } } function toggleBluetooth() { var enable = !btManager.bluetoothOperational; btManager.bluetoothBlocked = !enable; for (var i = 0; i < btManager.adapters.length; ++i) { var adapter = btManager.adapters[i]; adapter.powered = enable; } } }