mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-20 11:29:20 +00:00
8af104a16e
This feature works for MacOs only, for now. On login, whether new or already created user may select between options: "Store" - store password to the Keychain "Not now" - don't store it now, but ask next time again "Never" - don't store them ever and don't ask again Selected preference may be changed later in: `ProfileSettings > Privacy and security > Store pass to Keychain` On the next app run, if `Store` was selected, a user will be asked to confirm his identity using Touch Id in order to log in the app. If any error happens he will be able to login using password. Fixes: #2675
125 lines
3.6 KiB
QML
125 lines
3.6 KiB
QML
import QtQuick 2.13
|
|
import QtQuick.Controls 2.13
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import StatusQ.Core 0.1
|
|
import StatusQ.Core.Theme 0.1
|
|
import StatusQ.Controls 0.1
|
|
import StatusQ.Popups 0.1
|
|
|
|
StatusModal {
|
|
id: confirmationDialog
|
|
anchors.centerIn: parent
|
|
|
|
property Popup parentPopup
|
|
property var value
|
|
property var executeConfirm
|
|
property var executeReject
|
|
property var executeCancel
|
|
property string btnType: "warn"
|
|
property string confirmButtonLabel: qsTr("Confirm")
|
|
property string rejectButtonLabel: qsTr("Reject")
|
|
property string cancelButtonLabel: qsTr("Cancel")
|
|
property string confirmationText: qsTr("Are you sure you want to do this?")
|
|
property bool showRejectButton: false
|
|
property bool showCancelButton: false
|
|
property alias checkbox: checkbox
|
|
|
|
|
|
header.title: qsTr("Confirm your action")
|
|
focus: visible
|
|
|
|
signal confirmButtonClicked()
|
|
signal rejectButtonClicked()
|
|
signal cancelButtonClicked()
|
|
|
|
|
|
contentItem: Item {
|
|
width: confirmationDialog.width
|
|
implicitHeight: childrenRect.height
|
|
Column {
|
|
width: parent.width - 32
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
Item {
|
|
width: parent.width
|
|
height: 16
|
|
}
|
|
|
|
StatusBaseText {
|
|
text: confirmationDialog.confirmationText
|
|
font.pixelSize: 15
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
wrapMode: Text.WordWrap
|
|
color: Theme.palette.directColor1
|
|
}
|
|
|
|
Item {
|
|
width: parent.width
|
|
height: 16
|
|
}
|
|
|
|
StatusCheckBox {
|
|
id: checkbox
|
|
visible: false
|
|
Layout.preferredWidth: parent.width
|
|
text: qsTr("Do not show this again")
|
|
}
|
|
|
|
Item {
|
|
width: parent.width
|
|
height: visible ? 16 : 0
|
|
visible: checkbox.visible
|
|
}
|
|
}
|
|
}
|
|
|
|
rightButtons: [
|
|
StatusFlatButton {
|
|
id: cancelButton
|
|
visible: showCancelButton
|
|
text: confirmationDialog.cancelButtonLabel
|
|
onClicked: {
|
|
if (executeCancel && typeof executeCancel === "function") {
|
|
executeCancel()
|
|
}
|
|
confirmationDialog.cancelButtonClicked()
|
|
}
|
|
},
|
|
StatusFlatButton {
|
|
visible: showRejectButton
|
|
text: confirmationDialog.rejectButtonLabel
|
|
onClicked: {
|
|
if (executeReject && typeof executeReject === "function") {
|
|
executeReject()
|
|
}
|
|
confirmationDialog.rejectButtonClicked()
|
|
}
|
|
},
|
|
StatusButton {
|
|
id: confirmButton
|
|
type: {
|
|
switch (confirmationDialog.btnType) {
|
|
case "warn":
|
|
return StatusBaseButton.Type.Danger
|
|
break
|
|
default:
|
|
return StatusBaseButton.Type.Primary
|
|
}
|
|
}
|
|
text: confirmationDialog.confirmButtonLabel
|
|
focus: true
|
|
Keys.onReturnPressed: function(event) {
|
|
confirmButton.clicked()
|
|
}
|
|
onClicked: {
|
|
if (executeConfirm && typeof executeConfirm === "function") {
|
|
executeConfirm()
|
|
}
|
|
confirmationDialog.confirmButtonClicked()
|
|
}
|
|
}
|
|
]
|
|
}
|