Configuration menu entry

This commit is contained in:
2025-02-26 09:12:34 +01:00
parent b468c3d078
commit 0f253c518d
7 changed files with 169 additions and 6 deletions

17
Gui/CompanyConf.qml Normal file
View File

@@ -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
}
}

View File

@@ -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 Rectangle
{ {
Layout.fillWidth: true Layout.fillWidth: true
@@ -170,16 +189,36 @@ GridLayout
ListView ListView
{ {
id: contactView id: contactView
implicitHeight: parent.height implicitHeight: 500
implicitWidth: parent.width
model: contactModel model: contactModel
header: headline header: headline
highlight: highlight
highlightFollowsCurrentItem: true
focus: true
delegate: Item delegate: Item
{ {
width: parent.width //width: parent.width
width: contactView.width
height: 15 height: 15
MouseArea
{
id: clickedRow
anchors.fill: parent
onClicked:
{
//var currentIndex = index
console.log(index)
console.log(contactView.currentItem.y)
}
}
Row Row
{ {
//spacing: 9 //spacing: 9
@@ -203,6 +242,8 @@ GridLayout
} }
} }
} }
} }
} }
} }

95
Gui/PyqcrmConf.qml Normal file
View File

@@ -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")
}
}
}
}
}

View File

@@ -178,8 +178,15 @@ RowLayout
id: mainMenu id: mainMenu
MenuItem MenuItem
{ {
text: qsTr("Benutzer-Verwaltung") //text: qsTr("Benutzer-Verwaltung")
onTriggered: appLoader.source = "UsersPage.qml" //onTriggered: appLoader.source = "UsersPage.qml"
text: qsTr("Einstellungen")
onTriggered:
{
// TODO: Check if logged-in user is admin first!!
appLoader.source = "PyqcrmConf.qml"
}
} }
MenuSeparator {} MenuSeparator {}
MenuItem { text: qsTr("Als PDF exportieren") } MenuItem { text: qsTr("Als PDF exportieren") }

View File

@@ -4,6 +4,7 @@ import QtQuick.Controls
Item Item
{ {
property string name: "users"
anchors.fill: parent anchors.fill: parent
Label Label

View File

@@ -20,7 +20,7 @@ class Vermasseln:
return storable_data return storable_data
def entschluesseln(self, data, local= True): def entschluesseln(self, data, local = True):
try: try:
data_list = data.split(".") data_list = data.split(".")
encoded_data = [b64decode(x) for x in data_list] encoded_data = [b64decode(x) for x in data_list]
@@ -37,7 +37,7 @@ class Vermasseln:
return decrypted_data 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 = platform.processor().encode("utf-8") if local else b"(==daniishtverhaftetwegensexy#)"
key = key[0:31] key = key[0:31]
hash_key = SHA256.new(key) hash_key = SHA256.new(key)

View File

@@ -42,5 +42,7 @@
<file>Gui/CustomerDetailsView.qml</file> <file>Gui/CustomerDetailsView.qml</file>
<file>Gui/ReadMe.qml</file> <file>Gui/ReadMe.qml</file>
<file>Gui/UsersPage.qml</file> <file>Gui/UsersPage.qml</file>
<file>Gui/PyqcrmConf.qml</file>
<file>Gui/CompanyConf.qml</file>
</qresource> </qresource>
</RCC> </RCC>