recoveryfile

This commit is contained in:
2024-12-09 16:35:54 +01:00
parent 1900100b54
commit 5f08435816
8 changed files with 183 additions and 349 deletions

View File

@@ -2,6 +2,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Fusion
import QtQuick.Dialogs
import "../js/qmldict.js" as JsLib
ColumnLayout
@@ -258,6 +259,8 @@ ColumnLayout
id: spacer3
Layout.fillHeight: true
}
function isEmptyField()
{
if (!firmenName.text.trim() || !street.text.trim() || !city.text.trim())

View File

@@ -70,9 +70,13 @@ GridLayout
{
Layout.fillHeight: true
}
Component.onCompleted:
{
config.usernameNotAvailable.connect(usernameNotAvailable)
}
function usernameNotAvailable()
{
@@ -81,6 +85,7 @@ GridLayout
benutzerNamelabel.color = "red"
benutzerNamelabel.font.bold = true
}
}

View File

@@ -2,16 +2,26 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Dialogs
import QtCore
import "../js/qmldict.js" as Qmldict
Item
{
property string recpass: ""
property bool adminAvailable: true
Component.onCompleted:
{
config.dbConnectionError.connect(onDbConnectionError)
config.adminUserError.connect(onAdminUserError)
config.backupEncryptionKey.connect(onBackupEncryptionKey)
}
function onBackupEncryptionKey()
{
recoveryDialog.open()
}
function onDbConnectionError(msg, success)
@@ -27,8 +37,43 @@ Item
encryptPwDialog.open()
}
else
{
adminAvailable = false
firstStart.push("AdminUserConfig.qml")
}
}
MessageDialog
{
id: recoveryDialog
text: qsTr("Diesen Wiederherstellungscode musst du sicher aufbewahren!\nMöchtest du das jetzt machen?")
title: qsTr("Wiederherstellen")
buttons: MessageDialog.Yes | MessageDialog.No
onAccepted: saveRecoveryDialog.open()
}
FileDialog
{
id: saveRecoveryDialog
title: qsTr("Wiederherstellungsdatei")
fileMode: adminAvailable? FileDialog.OpenFile: FileDialog.SaveFile
nameFilters: ["PYQCRM Recovery files (*.pyqrec)"]
currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
onAccepted:
{
if (!adminAvailable) config.saveRecoveryKey(saveRecoveryDialog.currentFile, recpass)
else
{
config.getRecoveryKey(saveRecoveryDialog.currentFile, recpass)
}
appLoader.source = "Dashboard.qml"
topBar.visible = true
}
}
MessageDialog
{
@@ -43,15 +88,14 @@ Item
{
id: encryptPwDialog
modal: true
title: qsTr("Encryption Key")
title: qsTr("Wiederherstellung")
anchors.centerIn: parent
standardButtons: Dialog.Ok | Dialog.Cancel
onAccepted:
{
// TODO: signal for EncryptionKey testing
config.setEncyrptKey(encryptPassword.text)
appLoader.source = "Dashboard.qml"
topBar.visible = true
recpass = encryptPassword.text
saveRecoveryDialog.open()
}
ColumnLayout
{
@@ -59,7 +103,7 @@ Item
{
Label
{
text: qsTr("Encryption Key eingeben:")
text: qsTr("Wiederherstellungspasswort eingeben: ")
}
TextField
@@ -67,12 +111,14 @@ Item
id: encryptPassword
echoMode: TextInput.Password
implicitWidth: 300
placeholderText: qsTr("Hier Encryption Key eingeben")
placeholderText: qsTr("Hier Wiederherstellungspasswort eingeben")
}
}
}
}
anchors.fill: parent
StackView
{
@@ -129,8 +175,8 @@ Item
admin = config.addAdminUser(pyqcrm_conf)
if (admin)
{
appLoader.source = "Dashboard.qml"
topBar.visible = true
//appLoader.source = "Dashboard.qml"
//topBar.visible = true
}
else
{