Warning, /plasma/plasma-workspace/lookandfeel/components/SessionManagementScreen.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org>
0003
0004 SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.15
0008
0009 import QtQuick.Layouts 1.15
0010
0011 import org.kde.plasma.components 3.0 as PlasmaComponents3
0012 import org.kde.kirigami 2.20 as Kirigami
0013
0014 FocusScope {
0015 id: root
0016
0017 /*
0018 * Any message to be displayed to the user, visible above the text fields
0019 */
0020 property alias notificationMessage: notificationsLabel.text
0021
0022 /*
0023 * A list of Items (typically ActionButtons) to be shown in a Row beneath the prompts
0024 */
0025 property alias actionItems: actionItemsLayout.children
0026
0027 /*
0028 * Whether to show or hide the list of action items as a whole.
0029 */
0030 property alias actionItemsVisible: actionItemsLayout.visible
0031
0032 /*
0033 * A model with a list of users to show in the view.
0034 * There are different implementations in sddm greeter (UserModel) and
0035 * KScreenLocker (SessionsModel), so some roles will be missing.
0036 *
0037 * type: {
0038 * name: string,
0039 * realName: string,
0040 * homeDir: string,
0041 * icon: string,
0042 * iconName?: string,
0043 * needsPassword?: bool,
0044 * displayNumber?: string,
0045 * vtNumber?: int,
0046 * session?: string
0047 * isTty?: bool,
0048 * }
0049 */
0050 property alias userListModel: userListView.model
0051
0052 /*
0053 * Self explanatory
0054 */
0055 property alias userListCurrentIndex: userListView.currentIndex
0056 property alias userListCurrentItem: userListView.currentItem
0057 property bool showUserList: true
0058
0059 property alias userList: userListView
0060
0061 property int fontSize: Kirigami.Theme.defaultFont.pointSize + 2
0062
0063 default property alias _children: innerLayout.children
0064
0065 signal userSelected()
0066
0067 function playHighlightAnimation() {
0068 bounceAnimation.start();
0069 }
0070
0071 // FIXME: move this component into a layout, rather than abusing
0072 // anchors and implicitly relying on other components' built-in
0073 // whitespace to avoid items being overlapped.
0074 UserList {
0075 id: userListView
0076 visible: showUserList && y > 0
0077 anchors {
0078 bottom: parent.verticalCenter
0079 // We only need an extra bottom margin when text is constrained,
0080 // since only in this case can the username label be a multi-line
0081 // string that would otherwise overflow.
0082 bottomMargin: constrainText ? Kirigami.Units.gridUnit * 3 : 0
0083 left: parent.left
0084 right: parent.right
0085 }
0086 fontSize: root.fontSize
0087 // bubble up the signal
0088 onUserSelected: root.userSelected()
0089 }
0090
0091 //goal is to show the prompts, in ~16 grid units high, then the action buttons
0092 //but collapse the space between the prompts and actions if there's no room
0093 //ui is constrained to 16 grid units wide, or the screen
0094 ColumnLayout {
0095 id: prompts
0096 anchors.top: parent.verticalCenter
0097 anchors.topMargin: Kirigami.Units.largeSpacing
0098 anchors.left: parent.left
0099 anchors.right: parent.right
0100 anchors.bottom: parent.bottom
0101 PlasmaComponents3.Label {
0102 id: notificationsLabel
0103 font.pointSize: root.fontSize
0104 Layout.maximumWidth: Kirigami.Units.gridUnit * 16
0105 Layout.alignment: Qt.AlignHCenter
0106 Layout.fillWidth: true
0107 horizontalAlignment: Text.AlignHCenter
0108 textFormat: Text.PlainText
0109 wrapMode: Text.WordWrap
0110 font.italic: true
0111
0112 SequentialAnimation {
0113 id: bounceAnimation
0114 loops: 1
0115 PropertyAnimation {
0116 target: notificationsLabel
0117 properties: "scale"
0118 from: 1.0
0119 to: 1.1
0120 duration: Kirigami.Units.longDuration
0121 easing.type: Easing.OutQuad
0122 }
0123 PropertyAnimation {
0124 target: notificationsLabel
0125 properties: "scale"
0126 from: 1.1
0127 to: 1.0
0128 duration: Kirigami.Units.longDuration
0129 easing.type: Easing.InQuad
0130 }
0131 }
0132 }
0133 ColumnLayout {
0134 Layout.minimumHeight: implicitHeight
0135 Layout.maximumHeight: Kirigami.Units.gridUnit * 10
0136 Layout.maximumWidth: Kirigami.Units.gridUnit * 16
0137 Layout.alignment: Qt.AlignHCenter
0138 ColumnLayout {
0139 id: innerLayout
0140 Layout.alignment: Qt.AlignHCenter
0141 Layout.fillWidth: true
0142 }
0143 Item {
0144 Layout.fillHeight: true
0145 }
0146 }
0147 Item {
0148 Layout.alignment: Qt.AlignHCenter
0149 implicitHeight: actionItemsLayout.implicitHeight
0150 implicitWidth: actionItemsLayout.implicitWidth
0151 Row { //deliberately not rowlayout as I'm not trying to resize child items
0152 id: actionItemsLayout
0153 anchors.verticalCenter: parent.top
0154 spacing: Kirigami.Units.largeSpacing
0155 }
0156 }
0157 Item {
0158 Layout.fillHeight: true
0159 }
0160 }
0161 }