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

126 lines
3.9 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 QtQuick.Layouts 1.1
import org.kde.plasma.components 2.0 as PlasmaComponents
2016-02-24 19:15:15 +00:00
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.workspace.keyboardlayout 1.0
2016-02-24 19:15:15 +00:00
import "../components"
2014-08-20 10:10:58 +00:00
PlasmaCore.ColorScope {
id: block
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
anchors.fill: parent
2014-08-20 10:10:58 +00:00
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
color: PlasmaCore.ColorScope.backgroundColor
opacity: 0.8
height: infoPane.height + units.largeSpacing * 2
}
2014-08-20 10:10:58 +00:00
InfoPane {
id: infoPane
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: units.largeSpacing
2014-08-20 10:10:58 +00:00
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
color: PlasmaCore.ColorScope.backgroundColor
opacity: 0.8
height: mainLayout.height + units.largeSpacing * 2
}
2014-08-19 15:50:59 +00:00
ColumnLayout {
id: mainLayout
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: units.largeSpacing
2014-08-19 16:09:43 +00:00
}
spacing: units.largeSpacing
RowLayout {
Layout.alignment: Qt.AlignHCenter
2014-08-20 10:10:58 +00:00
PlasmaComponents.TextField {
id: passwordInput
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Password")
echoMode: TextInput.Password
enabled: !authenticator.graceLocked
onAccepted: actionButton.clicked(null)
focus: false
2014-08-20 10:10:58 +00:00
onVisibleChanged: {
if (visible) {
forceActiveFocus();
}
text = "";
}
onTextChanged: {
if (text == "") {
clearTimer.stop();
} else {
clearTimer.restart();
}
}
2014-08-28 13:21:53 +00:00
Timer {
id: clearTimer
interval: 30000
repeat: false
onTriggered: {
passwordInput.text = "";
}
}
}
2014-08-28 13:21:53 +00:00
DialerIconButton {
source: "edit-clear"
callback: function() {
if (passwordInput.text.length > 0) {
passwordInput.text = passwordInput.text.substr(0, passwordInput.text.length - 1);
}
}
}
2014-08-28 13:21:53 +00:00
}
Dialer {
id: dialer
Layout.fillWidth: true
}
PlasmaComponents.Button {
id: actionButton
Layout.alignment: Qt.AlignHCenter
Layout.minimumWidth: passwordInput.width
text: i18n("Unlock")
enabled: !authenticator.graceLocked
onClicked: authenticator.tryUnlock(passwordInput.text);
2014-08-28 13:21:53 +00:00
}
}
}