Commit 45d3614a authored by David Redondo's avatar David Redondo 🏎
Browse files

Revert "[applet] Port to PlasmaExtras.SwitchButton"

This reverts commit 6d6ffa93
parent 6d6ffa93
......@@ -6,7 +6,7 @@ set(PROJECT_VERSION "5.19.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.14.0")
set(KF5_MIN_VERSION "5.73.0")
set(KF5_MIN_VERSION "5.71.0")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED On)
......
/*
Copyright 2013-2017 Jan Grulich <jgrulich@redhat.com>
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 <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
id: switchButton
property alias icon: switchButtonIcon.source
property alias checked: switchButtonCheckbox.checked
property alias enabled: switchButtonCheckbox.enabled
property alias tooltip: itemTooltip.text
signal clicked
height: Math.max(switchButtonCheckbox.height, switchButtonIcon.height)
width: switchButtonCheckbox.width + switchButtonIcon.width + units.smallSpacing * 3
PlasmaComponents3.CheckBox {
id: switchButtonCheckbox
anchors {
left: parent.left
leftMargin: units.smallSpacing
}
onClicked: {
switchButton.clicked()
}
}
PlasmaCore.IconItem {
id: switchButtonIcon
anchors {
left: switchButtonCheckbox.right
// Checkbox bug adds internally a smallSpacing on the right. Doubling the effective spacing here.
leftMargin: units.smallSpacing
verticalCenter: parent.verticalCenter
}
width: units.iconSizes.smallMedium
height: units.iconSizes.smallMedium
}
PlasmaComponents3.ToolTip {
id: itemTooltip
}
}
......@@ -21,7 +21,6 @@
import QtQuick 2.2
import QtQuick.Layouts 1.2
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.kquickcontrolsaddons 2.0
......@@ -70,30 +69,30 @@ ColumnLayout {
RowLayout {
spacing: units.smallSpacing
PlasmaExtras.SwitchButton {
SwitchButton {
id: wifiSwitchButton
checked: enabled && enabledConnections.wirelessEnabled
enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled
tooltipText: i18n("Enable Wi-Fi")
tooltip: i18n("Enable Wi-Fi")
icon: enabled ? "network-wireless-on" : "network-wireless-off"
visible: availableDevices.wirelessDeviceAvailable
onToggled: {
onClicked: {
handler.enableWireless(checked);
}
}
PlasmaExtras.SwitchButton {
SwitchButton {
id: wwanSwitchButton
checked: enabled && enabledConnections.wwanEnabled
enabled: enabledConnections.wwanHwEnabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled
tooltipText: i18n("Enable mobile network")
tooltip: i18n("Enable mobile network")
icon: enabled ? "network-mobile-on" : "network-mobile-off"
visible: availableDevices.modemDeviceAvailable
onToggled: {
onClicked: {
handler.enableWwan(checked);
}
}
......@@ -103,20 +102,20 @@ ColumnLayout {
Layout.preferredWidth: units.smallSpacing * 2
}
PlasmaExtras.SwitchButton {
SwitchButton {
id: planeModeSwitchButton
property bool initialized: false
property bool airplaneModeEnabled: false
checked: airplaneModeEnabled
tooltipText: airplaneModeEnabled ?
xi18nc("@info", "Disable airplane mode<nl/><nl/>This will enable Wi-Fi and Bluetooth") :
xi18nc("@info", "Enable airplane mode<nl/><nl/>This will disable Wi-Fi and Bluetooth")
tooltip: airplaneModeEnabled ?
xi18nc("@info", "Disable airplane mode<nl/><nl/>This will enable Wi-Fi and Bluetooth") :
xi18nc("@info", "Enable airplane mode<nl/><nl/>This will disable Wi-Fi and Bluetooth")
icon: airplaneModeEnabled ? "network-flightmode-on" : "network-flightmode-off"
visible: availableDevices.modemDeviceAvailable || availableDevices.wirelessDeviceAvailable
onToggled: {
onClicked: {
handler.enableAirplaneMode(checked);
airplaneModeEnabled = !airplaneModeEnabled;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment