Warning, /plasma/kscreenlocker/greeter/fallbacktheme/SessionSwitching.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2011 Martin Gräßlin <mgraesslin@kde.org>
0003 SPDX-FileCopyrightText: 2023 Nate Graham <nate@kde.org>
0004
0005 SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007
0008 import QtQuick 2.15
0009 import QtQuick.Layouts 1.15
0010
0011 import org.kde.kirigami 2.20 as Kirigami
0012 import org.kde.plasma.components 3.0 as PlasmaComponents3
0013 import org.kde.plasma.extras 2.0 as PlasmaExtras
0014
0015 Item {
0016 readonly property bool switchUserSupported: sessionsModel.canSwitchUser
0017
0018 signal sessionActivated()
0019 signal newSessionStarted()
0020 signal switchingCanceled()
0021
0022 implicitWidth: layoutItem.width + Kirigami.Units.largeSpacing * 2
0023 implicitHeight: layoutItem.height + Kirigami.Units.largeSpacing * 2
0024
0025 ColumnLayout {
0026 id: layoutItem
0027 anchors.centerIn: parent
0028 spacing: Kirigami.Units.largeSpacing
0029
0030 PlasmaComponents3.Label {
0031 id: explainText
0032 Layout.fillWidth: true
0033 Layout.maximumWidth: Kirigami.Units.gridUnit * 25
0034 Layout.bottomMargin: Kirigami.Units.largeSpacing * 2
0035 text: i18nd("kscreenlocker_greet", "The current session will be hidden " +
0036 "and a new login screen or an existing session will be displayed.\n" +
0037 "An F-key is assigned to each session; " +
0038 "F%1 is usually assigned to the first session, " +
0039 "F%2 to the second session and so on. " +
0040 "You can switch between sessions by pressing " +
0041 "Ctrl, Alt and the appropriate F-key at the same time. " +
0042 "Additionally, the KDE Panel and Desktop menus have " +
0043 "actions for switching between sessions.",
0044 7, 8)
0045 wrapMode: Text.Wrap
0046 font: Kirigami.Theme.smallFont
0047 }
0048
0049 PlasmaComponents3.Label {
0050 Layout.fillWidth: true
0051 text: i18nd("kscreenlocker_greet", "Active sessions:")
0052 }
0053 PlasmaComponents3.ScrollView {
0054 Layout.fillWidth: true
0055 Layout.preferredHeight: userSessionsView.count * userSessionsView.delegateHeight
0056
0057 contentItem: ListView {
0058 id: userSessionsView
0059 property int delegateHeight: Kirigami.Units.gridUnit * 2
0060
0061 model: sessionsModel
0062
0063 delegate: PlasmaComponents3.Label {
0064 readonly property int userVt: model.vtNumber
0065 width: userSessionsView.width
0066 height: userSessionsView.delegateHeight
0067 leftPadding: Kirigami.Units.largeSpacing
0068
0069 text: {
0070 var display = model.isTty ? i18ndc("kscreenlocker_greet", "User logged in on console", "TTY") : model.displayNumber || ""
0071
0072 return i18ndc("kscreenlocker_greet", "username (terminal, display)", "%1 (%2)",
0073 (model.realName || model.name || i18ndc("kscreenlocker_greet", "Nobody logged in", "Unused")),
0074 display ? i18ndc("kscreenlocker_greet", "vt, display", "%1, %2", model.vtNumber, display)
0075 : model.vtNumber
0076 )
0077 }
0078 horizontalAlignment: Text.AlignLeft
0079 verticalAlignment: Text.AlignVCenter
0080 }
0081
0082 highlight: PlasmaExtras.Highlight { }
0083 highlightMoveDuration: 0
0084 highlightResizeDuration: 0
0085
0086 focus: true
0087
0088 MouseArea {
0089 anchors.fill: parent
0090 onClicked: userSessionsView.currentIndex = userSessionsView.indexAt(mouse.x, mouse.y)
0091 onDoubleClicked: {
0092 sessionsModel.switchUser(userSessionsView.indexAt(mouse.x, mouse.y).userVt)
0093 sessionActivated();
0094 }
0095 }
0096 }
0097 }
0098
0099 RowLayout {
0100 id: buttonRow
0101 Layout.alignment: Qt.AlignHCenter
0102 spacing: Kirigami.Units.largeSpacing
0103
0104 PlasmaComponents3.Button {
0105 id: activateSession
0106 text: i18nd("kscreenlocker_greet", "Activate Session")
0107 icon.name: "system-switch-user"
0108 onClicked: {
0109 sessionsModel.switchUser(userSessionsView.currentItem.userVt)
0110 sessionActivated();
0111 }
0112 }
0113 PlasmaComponents3.Button {
0114 id: newSession
0115 text: i18nd("kscreenlocker_greet", "Start New Session")
0116 icon.name: "list-add"
0117 visible: sessionsModel.canStartNewSession
0118 onClicked: {
0119 sessionsModel.startNewSession()
0120 newSessionStarted();
0121 }
0122 }
0123 PlasmaComponents3.Button {
0124 id: cancelSession
0125 text: i18nd("kscreenlocker_greet", "Cancel")
0126 icon.name: "dialog-cancel"
0127 onClicked: switchingCanceled()
0128 }
0129 }
0130 }
0131 }