import QtQuick import QtQuick.Layouts import QtQuick.Controls import org.kde.plasma.plasmoid import org.kde.plasma.core as PlasmaCore import org.kde.plasma.extras as PlasmaExtras import org.kde.plasma.private.kicker 0.1 as Kicker import org.kde.coreaddons 1.0 as KCoreAddons // kuser import org.kde.plasma.private.shell 2.0 import org.kde.kwindowsystem import Qt5Compat.GraphicalEffects import org.kde.kquickcontrolsaddons import org.kde.plasma.components as PlasmaComponents3 import org.kde.plasma.private.quicklaunch import org.kde.kirigami as Kirigami import org.kde.plasma.plasma5support as P5Support import org.kde.plasma.private.sessions as Sessions import org.kde.ksvg as KSvg import org.kde.kcmutils as KCM import org.kde.plasma.plasmoid RowLayout{ spacing: Kirigami.Units.largeSpacing KCoreAddons.KUser { id: kuser } Logic { id: logic } Sessions.SessionManagement { id: sessionManager } Sessions.SessionsModel { id: sessionsModel } P5Support.DataSource { id: pmEngine engine: "powermanagement" connectedSources: ["PowerDevil", "Sleep States"] function performOperation(what) { var service = serviceForSource("PowerDevil") var operation = service.operationDescription(what) service.startOperationCall(operation) } } Image { id: iconUser source: kuser.faceIconUrl.toString() || "user-identity" cache: false visible: source !== "" sourceSize.height: parent.height * 0.9 sourceSize.width: parent.height * 0.9 fillMode: Image.PreserveAspectFit Layout.alignment: Qt.AlignVCenter // Crop the avatar to fit in a circle, like the lock and login screens // but don't on software rendering where this won't render layer.enabled:true // iconUser.GraphicsInfo.api !== GraphicsInfo.Software layer.effect: OpacityMask { // this Rectangle is a circle due to radius size maskSource: Rectangle { width: iconUser.width height: iconUser.height radius: height / 2 visible: false } } state: "hide" states: [ State { name: "show" when: parent.visible PropertyChanges { target: iconUser; opacity: 1; } }, State { name: "hide" when: !parent.visible PropertyChanges { target: iconUser; opacity: 0; } } ] transitions: Transition { PropertyAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; } } MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: KCM.KCMLauncher.openSystemSettings("kcm_users") } } PlasmaExtras.Heading { wrapMode: Text.NoWrap color: Kirigami.Theme.textColor level: 3 font.bold: true //font.weight: Font.Bold text: qsTr(kuser.fullName) } PlasmaComponents3.ToolButton { MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent onClicked: logic.openUrl("file:///usr/share/applications/org.kde.dolphin.desktop") } icon.width: 24 icon.height: 24 icon.name: "user-home" Layout.leftMargin: 10 PlasmaComponents3.ToolTip.delay: 1000 PlasmaComponents3.ToolTip.timeout: 1000 PlasmaComponents3.ToolTip.visible: hovered PlasmaComponents3.ToolTip.text: i18n("User Home") } PlasmaComponents3.ToolButton { MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent onClicked: logic.openUrl("file:///usr/share/applications/systemsettings.desktop") } icon.width: 24 icon.height: 24 icon.name: "configure" Layout.leftMargin: 10 PlasmaComponents3.ToolTip.delay: 1000 PlasmaComponents3.ToolTip.timeout: 1000 PlasmaComponents3.ToolTip.visible: hovered PlasmaComponents3.ToolTip.text: i18n("System Preferences") } Item{ Layout.fillWidth: true } PlasmaComponents3.ToolButton { MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent //onClicked: pmEngine.performOperation("lockScreen") //enabled: pmEngine.data["Sleep States"]["LockScreen"] onClicked: sessionManager.lock() } icon.width: 24 icon.height: 24 icon.name: "system-lock-screen" Layout.rightMargin: 10 PlasmaComponents3.ToolTip.delay: 1000 PlasmaComponents3.ToolTip.timeout: 1000 PlasmaComponents3.ToolTip.visible: hovered PlasmaComponents3.ToolTip.text: i18n("Lock Screen") } PlasmaComponents3.ToolButton { MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent onClicked: sessionManager.switchUser() } icon.width: 24 icon.height: 24 icon.name: "system-switch-user" Layout.rightMargin: 10 PlasmaComponents3.ToolTip.delay: 1000 PlasmaComponents3.ToolTip.timeout: 1000 PlasmaComponents3.ToolTip.visible: hovered PlasmaComponents3.ToolTip.text: i18n("Switch User") } PlasmaComponents3.ToolButton { MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent // onClicked: sessionManager.requestShutdown() onClicked: sessionManager.requestLogoutPrompt() } icon.width: 24 icon.height: 24 icon.name: "system-shutdown" Layout.rightMargin: 10 PlasmaComponents3.ToolTip.delay: 1000 PlasmaComponents3.ToolTip.timeout: 1000 PlasmaComponents3.ToolTip.visible: hovered PlasmaComponents3.ToolTip.text: i18n("Shutdown") } }