-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.qml
87 lines (79 loc) · 2.83 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
ApplicationWindow {
id: window
visible: true
width: 640
height: 480
title: qsTr("Steem Pressure")
ShadowedPopup {
id: passwordEntry
modal: true
dim: true
width: 400
height: 300
x: window.width / 2 - width / 2
y: window.height / 2 - height / 2
visible: true
showButtons: false
closePolicy: Popup.NoAutoClose
Column {
anchors.verticalCenter: parent.verticalCenter
width: parent.width
spacing: 8
Label {
id: welcomeLabel
text: keysPage.keyStore.hasPersistedData? qsTr("Welcome back! Enter your password to continue")
: qsTr("Welcome to <b>Steem Pressure</b>! Set a password " +
"below")
}
RowLayout {
width: parent.width
TextField {
id: passwordTextField
placeholderText: qsTr("Enter password here")
echoMode: showPasswordButton.pressed? TextField.Normal : TextField.Password
Layout.fillWidth: true
onAccepted: {
keysPage.keyStore.password = text
if (keysPage.keyStore.hasPersistedData) {
if (keysPage.keyStore.restore())
passwordEntry.close()
else {
passwordLabel.text = qsTr("That password's no good. Try again?")
keysPage.keyStore.password = ""
}
} else {
keysPage.keyStore.persist()
passwordEntry.close()
}
}
Component.onCompleted: forceActiveFocus()
}
Button {
id: showPasswordButton
text: qsTr("Reveal")
onReleased: passwordTextField.forceActiveFocus()
onDoubleClicked: {
if (passwordTextField.text === "I want to reset all my data") {
keysPage.keyStore.resetPersistence()
passwordTextField.text = ""
}
}
}
}
Label {
id: passwordLabel
text: qsTr("This password is used to encrypt your keys")
}
}
}
StackView {
id: mainStack
anchors.fill: parent
initialItem: MyKeysPage {
id: keysPage
}
}
}