Warning, /plasma/plasma-mobile/look-and-feel/contents/lockscreen/LockScreenNarrowContent.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2021-2022 Devin Lin <espidev@gmail.com>
0003  * SPDX-License-Identifier: GPL-2.0-or-later
0004  */
0005 
0006 import QtQuick 2.12
0007 import QtQuick.Layouts 1.1
0008 
0009 import org.kde.plasma.core 2.0 as PlasmaCore
0010 import org.kde.plasma.workspace.keyboardlayout 1.0
0011 import org.kde.notificationmanager 1.1 as Notifications
0012 import org.kde.plasma.private.mobileshell 1.0 as MobileShell
0013 
0014 Loader {
0015     id: root
0016     
0017     required property var lockScreenState
0018     property var notificationsModel: []
0019 
0020     property bool notificationsShown: false
0021     
0022     property real fullHeight
0023     
0024     signal passwordRequested()
0025     
0026     // avoid topMargin animation when item is being loaded
0027     onLoaded: loadTimer.restart();
0028     Timer {
0029         id: loadTimer
0030         interval: PlasmaCore.Units.longDuration
0031     }
0032     
0033     // move while swiping up
0034     transform: Translate { y: Math.round((1 - phoneComponent.opacity) * (-root.height / 6)) }
0035     
0036     asynchronous: true
0037     sourceComponent: Item {
0038         ColumnLayout {
0039             id: column
0040             spacing: 0
0041             
0042             // center clock when no notifications are shown, otherwise move the clock upward
0043             anchors.topMargin: !root.notificationsShown ? Math.round(root.fullHeight / 2 - (column.implicitHeight / 2)) : PlasmaCore.Units.gridUnit * 5
0044             anchors.bottomMargin: PlasmaCore.Units.gridUnit
0045             anchors.fill: parent
0046             
0047             // animate
0048             Behavior on anchors.topMargin {
0049                 NumberAnimation {
0050                     duration: loadTimer.running ? 0 : PlasmaCore.Units.longDuration
0051                     easing.type: Easing.InOutQuad
0052                 }
0053             }
0054             
0055             Clock {
0056                 layoutAlignment: Qt.AlignHCenter
0057                 Layout.alignment: Qt.AlignHCenter
0058                 Layout.bottomMargin: PlasmaCore.Units.gridUnit * 2 // keep spacing even if media controls are gone
0059             }
0060             
0061             MobileShell.MediaControlsWidget {
0062                 Layout.alignment: Qt.AlignHCenter
0063                 Layout.fillWidth: true
0064                 Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25
0065                 Layout.leftMargin: PlasmaCore.Units.gridUnit
0066                 Layout.rightMargin: PlasmaCore.Units.gridUnit
0067             }
0068             
0069             NotificationsComponent {
0070                 id: notificationComponent
0071                 lockScreenState: root.lockScreenState
0072                 notificationsModel: root.notificationsModel
0073                 
0074                 Layout.alignment: Qt.AlignHCenter
0075                 Layout.fillHeight: true
0076                 Layout.fillWidth: true
0077                 Layout.maximumWidth: PlasmaCore.Units.gridUnit * (25 + 2) // clip margins 
0078                 topMargin: PlasmaCore.Units.gridUnit
0079                 
0080                 onPasswordRequested: root.passwordRequested()
0081                 onNotificationsShownChanged: root.notificationsShown = notificationsShown
0082             }
0083         }
0084     }
0085 }