Warning, /plasma/plasma-mobile/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com> 0003 * SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.1 0009 import QtQuick.Layouts 1.1 0010 0011 import org.kde.kirigami 2.12 as Kirigami 0012 0013 import org.kde.plasma.core as PlasmaCore 0014 import org.kde.plasma.private.nanoshell 2.0 as NanoShell 0015 import org.kde.plasma.private.mobileshell as MobileShell 0016 import org.kde.plasma.private.mobileshell.state as MobileShellState 0017 import org.kde.plasma.components 3.0 as PlasmaComponents 0018 0019 MobileShell.BaseItem { 0020 id: root 0021 0022 required property bool restrictedPermissions 0023 0024 // Model interface 0025 required property string text 0026 required property string status 0027 required property string icon 0028 required property bool enabled 0029 required property string settingsCommand 0030 required property var toggleFunction 0031 0032 signal closeRequested() 0033 0034 // set by children 0035 property var iconItem 0036 0037 readonly property color enabledButtonBorderColor: Qt.darker(Kirigami.Theme.highlightColor, 1.25) 0038 readonly property color disabledButtonBorderColor: Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.textColor, Kirigami.Theme.backgroundColor, 0.75) 0039 readonly property color enabledButtonColor: Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.highlightColor, Kirigami.Theme.backgroundColor, 0.6) 0040 readonly property color enabledButtonPressedColor: Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.highlightColor, Kirigami.Theme.backgroundColor, 0.4); 0041 readonly property color disabledButtonColor: Kirigami.Theme.backgroundColor 0042 readonly property color disabledButtonPressedColor: Qt.darker(disabledButtonColor, 1.1) 0043 0044 // scale animation on press 0045 property real zoomScale: 1 0046 Behavior on zoomScale { 0047 NumberAnimation { 0048 duration: 200 0049 easing.type: Easing.OutExpo 0050 } 0051 } 0052 0053 transform: Scale { 0054 origin.x: root.width / 2; 0055 origin.y: root.height / 2; 0056 xScale: root.zoomScale 0057 yScale: root.zoomScale 0058 } 0059 0060 function delegateClick() { 0061 if (root.toggle) { 0062 root.toggle(); 0063 } else if (root.toggleFunction) { 0064 root.toggleFunction(); 0065 } else if (root.settingsCommand && !root.restrictedPermissions) { 0066 closeRequested(); 0067 MobileShellState.ShellDBusClient.openAppLaunchAnimation( 0068 root.icon, 0069 root.text, 0070 iconItem.Kirigami.ScenePosition.x + iconItem.width/2, 0071 iconItem.Kirigami.ScenePosition.y + iconItem.height/2, 0072 Math.min(iconItem.width, iconItem.height)) 0073 MobileShell.ShellUtil.executeCommand(root.settingsCommand); 0074 } 0075 } 0076 0077 function delegatePressAndHold() { 0078 if (root.settingsCommand && !root.restrictedPermissions) { 0079 closeRequested(); 0080 MobileShellState.ShellDBusClient.openAppLaunchAnimation( 0081 root.icon, 0082 root.text, 0083 iconItem.Kirigami.ScenePosition.x + iconItem.width/2, 0084 iconItem.Kirigami.ScenePosition.y + iconItem.height/2, 0085 Math.min(iconItem.width, iconItem.height)) 0086 MobileShell.ShellUtil.executeCommand(root.settingsCommand); 0087 } else if (root.toggleFunction) { 0088 root.toggleFunction(); 0089 } 0090 } 0091 }