diff --git a/Gui/BackupSettings.qml b/Gui/BackupSettings.qml new file mode 100644 index 0000000..4a31706 --- /dev/null +++ b/Gui/BackupSettings.qml @@ -0,0 +1,103 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Dialogs + +GridLayout +{ + anchors.fill: parent + anchors.topMargin: 150 + columns: 2 + Label + { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + text: qsTr("Sicherung") + font.pixelSize: 35 + + } + + Label + { + text: qsTr("Konfiguration") + Layout.alignment: Qt.AlignRight + + } + Button + { + id: saveConfig + text: qsTr("Jetzt sichern!") + onClicked: settingsFileDialog.open() + } + Label + { + text: qsTr("Verschlüsselung") + Layout.alignment: Qt.AlignRight + } + Button + { + id: saveEncryption + text: qsTr("Jetzt sichern!") + onClicked: Firsts.open() + } + Item + { + id: spacer + Layout.fillHeight: true + } + Dialog + { + anchors.centerIn: parent + id: dialog + title: "Title" + standardButtons: Dialog.Apply | Dialog.Cancel + + onApplied: + { + + if (configPwd.text === repeatConfigPwd.text) + { console.log("true") + saveConfigFile.open() + } + else + { + configPwd.text = "" + configPwd.placeholderText = qsTr("Passwort stimmt nicht überein") + configPwd.placeholderTextColor = "red" + repeatConfigPwd.placeholderText = qsTr("") + repeatConfigPwd.text = "" + console.log("false") + } + } + onRejected: console.log("Cancel clicked") + GridLayout + { + columns: 2 + Label + { + text: qsTr("Passwort eingeben") + } + TextField + { + id: configPwd + placeholderText: qsTr("Sicherungspasswort festlegen") + } + Label + { + text: qsTr("Passwort wiederholen") + } + TextField + { + id: repeatConfigPwd + placeholderText: qsTr("Sicherungspasswort wiederholen") + } + + } + } + FileDialog + { + id: saveConfigFile + fileMode: FileDialog.SaveFile + + } +} diff --git a/Gui/CompanyConf.qml b/Gui/CompanyConf.qml new file mode 100644 index 0000000..52aa97e --- /dev/null +++ b/Gui/CompanyConf.qml @@ -0,0 +1,17 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls + +Item +{ + property string name: "company" + anchors.fill: parent + + Label + { + text: qsTr("Das Unternehmen") + anchors.centerIn: parent + font.pixelSize: 57 + font.bold: true + } +} diff --git a/Gui/firststart.qml b/Gui/Firststart.qml similarity index 88% rename from Gui/firststart.qml rename to Gui/Firststart.qml index 38544a8..7c2a134 100644 --- a/Gui/firststart.qml +++ b/Gui/Firststart.qml @@ -11,7 +11,10 @@ Item { property string recpass: "" property bool adminAvailable: true + property alias recoverEnc: recoveryPaswordDialog + property alias first: firstStartItem + id: firstStartItem anchors.fill: parent StackView { @@ -87,6 +90,7 @@ Item Dialog { + id: recoveryPaswordDialog modal: true title: qsTr("Wiederherstellung") @@ -115,6 +119,19 @@ Item implicitWidth: 300 placeholderText: qsTr("Hier Wiederherstellungspasswort eingeben") } + Label + { + text: qsTr("Wiederherstellungspasswort eingeben: ") + } + + TextField + { + id: repeatRecoveryPaswordInput + text: "" + echoMode: TextInput.Password + implicitWidth: 300 + placeholderText: qsTr("Hier Wiederherstellungspasswort eingeben") + } } } } diff --git a/Gui/ObjectAddOnContactPerson.qml b/Gui/ObjectAddOnContactPerson.qml index 7d99aae..0d93195 100644 --- a/Gui/ObjectAddOnContactPerson.qml +++ b/Gui/ObjectAddOnContactPerson.qml @@ -231,6 +231,25 @@ GridLayout } } + Component + { + id: highlight + Rectangle + { + width: 230; height: 15 + color: "lightsteelblue"; radius: 5 + y: contactView.currentItem.y + Behavior on y + { + SpringAnimation + { + spring: 3 + damping: 0.2 + } + } + } + } + Rectangle { id: mainRect @@ -242,6 +261,7 @@ GridLayout ListView { id: contactView + implicitHeight: parent.height implicitWidth: parent.width model: contactModel @@ -249,10 +269,13 @@ GridLayout highlight: Rectangle { color: "grey"} highlightFollowsCurrentItem: false + onActiveFocusChanged: if(!focus) currentIndex = -1 delegate: Item + { width: contactView.width + height: 15 MouseArea { @@ -264,6 +287,7 @@ GridLayout } } + Row { //spacing: 9 @@ -297,6 +321,8 @@ GridLayout } } } + + } } } diff --git a/Gui/PyqcrmConf.qml b/Gui/PyqcrmConf.qml new file mode 100644 index 0000000..76a5d84 --- /dev/null +++ b/Gui/PyqcrmConf.qml @@ -0,0 +1,108 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item +{ + anchors.fill: parent + TabBar + { + id: bar + width: parent.width + TabButton + { + text: qsTr("Benutzer") + } + TabButton + { + text: qsTr("Datenbank") + } + TabButton + { + text: qsTr("Das Unternehmen") + } + TabButton + { + text: qsTr("Sicherung") + } + } + + StackLayout + { + id: confContainer + anchors.fill: parent + currentIndex: bar.currentIndex + Item + { + id: userTab + UsersPage + { + id: usersPage + anchors.fill: parent + } + } + Item + { + id: dbTab + DbConfiguration + { + id: dbConf + anchors.fill: parent + } + } + Item + { + id: companyTab + CompanyConf + { + id: companyConf + anchors.fill: parent + } + } + Item + { + id: backup + BackupSettings + { + id: backupSettings + anchors.fill: parent + } + } + } + + RowLayout + { + width: parent.width + anchors.bottom: parent.bottom + Item + { + Layout.fillWidth: true + } + + Button + { + text: qsTr("Ablehnen") + onClicked: appLoader.source = "Dashboard.qml" + } + + Button + { + text: qsTr("Speichern") + onClicked: + { + switch (confContainer.currentIndex) + { + case 1: + console.log("Need to update DB paramenters") + break + + case 2: + console.log("Need to update company's info.") + break + default: + console.log("Need to handle users") + } + } + } + } +} diff --git a/Gui/TopBar.qml b/Gui/TopBar.qml index 758dfb0..16bf968 100644 --- a/Gui/TopBar.qml +++ b/Gui/TopBar.qml @@ -178,8 +178,15 @@ RowLayout id: mainMenu MenuItem { - text: qsTr("Benutzer-Verwaltung") - onTriggered: appLoader.source = "UsersPage.qml" + //text: qsTr("Benutzer-Verwaltung") + //onTriggered: appLoader.source = "UsersPage.qml" + text: qsTr("Einstellungen") + onTriggered: + { + // TODO: Check if logged-in user is admin first!! + + appLoader.source = "PyqcrmConf.qml" + } } MenuSeparator {} MenuItem { text: qsTr("Als PDF exportieren") } diff --git a/Gui/UsersPage.qml b/Gui/UsersPage.qml index 31d8c59..e9a9ec2 100644 --- a/Gui/UsersPage.qml +++ b/Gui/UsersPage.qml @@ -4,6 +4,7 @@ import QtQuick.Controls Item { + property string name: "users" anchors.fill: parent Label diff --git a/Gui/main.qml b/Gui/main.qml index 2e85370..2d65ba1 100644 --- a/Gui/main.qml +++ b/Gui/main.qml @@ -12,6 +12,7 @@ ApplicationWindow visible: true title: "PYQCRM" property string confile: "" + property alias settingsFileDialog: settingsFiledialog TopBar { @@ -80,12 +81,13 @@ ApplicationWindow anchors.centerIn: parent standardButtons: Dialog.Yes | Dialog.No onAccepted: settingsFiledialog.open() - onRejected: appLoader.source= "firststart.qml" + onRejected: appLoader.source= "Firststart.qml" title: qsTr("Einstellungen importieren") } FileDialog { + id: settingsFiledialog title: qsTr("PYQCRM Einstellungen") currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0] diff --git a/enc_key_backup.txt b/enc_key_backup.txt new file mode 100644 index 0000000..a4915d4 --- /dev/null +++ b/enc_key_backup.txt @@ -0,0 +1 @@ +Lj30yFOP7hJmY5Cub1Go8fJz0UE+Zyo9cEqNxfY23Sc= diff --git a/lib/Vermasseln.py b/lib/Vermasseln.py index 7857100..72e3190 100644 --- a/lib/Vermasseln.py +++ b/lib/Vermasseln.py @@ -20,7 +20,7 @@ class Vermasseln: return storable_data - def entschluesseln(self, data, local= True): + def entschluesseln(self, data, local = True): try: data_list = data.split(".") encoded_data = [b64decode(x) for x in data_list] @@ -37,7 +37,7 @@ class Vermasseln: return decrypted_data - def __vermasslungsKobold(self, local= True): + def __vermasslungsKobold(self, local = True): key = platform.processor().encode("utf-8") if local else b"(==daniishtverhaftetwegensexy#)" key = key[0:31] hash_key = SHA256.new(key) diff --git a/pyqcrm.qrc b/pyqcrm.qrc deleted file mode 100644 index 6fd41f3..0000000 --- a/pyqcrm.qrc +++ /dev/null @@ -1,24 +0,0 @@ - - - qtquickcontrols2.conf - images/add.svg - images/addbusiness.svg - images/addperson.svg - images/filter.svg - images/menu.svg - images/search.svg - sounds/error.ogg - sounds/fail2c.ogg - sounds/puzzerr.ogg - sounds/sysnotify.ogg - sounds/wrong.ogg - fonts/Damarwulan.ttf - fonts/HelloStranger.otf - fonts/HussarPrintA.otf - fonts/LittleBirdsRegular.ttf - fonts/ReginaldScript.ttf - images/account.svg - README - LICENSE - - diff --git a/qml.qrc b/qml.qrc deleted file mode 100644 index 1e6ca28..0000000 --- a/qml.qrc +++ /dev/null @@ -1,46 +0,0 @@ - - - Gui/TopBar.qml - Gui/AdminUserConfig.qml - Gui/EncryptionKey.qml - Gui/DbConfiguration.qml - Gui/LoginScreen.qml - Gui/AddContact.qml - Gui/AddCustomer.qml - Gui/CustomerTable.qml - Gui/Dashboard.qml - Gui/EmployeeTable.qml - Gui/firststart.qml - Gui/main.qml - Gui/SearchBar.qml - js/qmldict.js - Gui/CustomerView.qml - Gui/NoDbConnection.qml - Gui/Notifications.qml - Gui/ObjectTable.qml - Gui/AddObject.qml - Gui/ObjectView.qml - Gui/ObjectAddOns.qml - Gui/ObjectAddOnContactPerson.qml - Gui/ObjectAddOnEmployee.qml - Gui/AddObjectEmployee.qml - Gui/AddApplicant.qml - Gui/ApplicantPersonalData.qml - Gui/ApplicantBankData.qml - Gui/ApplicantNationalInsurance.qml - Gui/ApplicantVarious.qml - Gui/CustomersTable.qml - Gui/CustomerDetails.qml - Gui/ObjectsTable.qml - Gui/EmployeesTable.qml - Gui/EmployeeDetails.qml - Gui/ObjectDetails.qml - Gui/AddNewObject.qml - Gui/PrinterDialog.qml - Gui/CustomerContactDetails.qml - Gui/NoCustomerContact.qml - Gui/CustomerDetailsView.qml - Gui/ReadMe.qml - Gui/UsersPage.qml - -