shift-shell/look-and-feel/contents/lockscreen/LockScreen.qml

95 lines
2.8 KiB
QML
Raw Normal View History

2016-02-24 19:15:15 +00:00
/********************************************************************
This file is part of the KDE project.
2014-08-06 11:58:32 +00:00
2016-02-24 19:15:15 +00:00
Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
2016-02-24 19:15:15 +00:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
2014-08-19 12:08:19 +00:00
2016-02-24 19:15:15 +00:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2014-08-06 11:58:32 +00:00
2016-02-24 19:15:15 +00:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
2014-08-20 10:10:58 +00:00
2016-02-24 19:15:15 +00:00
import QtQuick 2.0
import QtQuick.Controls 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.private.sessions 2.0
import "../components"
2014-08-20 10:10:58 +00:00
2016-02-24 19:15:15 +00:00
Image {
id: root
property bool viewVisible: false
property bool debug: false
property string notification
property Item userSelect: null
property int interfaceVersion: org_kde_plasma_screenlocker_greeter_interfaceVersion ? org_kde_plasma_screenlocker_greeter_interfaceVersion : 0
signal clearPassword()
2014-08-20 10:10:58 +00:00
2016-02-24 19:15:15 +00:00
source: backgroundPath || "../components/artwork/background.png"
fillMode: Image.PreserveAspectCrop
asynchronous: true
2014-08-20 10:10:58 +00:00
2016-02-24 19:15:15 +00:00
onStatusChanged: {
if (status == Image.Error) {
source = "../components/artwork/background.png";
2014-08-20 10:10:58 +00:00
}
}
2016-02-24 19:15:15 +00:00
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
2014-08-19 15:50:59 +00:00
2016-02-24 19:15:15 +00:00
Connections {
target: authenticator
onFailed: {
root.notification = i18nd("plasma_lookandfeel_org.kde.lookandfeel","Unlocking failed");
}
2016-02-24 19:15:15 +00:00
onGraceLockedChanged: {
if (!authenticator.graceLocked) {
root.notification = "";
root.clearPassword();
2014-08-19 15:50:59 +00:00
}
}
2016-02-24 19:15:15 +00:00
onMessage: {
root.notification = msg;
2014-08-19 16:09:43 +00:00
}
2016-02-24 19:15:15 +00:00
onError: {
root.notification = err;
2014-08-19 12:08:19 +00:00
}
}
2014-08-20 10:10:58 +00:00
2016-02-24 19:15:15 +00:00
SessionsModel {
id: sessionsModel
}
2014-08-20 10:10:58 +00:00
2016-02-24 19:15:15 +00:00
PlasmaCore.DataSource {
id: keystateSource
engine: "keystate"
connectedSources: "Caps Lock"
2014-08-20 10:10:58 +00:00
}
2014-08-28 13:21:53 +00:00
2016-02-24 19:15:15 +00:00
StackView {
id: stackView
anchors.fill: parent
2014-08-28 13:21:53 +00:00
2016-02-24 19:15:15 +00:00
initialItem: Loader {
active: root.viewVisible
source: "MainBlock.qml"
2014-08-28 13:21:53 +00:00
}
2016-02-24 19:15:15 +00:00
}
2014-08-28 13:21:53 +00:00
2016-02-24 19:15:15 +00:00
Component.onCompleted: {
// version support checks
if (root.interfaceVersion < 1) {
// ksmserver of 5.4, with greeter of 5.5
root.viewVisible = true;
2014-08-28 13:21:53 +00:00
}
}
}