diff --git a/Gui/CompanyConf.qml b/Gui/CompanyConf.qml
index 52aa97e..73c6de1 100644
--- a/Gui/CompanyConf.qml
+++ b/Gui/CompanyConf.qml
@@ -2,16 +2,113 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
-Item
+ColumnLayout
{
- property string name: "company"
+ property alias name: companyName
+ property alias street: street
+ property alias house: houseno
+ property alias zipcode: zipcode
+ property alias city: city
anchors.fill: parent
+ anchors.topMargin: 50
- Label
+ RowLayout
{
- text: qsTr("Das Unternehmen")
- anchors.centerIn: parent
- font.pixelSize: 57
- font.bold: true
+ Layout.fillWidth: true
+ Label
+ {
+ text: qsTr("Namen")
+ // font.pixelSize: 57
+ // font.bold: true
+ }
+
+ TextField
+ {
+ id: companyName
+ Layout.fillWidth: true
+ }
+ }
+
+ RowLayout
+ {
+ Layout.fillWidth: true
+ Label
+ {
+ text: qsTr("Straße")
+ // font.pixelSize: 57
+ // font.bold: true
+ }
+
+ TextField
+ {
+ id: street
+ Layout.fillWidth: true
+ }
+
+ Label
+ {
+ text: qsTr("Haus-Nr.")
+ // font.pixelSize: 57
+ // font.bold: true
+ }
+
+ TextField
+ {
+ id: houseno
+ Layout.fillWidth: true
+ }
+ }
+
+
+ RowLayout
+ {
+ Layout.fillWidth: true
+ Label
+ {
+ text: qsTr("PLZ")
+ // font.pixelSize: 57
+ // font.bold: true
+ }
+
+ ComboBox
+ {
+ id: zipcode
+ Layout.fillWidth: true
+ editable: true
+ model: address_model
+ textRole: "display"
+ popup.height: 300
+ popup.y: zipcode.y + 5 - (zipcode.height * 2)
+ //currentIndex: -1
+ onCurrentIndexChanged: city.currentIndex = zipcode.currentIndex
+ validator: RegularExpressionValidator
+ {
+ regularExpression: /([0-9]{1,5})/
+ }
+ }
+
+ Label
+ {
+ text: qsTr("Stadt")
+ // font.pixelSize: 57
+ // font.bold: true
+ }
+
+ ComboBox
+ {
+ id: city
+ Layout.fillWidth: true
+ editable: true
+ model: address_model
+ textRole: "city"
+ popup.height: 300
+ popup.y: zipcode.y + 5 - (zipcode.height * 2)
+ currentIndex: -1
+ }
+ }
+
+ Item
+ {
+ Layout.fillHeight: true
}
}
diff --git a/Gui/MiscConf.qml b/Gui/MiscConf.qml
new file mode 100755
index 0000000..b7cbd29
--- /dev/null
+++ b/Gui/MiscConf.qml
@@ -0,0 +1,22 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+ColumnLayout
+{
+ property alias sysTray: sysTray
+ anchors.fill: parent
+ anchors.topMargin: 35
+
+ Switch
+ {
+ id: sysTray
+ text: qsTr("Beim minimieren, in der Taskleiste anzeigen")
+ checked: config.systray()
+ }
+
+ Item
+ {
+ Layout.fillHeight: true
+ }
+}
diff --git a/Gui/ObjectAddOnContactPerson.qml b/Gui/ObjectAddOnContactPerson.qml
index 1d7eee3..1ffdb82 100644
--- a/Gui/ObjectAddOnContactPerson.qml
+++ b/Gui/ObjectAddOnContactPerson.qml
@@ -15,7 +15,7 @@ GridLayout
ComboBox
{
- property string name: "contacttype"
+ //property string name: "contacttype"
id: contacttype
Layout.fillWidth: true
editable: false
@@ -150,6 +150,7 @@ GridLayout
{
contacts[num_contacts] = {}
contacts[num_contacts]["title"] = title.currentText
+ contacts[num_contacts]["ctype"] = contacttype.currentText
contacts[num_contacts]["fname"] = firstname.text.trim()
contacts[num_contacts]["lname"] = lastname.text.trim()
contacts[num_contacts]["phone"] = phonenumber.text.trim()
@@ -261,7 +262,7 @@ GridLayout
id: mainRect
Layout.fillWidth: true
implicitHeight: 100
- color: "salmon" // firstname.palette.base
+ color: firstname.palette.base
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
clip: true
@@ -310,32 +311,32 @@ GridLayout
//spacing: 3
Text
{
- text: qsTr('Name: ') + model.name
+ text: '' + qsTr('Name: ') + '' + model.name
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
- text: qsTr('Telefon: ') + model.phone
+ text: '' + qsTr('Telefon: ') + '' + model.phone
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
- text: qsTr('Handy: ') + model.mobile
+ text: '' + qsTr('Handy: ') + '' + model.mobile
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
- text: qsTr('Position: ') + model.posizion
+ text: '' + qsTr('Position: ') + '' + model.posizion
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
- text: qsTr('Typ: ') + model.cdata
+ text: '' + qsTr('Typ: ') + '' + model.cdata
horizontalAlignment: Text.AlignLeft
color: "white"
}
diff --git a/Gui/PyqcrmConf.qml b/Gui/PyqcrmConf.qml
index b37913c..d112b85 100644
--- a/Gui/PyqcrmConf.qml
+++ b/Gui/PyqcrmConf.qml
@@ -4,6 +4,8 @@ import QtQuick.Layouts
Item
{
+ property alias companyConf: companyConf
+ property alias miscConf: miscConf
anchors.fill: parent
TabBar
{
@@ -27,6 +29,10 @@ Item
text: qsTr("Sicherung")
}
+ TabButton
+ {
+ text: qsTr("Sonstiges")
+ }
}
StackLayout
@@ -72,6 +78,15 @@ Item
}
}
+ Item
+ {
+ id: miscelanea
+ MiscConf
+ {
+ id: miscConf
+ anchors.fill: parent
+ }
+ }
}
RowLayout
@@ -101,7 +116,10 @@ Item
break
case 2:
- console.log("Need to update company's info.")
+ updateCompanyInfo()
+ break
+ case 4:
+ updateMiscConf()
break
default:
console.log("Need to handle users")
@@ -109,4 +127,28 @@ Item
}
}
}
+
+ function updateCompanyInfo()
+ {
+ var company = {}
+ company['company'] = {}
+ company['company']['NAME'] = companyConf.name.text.trim()
+ company['company']['STREET'] = companyConf.street.text.trim()
+ company['company']['HOUSE'] = companyConf.house.text.trim()
+ company['company']['ZIPCODE'] = companyConf.zipcode.editText? companyConf.zipcode.editText.trim(): companyConf.zipcode.currentText
+ company['company']['CITY'] = companyConf.city.editText? companyConf.city.editText.trim(): companyConf.city.currentText
+
+ if (company['company']['NAME'] === '' || company['company']['STREET'] === '' ||
+ company['company']['HOUSE'] === '' || company['company']['ZIPCODE'] === '' ||
+ company['company']['CITY'] === '');
+ else config.saveCompanyInfo(company)
+ }
+
+ function updateMiscConf()
+ {
+ var misc = {}
+ misc['misc'] = {}
+ misc['misc']['SYSTRAY'] = miscConf.sysTray.checked
+ config.saveMiscConf(misc)
+ }
}
diff --git a/Gui/main.qml b/Gui/main.qml
index 3d43405..f3c1c06 100644
--- a/Gui/main.qml
+++ b/Gui/main.qml
@@ -62,19 +62,6 @@ ApplicationWindow
property alias window: appWindow
}
- Component.onCompleted:
- {
- if(bad_config)
- {
- importDialog.open()
- }
- else
- {
- if (db_con) appLoader.source= "LoginScreen.qml"
- else appLoader.source= "NoDbConnection.qml"
- }
- }
-
Dialog
{
id: importDialog
@@ -127,4 +114,43 @@ ApplicationWindow
}
}
}
+
+ Component.onCompleted:
+ {
+ systray.activated.connect(showWindow)
+ if(bad_config)
+ {
+ importDialog.open()
+ }
+ else
+ {
+ if (db_con) appLoader.source= "LoginScreen.qml"
+ else appLoader.source= "NoDbConnection.qml"
+ }
+ }
+
+ function showWindow(why)
+ {
+ if (why === 3)
+ {
+ systray.setVisible(false)
+ appWindow.show()
+ }
+ }
+ onVisibilityChanged:
+ {
+ if (appWindow.visibility === Window.Minimized && config.systray())
+ {
+ systray.setVisible(true)
+ appWindow.hide()
+ }
+ }
+
+ onClosing: (close) =>
+ {
+ if (false)
+ {
+ console.log("Main window closed!! Was soll ich tun? kann ich mich beenden?!")
+ }
+ }
}
diff --git a/images/tero.jpg b/images/tero.jpg
new file mode 100644
index 0000000..a7c43e3
Binary files /dev/null and b/images/tero.jpg differ
diff --git a/lib/ConfigLoader.py b/lib/ConfigLoader.py
index b56ce66..b2d58cc 100644
--- a/lib/ConfigLoader.py
+++ b/lib/ConfigLoader.py
@@ -245,3 +245,21 @@ class ConfigLoader(QObject):
self.__encrypt_key = toml.dumps(self.getConfig())
self.saveRecoveryKey(filename, password)
+ @Slot(dict)
+ def saveCompanyInfo(self, company = None):
+ self.__config.update(company)
+ self.__saveConfig()
+
+ @Slot(result = dict)
+ def getCompanyInfo():
+ return self.__config['company']
+
+ @Slot(dict)
+ def saveMiscConf(self, misc_conf = None):
+ self.__config.update(misc_conf)
+ self.__saveConfig()
+
+ @Slot(result = bool)
+ def systray(self):
+ return self.__config['misc']['SYSTRAY']
+
diff --git a/lib/DB/ObjectModel.py b/lib/DB/ObjectModel.py
index e7b2e95..405d011 100644
--- a/lib/DB/ObjectModel.py
+++ b/lib/DB/ObjectModel.py
@@ -33,7 +33,7 @@ class ObjectModel(QAbstractTableModel):
print(new_objcontact)
- self.__object_dao.addObject(new_object, new_objcontact, self.__key)
+ #self.__object_dao.addObject(new_object, new_objcontact, self.__key)
# @Slot(str)
# def viewCriterion(self, criterion, processed = False, fired = False):
diff --git a/main.py b/main.py
index 8184fb2..2bec9ea 100644
--- a/main.py
+++ b/main.py
@@ -2,7 +2,8 @@
import os
import sys
import logging
-from PySide6.QtGui import QGuiApplication
+from PySide6.QtWidgets import QSystemTrayIcon
+from PySide6.QtGui import QGuiApplication, QIcon
from PySide6.QtQml import QQmlApplicationEngine
#from PySide6.QtCore import QResource
from lib.ConfigLoader import ConfigLoader
@@ -86,6 +87,13 @@ if __name__ == "__main__":
qml_file = "qrc:/Gui/main.qml"
+ icon = QIcon(":/images/tero.jpg")
+ app.setWindowIcon(QIcon(icon))
+
+ tray = QSystemTrayIcon()
+ tray.setIcon(icon)
+ tray.setToolTip("PYQCRM")
+
config = ConfigLoader()
if not config.getConfig():
@@ -98,6 +106,7 @@ if __name__ == "__main__":
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
engine.rootContext().setContextProperty("db_con", db_con)
engine.rootContext().setContextProperty("config", config)
+ engine.rootContext().setContextProperty("systray", tray)
engine.load(qml_file)
diff --git a/pyqcrm.qrc b/pyqcrm.qrc
index 6fd41f3..f53ef9a 100644
--- a/pyqcrm.qrc
+++ b/pyqcrm.qrc
@@ -20,5 +20,7 @@
images/account.svg
README
LICENSE
+ ../tero.jpg
+ images/tero.jpg
diff --git a/qml.qrc b/qml.qrc
index a524421..d1ad983 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -45,5 +45,6 @@
Gui/CompanyConf.qml
Gui/Firststart.qml
Gui/BackupSettings.qml
+ Gui/MiscConf.qml