Warning, /plasma/plasma-desktop/kcms/ksmserver/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.10
0008 import QtQuick.Controls 2.10
0009 import QtQuick.Layouts 1.11
0010 import org.kde.kirigami 2.13 as Kirigami
0011 import QtQuick.Dialogs 6.3
0012 import org.kde.desktopsession.private 1.0
0013 import org.kde.kcmutils as KCM
0014 
0015 KCM.SimpleKCM {
0016     id: root
0017 
0018     implicitHeight: Kirigami.Units.gridUnit * 28
0019     implicitWidth: Kirigami.Units.gridUnit * 28
0020 
0021     ColumnLayout {
0022         spacing: Kirigami.Units.smallSpacing
0023 
0024         Kirigami.InlineMessage {
0025             id: manualSessionRestoreRebootMessage
0026             Layout.fillWidth: true
0027             Layout.margins: Kirigami.Units.smallSpacing
0028             type: Kirigami.MessageType.Information
0029             visible: false
0030             text: i18n("The system must be restarted before manual session saving becomes active.")
0031             showCloseButton: true
0032             actions: [
0033                 Kirigami.Action {
0034                     icon.name: "system-reboot"
0035                     text: i18n("Restart")
0036                     onTriggered: kcm.reboot();
0037                 }
0038             ]
0039             Connections {
0040                 target: kcm
0041                 function onKsmserverSettingsChanged() {
0042                     if (loginManual.checked) {
0043                         manualSessionRestoreRebootMessage.visible = true;
0044                     } else {
0045                         manualSessionRestoreRebootMessage.visible = false;
0046                     }
0047                 }
0048             }
0049         }
0050 
0051         Kirigami.InlineMessage {
0052             Layout.fillWidth: true
0053             Layout.margins: Kirigami.Units.smallSpacing
0054             type: kcm.error.length > 0 ? Kirigami.MessageType.Error : Kirigami.MessageType.Information
0055             visible: kcm.restartInSetupScreen || kcm.error.length > 0
0056             text: kcm.error.length > 0
0057             ? i18n("Failed to request restart to firmware setup: %1", kcm.error)
0058             : kcm.isUefi ? i18n("Next time the computer is restarted, it will enter the UEFI setup screen.")
0059             : i18n("Next time the computer is restarted, it will enter the firmware setup screen.")
0060             showCloseButton: true
0061             actions: Kirigami.Action {
0062                 icon.name: "system-reboot"
0063                 onTriggered: kcm.reboot();
0064                 text: i18n("Restart Now")
0065             }
0066         }
0067         Kirigami.FormLayout {
0068 
0069             Item {
0070                 Kirigami.FormData.isSection: true
0071                 Kirigami.FormData.label: i18nc("@title:group", "Logout Screen")
0072             }
0073 
0074             RowLayout {
0075                 Kirigami.FormData.label: i18n("Show:")
0076                 Kirigami.FormData.buddyFor: logoutScreenCheckbox
0077                 spacing: 0
0078 
0079                 CheckBox {
0080                     id: logoutScreenCheckbox
0081                     checked: Settings.confirmLogout
0082                     onToggled: Settings.confirmLogout = checked
0083                     KCM.SettingStateBinding {
0084                         configObject: Settings
0085                         settingName: "confirmLogout"
0086                     }
0087                 }
0088                 KCM.ContextualHelpButton {
0089                     toolTipText: xi18nc("@info", "When this setting is turned on, the logout confirmation screen will be shown when you log out, shut down, restart, press the power button, or click on buttons or menu items labeled <interface>Leaveā€¦</interface>.")
0090                 }
0091             }
0092 
0093             Item {
0094                 Kirigami.FormData.isSection: true
0095                 Kirigami.FormData.label: i18nc("@title:group", "Session Restore")
0096             }
0097 
0098             ButtonGroup {
0099                 buttons: [loginRestore, loginManual, loginEmpty]
0100             }
0101             RadioButton {
0102                 id: loginRestore
0103                 Kirigami.FormData.label: i18n("On login, launch apps that were open:")
0104                 text: i18nc("@option:radio Automatic style of session restoration", "On last logout")
0105                 checked: Settings.loginMode === 0
0106                 onToggled: Settings.loginMode = 0
0107                 KCM.SettingStateBinding {
0108                     configObject: Settings
0109                     settingName: "loginMode"
0110                 }
0111             }
0112             RowLayout {
0113                 spacing: 0
0114 
0115                 RadioButton {
0116                     id: loginManual
0117                     text: i18nc("@option:radio Manual style of session restoration", "When session was manually saved")
0118                     checked: Settings.loginMode === 1
0119                     onToggled: Settings.loginMode = 1
0120                     KCM.SettingStateBinding {
0121                         configObject: Settings
0122                         settingName: "loginMode"
0123                     }
0124                 }
0125                 KCM.ContextualHelpButton {
0126                     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.")
0127                 }
0128             }
0129             RadioButton {
0130                 id: loginEmpty
0131                 text: 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")
0132                 checked: Settings.loginMode === 2
0133                 onToggled: Settings.loginMode = 2
0134                 KCM.SettingStateBinding {
0135                     configObject: Settings
0136                     settingName: "loginMode"
0137                 }
0138             }
0139 
0140             Item {
0141                 Kirigami.FormData.isSection: true
0142             }
0143 
0144             ColumnLayout {
0145                 Kirigami.FormData.label: i18n("Ignored applications:")
0146                 Kirigami.FormData.buddyFor: ignoredAppsTextField
0147                 spacing: Kirigami.Units.smallSpacing
0148 
0149                 RowLayout {
0150                     spacing: 0
0151 
0152                     TextField {
0153                         id: ignoredAppsTextField
0154                         Layout.preferredWidth: Kirigami.Units.gridUnit * 16
0155                         text: Settings.excludeApps
0156                         enabled: !loginEmpty.checked
0157                         // onTextEdited instead of onAccepted because otherwise the apply and
0158                         // reset buttons won't work, since otherwise in many case no change will
0159                         // be sent to the kconfigXt backend.
0160                         onTextEdited: Settings.excludeApps = text
0161 
0162                         KCM.SettingStateBinding {
0163                             configObject: Settings
0164                             settingName: "excludeApps"
0165                         }
0166                     }
0167                     KCM.ContextualHelpButton {
0168                         toolTipText: i18n("Write apps' executable names here (separated by commas or colons, for example 'xterm:konsole' or 'xterm,konsole') to prevent them from autostarting along with other session-restored apps.")
0169                     }
0170                 }
0171             }
0172 
0173             Item {
0174                 Kirigami.FormData.isSection: true
0175                 Kirigami.FormData.label: i18nc("@title:group", "Firmware")
0176                 visible: uefi.visible
0177             }
0178 
0179             CheckBox {
0180                 id: uefi
0181                 Kirigami.FormData.label: i18nc("@label:check part of a sentence: After next restart enter UEFI/Firmware setup screen", "After next restart:")
0182                 text: kcm.isUefi ? i18nc("@option:check", "Enter UEFI setup screen")
0183                                 : i18nc("@option:check", "Enter firmware setup screen")
0184                 visible: kcm.canFirmwareSetup
0185                 checked: kcm.restartInSetupScreen
0186                 onToggled: kcm.restartInSetupScreen = checked
0187             }
0188         }
0189     }
0190 }