import QtQuick import QtQuick.Layouts import QtQuick.Controls import QtQuick.Dialogs import "../js/qmldict.js" as Qmldict // Item { // benutzername // passwort // server // port // benutzername(db) // passwort(db) // DbName // type // } Item { Component.onCompleted: { config.dbConnectionError.connect(onDbConnectionError) config.adminUserError.connect(onAdminUserError) } function onDbConnectionError(msg, success) { if (!success) conErrDialog.open() } function onAdminUserError(msg, success) { if (success) { encryptPwDialog.open() } else firstStart.push("AdminUserConfig.qml") } MessageDialog { id: conErrDialog text: qsTr("Datenbankverbindung fehlgeschlagen") title: qsTr("Datenbank Verbindung") } Dialog { id: encryptPwDialog modal: true title: qsTr("Encryption Key") 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 } ColumnLayout { RowLayout { Label { text: qsTr("Encryption Key eingeben:") } TextField { id: encryptPassword echoMode: TextInput.Password implicitWidth: 300 placeholderText: qsTr("Hier Encryption Key eingeben") } } } } anchors.fill: parent StackView { id: firstStart anchors.fill: parent initialItem: "DbConfiguration.qml" //initialItem: "AdminUserConfig.qml" } RowLayout { anchors.bottom: parent.bottom anchors.margins: 9 width: parent.width Item { Layout.fillWidth: true } Button { id: cancelBtn text: qsTr("Abbrechen") onClicked: { Qt.quit() } } Button { id: submitBtn text: qsTr("Speichern") property var grids: firstStart.currentItem property var pyqcrm_conf: ({}) property var admin: Boolean onClicked: { if (firstStart.currentItem.name === "database") { pyqcrm_conf = Qmldict.func(submitBtn.grids) if (pyqcrm_conf) { config.setConfig(pyqcrm_conf) } } else { pyqcrm_conf = Qmldict.func(submitBtn.grids) if (pyqcrm_conf) { admin = config.addAdminUser(pyqcrm_conf) if (admin) { appLoader.source = "Dashboard.qml" topBar.visible = true } else { console.log("Konfiguration Admin fehlgeschlagen") } } } } } } }