Commit 3c392d7f authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

[devicelock] Device lock for the homescreen.

parent aad959f3
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0
Item {
id: root
anchors.top: clock.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
ColumnLayout {
anchors.fill: parent
spacing: 40
TextField {
id: lockCodeField
readOnly: true
echoMode: TextInput.PasswordEchoOnEdit
}
GridLayout {
height: parent.height
width: parent.width
columns: 3
Repeater {
model: ["1","2","3","4","5","6","7","8","9","Ca","0","OK"]
delegate:
Button {
Layout.fillWidth: true
text: modelData
onClicked: {
if (text !== "Ca" && text !== "OK") {
lockCodeField.insert(lockCodeField.cursorPosition, text)
} else {
if (text === "OK") {
if(deviceLock.checkCode(lockCodeField.text)) {
deviceLock.setState(0)
lockCodeField.text = ""
} else {
lockCodeField.text = ""
}
} else if (text === "Ca"){
lockCodeField.text = ""
}
}
}
}
}
}
}
}
......@@ -6,12 +6,20 @@ Image {
visible: LipstickSettings.lockscreenVisible
LockscreenClock {
id: clock
anchors {
top: parent.top
left: parent.left
right: parent.right
}
}
DeviceLock {
id: deviceLockUI
anchors.fill: parent
visible: deviceLock.state === 1
z: 201
}
MouseArea {
anchors.fill: parent
}
......
......@@ -133,6 +133,7 @@ Compositor {
property real lockThreshold: 0.25
property int lockscreenX
property int lockscreenY
enabled: deviceLock.state === 0
onGestureStarted: {
swipeAnimation.stop()
......
......@@ -35,7 +35,8 @@ qml.files = qml/MainScreen.qml \
qml/BatteryPanel.qml \
qml/CommonPanel.qml \
qml/ShutdownScreen.qml \
qml/GlacierRotation.qml
qml/GlacierRotation.qml \
qml/DeviceLock.qml
qmlcompositor.path = /usr/share/lipstick-glacier-home-qt5/qml/compositor
qmlcompositor.files = qml/compositor/WindowWrapperMystic.qml \
......@@ -107,6 +108,7 @@ OTHER_FILES += qml/*.qml \
qml/BatteryPanel.qml \
qml/CommonPanel.qml \
qml/ShutdownScreen.qml \
qml/GlacierRotation.qml
qml/GlacierRotation.qml \
qml/DeviceLock.qml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment