From 0f253c518d5e5b75c5b6e6c9f7c59fafaee3dec75aabc7c1e102f1e9a42af251 Mon Sep 17 00:00:00 2001 From: linuxero Date: Wed, 26 Feb 2025 09:12:34 +0100 Subject: [PATCH] Configuration menu entry --- Gui/CompanyConf.qml | 17 ++++++ Gui/ObjectAddOnContactPerson.qml | 45 ++++++++++++++- Gui/PyqcrmConf.qml | 95 ++++++++++++++++++++++++++++++++ Gui/TopBar.qml | 11 +++- Gui/UsersPage.qml | 1 + lib/Vermasseln.py | 4 +- qml.qrc | 2 + 7 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 Gui/CompanyConf.qml create mode 100644 Gui/PyqcrmConf.qml 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/ObjectAddOnContactPerson.qml b/Gui/ObjectAddOnContactPerson.qml index e3ed2f4..45b00ae 100644 --- a/Gui/ObjectAddOnContactPerson.qml +++ b/Gui/ObjectAddOnContactPerson.qml @@ -161,6 +161,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 { Layout.fillWidth: true @@ -170,16 +189,36 @@ GridLayout ListView { id: contactView - implicitHeight: parent.height + implicitHeight: 500 + implicitWidth: parent.width model: contactModel + header: headline + highlight: highlight + + highlightFollowsCurrentItem: true + focus: true + delegate: Item { - width: parent.width + //width: parent.width + width: contactView.width height: 15 + MouseArea + { + id: clickedRow + anchors.fill: parent + onClicked: + { + //var currentIndex = index + console.log(index) + console.log(contactView.currentItem.y) + } + } + Row { //spacing: 9 @@ -203,6 +242,8 @@ GridLayout } } } + + } } } diff --git a/Gui/PyqcrmConf.qml b/Gui/PyqcrmConf.qml new file mode 100644 index 0000000..2527b3e --- /dev/null +++ b/Gui/PyqcrmConf.qml @@ -0,0 +1,95 @@ +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") + } + } + + 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 + } + } + } + + 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/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/qml.qrc b/qml.qrc index 1e6ca28..7996b66 100644 --- a/qml.qrc +++ b/qml.qrc @@ -42,5 +42,7 @@ Gui/CustomerDetailsView.qml Gui/ReadMe.qml Gui/UsersPage.qml + Gui/PyqcrmConf.qml + Gui/CompanyConf.qml