/*SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Controlsimport QtQuick.Layoutsimport org.kde.kirigami as Kirigamiimport QtQuick.Dialogsimport org.kde.kcmutils as KCMKCM.SimpleKCM {id: rootimplicitHeight: Kirigami.Units.gridUnit * 28implicitWidth: Kirigami.Units.gridUnit * 28headerPaddingEnabled: false // Let the InlineMessage touch the edgesheader: ColumnLayout {spacing : 0Kirigami.InlineMessage {Layout.fillWidth: trueposition: Kirigami.InlineMessage.Position.Headertype: kcm.error.length > 0 ? Kirigami.MessageType.Error : Kirigami.MessageType.Informationvisible: kcm.restartInSetupScreen || kcm.error.length > 0text: kcm.error.length > 0? i18nc("@info:status inlinemessage", "Failed to request restart to firmware setup: %1", kcm.error): kcm.isUefi ? i18nc("@info:status inlinemessage", "Next time the computer is restarted, it will enter UEFI firmware settings."): i18nc("@info:status inlinemessage", "Next time the computer is restarted, it will enter the firmware setup screen.")showCloseButton: trueactions: Kirigami.Action {icon.name: "system-reboot"onTriggered: kcm.reboot();text: i18nc("@action:button", "Restart Now")}}}Kirigami.FormLayout {Item {Kirigami.FormData.isSection: trueKirigami.FormData.label: i18nc("@title:group", "General")}CheckBox {id: logoutScreenCheckboxKirigami.FormData.label: i18nc("@label beginning of the logical sentence 'Ask for confirmation on shutdown, restart, and logout.'", "Ask for confirmation:")text: i18nc("@option:check end of the logical sentence 'Ask for confirmation on shutdown, restart, and logout.'", "On shutdown, restart, and logout")checked: kcm.settings.confirmLogoutonToggled: kcm.settings.confirmLogout = checkedKCM.SettingStateBinding {configObject: kcm.settingssettingName: "confirmLogout"}}Item {Kirigami.FormData.isSection: trueKirigami.FormData.label: i18nc("@title:group", "Session Restore")}ButtonGroup {buttons: [loginRestore, loginManual, loginEmpty]}RadioButton {id: loginRestoreKirigami.FormData.label: i18nc("@title:group prefix for radiobuttons", "On login, launch apps that were open:")text: i18nc("@option:radio Automatic style of session restoration", "On last logout")checked: kcm.settings.loginMode === 0onToggled: kcm.settings.loginMode = 0KCM.SettingStateBinding {configObject: kcm.settingssettingName: "loginMode"}}RowLayout {spacing: 0RadioButton {id: loginManualtext: i18nc("@option:radio Manual style of session restoration", "When session was manually saved")checked: kcm.settings.loginMode === 1onToggled: kcm.settings.loginMode = 1KCM.SettingStateBinding {configObject: kcm.settingssettingName: "loginMode"}}Kirigami.ContextualHelpButton {toolTipText: xi18nc("@info", "A <interface>Save Session</interface> button will appear in the <interface>Application Launcher</interface> menu. When you click it, Plasma will remember the apps that are open and restore them on the next login. Click it again to replace the set of remembered apps.")}}RadioButton {id: loginEmptytext: i18nc("@option:radio Here 'session' refers to the technical concept of session restoration, whereby the windows that were open on logout are re-opened on the next login", "Start with an empty session")checked: kcm.settings.loginMode === 2onToggled: kcm.settings.loginMode = 2KCM.SettingStateBinding {configObject: kcm.settingssettingName: "loginMode"}}Item {Kirigami.FormData.isSection: true}RowLayout {Kirigami.FormData.label: i18nc("@label:textbox", "Ignored applications:")spacing: 0TextField {Layout.preferredWidth: Kirigami.Units.gridUnit * 16text: kcm.settings.excludeAppsenabled: !loginEmpty.checked// onTextEdited instead of onAccepted because otherwise the apply and// reset buttons won't work, since otherwise in many case no change will// be sent to the kconfigXt backend.onTextEdited: kcm.settings.excludeApps = textKCM.SettingStateBinding {configObject: kcm.settingssettingName: "excludeApps"}}Kirigami.ContextualHelpButton {toolTipText: i18nc("@info:whatsthis contextualhelpbutton tooltip", "Write apps' desktop file identifier or, on X11, executable names here (separated by commas or colons, for example 'xterm:org.kde.konsole.desktop' or 'xterm,org.kde.konsole.desktop') to prevent them from autostarting along with other session-restored apps.")}}Item {Kirigami.FormData.isSection: trueKirigami.FormData.label: i18nc("@title:group", "Firmware")visible: uefi.visible}Switch {id: uefiKirigami.FormData.label: i18nc("@label:check part of a sentence: After next restart enter UEFI/Firmware setup screen", "After next restart:")text: kcm.isUefi ? i18nc("@option:check", "Enter UEFI firmware settings"): i18nc("@option:check", "Enter firmware setup screen")visible: kcm.canFirmwareSetupchecked: kcm.restartInSetupScreenonToggled: kcm.restartInSetupScreen = checked}}}