2021-09-13 11:51:47 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 09:37:58 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.controls 1.0
|
2021-09-13 11:51:47 +00:00
|
|
|
|
2021-12-09 13:28:02 +00:00
|
|
|
import "../../Onboarding/shared" as OnboardingComponents
|
|
|
|
|
2021-10-14 11:33:34 +00:00
|
|
|
// TODO: replace with StatusModal
|
2021-09-13 11:51:47 +00:00
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
|
|
|
|
2022-02-24 12:18:21 +00:00
|
|
|
property var privacyStore
|
|
|
|
|
2021-09-13 11:51:47 +00:00
|
|
|
title: qsTr("Store pass to Keychain")
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
|
2021-10-17 10:44:21 +00:00
|
|
|
function updateListState() {
|
|
|
|
if (localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueStore)
|
|
|
|
storeBtn.checked = true
|
|
|
|
else if (localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueNotNow ||
|
|
|
|
localAccountSettings.storeToKeychainValue === "")
|
|
|
|
notNowBtn.checked = true
|
|
|
|
else if (localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueNever)
|
|
|
|
neverBtn.checked = true
|
|
|
|
}
|
|
|
|
|
2022-04-11 11:39:15 +00:00
|
|
|
function offerToStorePassword(password, runStoreToKeychainPopup) {
|
|
|
|
if(Qt.platform.os == "osx")
|
|
|
|
{
|
|
|
|
if(runStoreToKeychainPopup)
|
|
|
|
Global.openPopup(storeToKeychainConfirmationPopupComponent, { password: password })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-13 11:51:47 +00:00
|
|
|
Column {
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
|
|
|
|
spacing: 0
|
|
|
|
|
2021-10-17 10:44:21 +00:00
|
|
|
Connections {
|
|
|
|
target: localAccountSettings
|
|
|
|
onStoreToKeychainValueChanged: {
|
|
|
|
updateListState()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-13 11:51:47 +00:00
|
|
|
ButtonGroup {
|
|
|
|
id: openLinksWithGroup
|
|
|
|
}
|
|
|
|
|
2021-10-27 09:37:58 +00:00
|
|
|
RadioButtonSelector {
|
2021-10-17 10:44:21 +00:00
|
|
|
id: storeBtn
|
2021-10-27 09:37:58 +00:00
|
|
|
title: qsTr("Store")
|
2021-09-13 11:51:47 +00:00
|
|
|
buttonGroup: openLinksWithGroup
|
2021-10-17 10:44:21 +00:00
|
|
|
checked: localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueStore
|
2021-10-27 09:37:58 +00:00
|
|
|
onCheckedChanged: {
|
2021-10-17 10:44:21 +00:00
|
|
|
if (checked && localAccountSettings.storeToKeychainValue !== Constants.storeToKeychainValueStore) {
|
2022-03-07 22:59:38 +00:00
|
|
|
// TODO: REFACTOR TO NEW PASWORD VIEW AND
|
|
|
|
// DELETE StoreToKeychainSelectionModal.qml
|
|
|
|
// AND CreatePasswordModal.qml IF NOT NEEDED
|
2021-12-07 20:33:12 +00:00
|
|
|
var storePassPopup = Global.openPopup(storePasswordModal)
|
2021-09-13 11:51:47 +00:00
|
|
|
if(storePassPopup)
|
|
|
|
{
|
|
|
|
storePassPopup.closed.connect(function(){
|
2021-10-17 10:44:21 +00:00
|
|
|
updateListState()
|
2021-09-13 11:51:47 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-27 09:37:58 +00:00
|
|
|
RadioButtonSelector {
|
2021-09-13 11:51:47 +00:00
|
|
|
id: notNowBtn
|
2021-10-27 09:37:58 +00:00
|
|
|
title: qsTr("Not now")
|
2021-09-13 11:51:47 +00:00
|
|
|
buttonGroup: openLinksWithGroup
|
2021-10-17 10:44:21 +00:00
|
|
|
checked: localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueNotNow ||
|
|
|
|
localAccountSettings.storeToKeychainValue === ""
|
2021-10-27 09:37:58 +00:00
|
|
|
onCheckedChanged: {
|
2021-09-13 11:51:47 +00:00
|
|
|
if (checked) {
|
2021-10-17 10:44:21 +00:00
|
|
|
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueNotNow
|
2021-09-13 11:51:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-27 09:37:58 +00:00
|
|
|
RadioButtonSelector {
|
2021-09-13 11:51:47 +00:00
|
|
|
id: neverBtn
|
2021-10-27 09:37:58 +00:00
|
|
|
title: qsTr("Never")
|
2021-09-13 11:51:47 +00:00
|
|
|
buttonGroup: openLinksWithGroup
|
2021-10-17 10:44:21 +00:00
|
|
|
checked: localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueNever
|
2021-10-27 09:37:58 +00:00
|
|
|
onCheckedChanged: {
|
2021-09-13 11:51:47 +00:00
|
|
|
if (checked) {
|
2021-10-17 10:44:21 +00:00
|
|
|
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueNever
|
2021-09-13 11:51:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-09 13:28:02 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: storePasswordModal
|
|
|
|
OnboardingComponents.CreatePasswordModal {
|
2022-02-24 12:18:21 +00:00
|
|
|
privacyStore: popup.privacyStore
|
2021-12-09 13:28:02 +00:00
|
|
|
storingPasswordModal: true
|
|
|
|
height: 350
|
2022-04-11 11:39:15 +00:00
|
|
|
|
|
|
|
onOfferToStorePassword: {
|
|
|
|
popup.offerToStorePassword(password, runStoreToKeychainPopup)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: storeToKeychainConfirmationPopupComponent
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: storeToKeychainConfirmationPopup
|
|
|
|
property string password: ""
|
|
|
|
height: 200
|
|
|
|
confirmationText: qsTr("Would you like to store password to the Keychain?")
|
|
|
|
showRejectButton: true
|
|
|
|
showCancelButton: true
|
|
|
|
confirmButtonLabel: qsTr("Store")
|
|
|
|
rejectButtonLabel: qsTr("Not now")
|
|
|
|
cancelButtonLabel: qsTr("Never")
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
|
|
|
|
function finish()
|
|
|
|
{
|
|
|
|
password = ""
|
|
|
|
storeToKeychainConfirmationPopup.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
onConfirmButtonClicked: {
|
|
|
|
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueStore
|
|
|
|
root.privacyStore.storeToKeyChain(password)
|
|
|
|
finish()
|
|
|
|
}
|
|
|
|
|
|
|
|
onRejectButtonClicked: {
|
|
|
|
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueNotNow
|
|
|
|
finish()
|
|
|
|
}
|
|
|
|
|
|
|
|
onCancelButtonClicked: {
|
|
|
|
localAccountSettings.storeToKeychainValue = Constants.storeToKeychainValueNever
|
|
|
|
finish()
|
|
|
|
}
|
2021-12-09 13:28:02 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-13 11:51:47 +00:00
|
|
|
}
|
|
|
|
}
|