Warning, /plasma/plasma-mobile/lookandfeel/contents/logout/Logout.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * SPDX-FileCopyrightText: 2020 Linus Jahn <lnj@kaidan.im> 0004 * SPDX-FileCopyrightText: 2020 Marco Martin <mart@kde.org 0005 * SPDX-FileCopyrightText: 2022 Seshan Ravikumar <seshan10@me.com> 0006 * 0007 * SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 import QtQuick 2.12 0011 import QtQuick.Layouts 1.12 0012 import QtQuick.Controls 2.8 as Controls 0013 0014 import org.kde.kirigami 2.20 as Kirigami 0015 import org.kde.coreaddons 1.0 as KCoreAddons 0016 0017 import org.kde.plasma.private.sessions 2.0 0018 0019 Item { 0020 id: root 0021 0022 Kirigami.Theme.colorSet: Kirigami.Theme.Complementary 0023 Kirigami.Theme.inherit: false 0024 signal logoutRequested() 0025 signal haltRequested() 0026 signal suspendRequested(int spdMethod) 0027 signal rebootRequested() 0028 signal rebootRequested2(int opt) 0029 signal cancelRequested() 0030 signal lockScreenRequested() 0031 0032 Controls.Action { 0033 onTriggered: root.cancelRequested() 0034 shortcut: "Escape" 0035 } 0036 0037 Rectangle { 0038 id: blackOverlay 0039 anchors.fill: parent 0040 color: "black" 0041 opacity: 0 0042 z: opacity > 0 ? 1 : 0 0043 } 0044 0045 Rectangle { 0046 id: background 0047 anchors.fill: parent 0048 color: Kirigami.Theme.backgroundColor 0049 opacity: 0 0050 } 0051 0052 MouseArea { 0053 anchors.fill: parent 0054 onClicked: { 0055 closeAnim.execute(root.cancelRequested); 0056 } 0057 } 0058 0059 Component.onCompleted: openAnim.restart() 0060 onVisibleChanged: { 0061 if (visible) { 0062 openAnim.restart() 0063 } 0064 } 0065 0066 ParallelAnimation { 0067 id: openAnim 0068 running: true 0069 OpacityAnimator { 0070 target: buttons 0071 from: 0 0072 to: 1 0073 duration: Kirigami.Units.longDuration 0074 easing.type: Easing.InOutQuad 0075 } 0076 OpacityAnimator { 0077 target: background 0078 from: 0 0079 to: 0.6 0080 duration: Kirigami.Units.longDuration 0081 easing.type: Easing.InOutQuad 0082 } 0083 } 0084 0085 SequentialAnimation { 0086 id: closeAnim 0087 running: false 0088 0089 property bool closeToBlack: false 0090 property var callback 0091 function execute(call) { 0092 callback = call; 0093 closeAnim.restart(); 0094 } 0095 ParallelAnimation { 0096 OpacityAnimator { 0097 target: buttons 0098 from: 1 0099 to: 0 0100 duration: Kirigami.Units.longDuration 0101 easing.type: Easing.InOutQuad 0102 } 0103 OpacityAnimator { 0104 target: background 0105 from: 0.6 0106 to: 0 0107 duration: Kirigami.Units.longDuration 0108 easing.type: Easing.InOutQuad 0109 } 0110 OpacityAnimator { 0111 target: blackOverlay 0112 from: 0 0113 to: closeAnim.closeToBlack ? 1 : 0 0114 duration: Kirigami.Units.longDuration 0115 easing.type: Easing.InOutQuad 0116 } 0117 } 0118 ScriptAction { 0119 script: { 0120 if (closeAnim.callback) { 0121 closeAnim.callback(); 0122 } 0123 buttons.opacity = 1; 0124 background.opacity = 0.6; 0125 } 0126 } 0127 } 0128 0129 Item { 0130 id: buttons 0131 anchors.fill: parent 0132 opacity: 0 0133 0134 ColumnLayout { 0135 anchors.centerIn: parent 0136 spacing: Kirigami.Units.gridUnit 0137 0138 ActionButton { 0139 iconSource: "system-reboot" 0140 text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart") 0141 onClicked: { 0142 closeAnim.closeToBlack = true; 0143 closeAnim.execute(root.rebootRequested); 0144 } 0145 } 0146 0147 ActionButton { 0148 iconSource: "system-shutdown" 0149 text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down") 0150 onClicked: { 0151 closeAnim.closeToBlack = true; 0152 closeAnim.execute(root.haltRequested); 0153 } 0154 } 0155 0156 ActionButton { 0157 iconSource: "system-log-out" 0158 text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log Out") 0159 onClicked: { 0160 closeAnim.closeToBlack = true; 0161 closeAnim.execute(root.logoutRequested); 0162 } 0163 } 0164 } 0165 0166 ActionButton { 0167 anchors { 0168 bottom: parent.bottom 0169 bottomMargin: Kirigami.Units.gridUnit 0170 horizontalCenter: parent.horizontalCenter 0171 } 0172 iconSource: "dialog-cancel" 0173 text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel") 0174 onClicked: { 0175 closeAnim.closeToBlack = false; 0176 closeAnim.execute(root.cancelRequested); 0177 } 0178 } 0179 } 0180 }