Compare commits
3 Commits
821da47f98
...
35c977c89e
| Author | SHA256 | Date | |
|---|---|---|---|
| 35c977c89e | |||
| bd232a2a28 | |||
| b414a050be |
@@ -30,7 +30,7 @@ GridLayout
|
||||
{
|
||||
id: saveConfig
|
||||
text: qsTr("Jetzt sichern!")
|
||||
onClicked: dialog.open()
|
||||
onClicked: utilityDialogs.item.backup_config.open()
|
||||
}
|
||||
Label
|
||||
{
|
||||
@@ -41,75 +41,17 @@ GridLayout
|
||||
{
|
||||
id: saveEncryption
|
||||
text: qsTr("Jetzt sichern!")
|
||||
onClicked: apploader.item.recoverEnc.open()
|
||||
onClicked: utilityDialogs.item.backup_encrypt_pw.open()
|
||||
}
|
||||
Item
|
||||
{
|
||||
id: spacer
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
Dialog
|
||||
{
|
||||
anchors.centerIn: parent
|
||||
id: dialog
|
||||
title: "Title"
|
||||
standardButtons: Dialog.Apply | Dialog.Cancel
|
||||
|
||||
onApplied:
|
||||
Loader
|
||||
{
|
||||
|
||||
if (configPwd.text === repeatConfigPwd.text)
|
||||
{
|
||||
|
||||
saveConfigFile.open()
|
||||
}
|
||||
else
|
||||
{
|
||||
configPwd.text = ""
|
||||
configPwd.placeholderText = qsTr("Passwort stimmt nicht überein")
|
||||
configPwd.placeholderTextColor = "red"
|
||||
repeatConfigPwd.placeholderText = qsTr("")
|
||||
repeatConfigPwd.text = ""
|
||||
}
|
||||
}
|
||||
onRejected: console.log("Cancel clicked")
|
||||
GridLayout
|
||||
{
|
||||
id: gridPw
|
||||
columns: 2
|
||||
Label
|
||||
{
|
||||
text: qsTr("Passwort eingeben")
|
||||
}
|
||||
TextField
|
||||
{
|
||||
|
||||
id: configPwd
|
||||
placeholderText: qsTr("Sicherungspasswort festlegen")
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Passwort wiederholen")
|
||||
}
|
||||
TextField
|
||||
{
|
||||
property string name: "password"
|
||||
id: repeatConfigPwd
|
||||
placeholderText: qsTr("Sicherungspasswort wiederholen")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
FileDialog
|
||||
{
|
||||
id: saveConfigFile
|
||||
fileMode: FileDialog.SaveFile
|
||||
nameFilters: ["PYQCRM Recovery files (*.pyqrec)"]
|
||||
currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
|
||||
onAccepted:
|
||||
{
|
||||
var pw = JsLib.parseForm(gridPw)
|
||||
config.backupConfig(saveConfigFile.currentFile, pw["password"])
|
||||
}
|
||||
id: utilityDialogs
|
||||
source: "UtilityDialogs.qml"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,12 @@ import QtCore
|
||||
import "../js/qmldict.js" as Qmldict
|
||||
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
property string recpass: ""
|
||||
property bool adminAvailable: true
|
||||
property alias recoverEnc: recoveryPaswordDialog
|
||||
|
||||
|
||||
id: firstStartItem
|
||||
anchors.fill: parent
|
||||
@@ -72,7 +73,6 @@ Item
|
||||
MessageDialog
|
||||
{
|
||||
id: recoveryDialog
|
||||
|
||||
text: qsTr("Diesen Wiederherstellungscode musst du sicher aufbewahren!\nMöchtest du das jetzt machen?")
|
||||
title: qsTr("Wiederherstellen")
|
||||
buttons: MessageDialog.Yes | MessageDialog.No
|
||||
@@ -156,6 +156,12 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
id: utilityDialogs
|
||||
source: "UtilityDialogs.qml"
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
config.dbConnectionError.connect(onDbConnectionError)
|
||||
@@ -163,15 +169,10 @@ Item
|
||||
config.backupEncryptionKey.connect(onBackupEncryptionKey)
|
||||
}
|
||||
|
||||
function gotoLogin()
|
||||
{
|
||||
appLoader.source= "LoginScreen.qml"
|
||||
topBar.visible = true
|
||||
}
|
||||
|
||||
function onBackupEncryptionKey()
|
||||
{
|
||||
recoveryDialog.open()
|
||||
|
||||
utilityDialogs.item.recoveryDialog.open()
|
||||
}
|
||||
|
||||
function onDbConnectionError(msg, success)
|
||||
@@ -192,5 +193,4 @@ Item
|
||||
firstStart.push("AdminUserConfig.qml")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ Item {
|
||||
id: objectsStack
|
||||
anchors.fill: parent
|
||||
initialItem: "ObjectsTable.qml"
|
||||
anchors.margins: 9
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
17
Gui/OfferTable.qml
Normal file
17
Gui/OfferTable.qml
Normal file
@@ -0,0 +1,17 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
StackView
|
||||
{
|
||||
id: employeesStack
|
||||
anchors.fill: parent
|
||||
initialItem: "OffersTable.qml"
|
||||
anchors.margins: 9
|
||||
}
|
||||
}
|
||||
|
||||
15
Gui/OffersTable.qml
Normal file
15
Gui/OffersTable.qml
Normal file
@@ -0,0 +1,15 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
Item
|
||||
{
|
||||
property var availableFilters: []
|
||||
|
||||
SearchBar
|
||||
{
|
||||
id:searchBar
|
||||
anchors.margins: 9
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,37 @@ RowLayout
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: offers
|
||||
flat: true
|
||||
text: qsTr("Angebote")
|
||||
implicitWidth: abrechnung.implicitContentWidth + 10
|
||||
Layout.margins: 3
|
||||
background: Rectangle
|
||||
{
|
||||
id: offersBackie
|
||||
border.width: offers.activeFocus ? 2 : 1
|
||||
border.color: "#888"
|
||||
radius: 4
|
||||
gradient: Gradient
|
||||
{
|
||||
GradientStop { position: 0 ; color: offers.pressed ? "#000" : "#001" }
|
||||
GradientStop { position: 1 ; color: offers.pressed ? "#100" : "#000" }
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
{
|
||||
appLoader.source = "OfferTable.qml"
|
||||
mitoBackie.border.width = 2
|
||||
dashiBackie.border.width = 1
|
||||
kundiBackie.border.width = 1
|
||||
invoBackie.border.width = 1
|
||||
objBackie.border.width = 1
|
||||
offersBackie.border.width = 1
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: abrechnung
|
||||
|
||||
208
Gui/UtilityDialogs.qml
Normal file
208
Gui/UtilityDialogs.qml
Normal file
@@ -0,0 +1,208 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import QtCore
|
||||
import "../js/qmldict.js" as JsLib
|
||||
|
||||
Item
|
||||
{
|
||||
id: utilityDialogs
|
||||
property alias backup_config: backupConfig
|
||||
property alias backup_encrypt_pw: recoveryPasswordDialog
|
||||
|
||||
property var recpass
|
||||
property var configpass
|
||||
Dialog
|
||||
{
|
||||
|
||||
anchors.centerIn: parent
|
||||
id: backupConfig
|
||||
title: "Backup Config"
|
||||
standardButtons: Dialog.Apply | Dialog.Cancel
|
||||
|
||||
onApplied:
|
||||
{
|
||||
|
||||
if (configPwd.text === repeatConfigPwd.text)
|
||||
{
|
||||
configpass = repeatConfigPwd.text
|
||||
saveConfigFile.open()
|
||||
}
|
||||
else
|
||||
{
|
||||
configPwd.text = ""
|
||||
configPwd.placeholderText = qsTr("Passwort stimmt nicht überein")
|
||||
configPwd.placeholderTextColor = "red"
|
||||
repeatConfigPwd.placeholderText = qsTr("")
|
||||
repeatConfigPwd.text = ""
|
||||
}
|
||||
}
|
||||
onRejected: resetRecoveryConfigDialog()
|
||||
GridLayout
|
||||
{
|
||||
id: gridPw
|
||||
columns: 2
|
||||
Label
|
||||
{
|
||||
text: qsTr("Passwort eingeben")
|
||||
}
|
||||
TextField
|
||||
{
|
||||
|
||||
id: configPwd
|
||||
placeholderText: qsTr("Sicherungspasswort festlegen")
|
||||
echoMode: TextInput.Password
|
||||
implicitWidth: 300
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Passwort wiederholen")
|
||||
}
|
||||
TextField
|
||||
{
|
||||
property string name: "password"
|
||||
id: repeatConfigPwd
|
||||
placeholderText: qsTr("Sicherungspasswort wiederholen")
|
||||
echoMode: TextInput.Password
|
||||
implicitWidth: 300
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: saveConfigFile
|
||||
fileMode: FileDialog.SaveFile
|
||||
nameFilters: ["PYQCRM Recovery files (*.pyqrec)"]
|
||||
currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
|
||||
onAccepted:
|
||||
{
|
||||
config.backupConfig(saveConfigFile.currentFile, configpass)
|
||||
}
|
||||
onRejected:
|
||||
{
|
||||
backupConfig.close()
|
||||
resetRecoveryConfigDialog()
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: recoveryDialog
|
||||
|
||||
text: qsTr("Diesen Wiederherstellungscode musst du sicher aufbewahren!\nMöchtest du das jetzt machen?")
|
||||
title: qsTr("Wiederherstellen")
|
||||
buttons: MessageDialog.Yes | MessageDialog.No
|
||||
onAccepted: recoveryPasswordDialog.open()
|
||||
onRejected: gotoLogin()
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: conErrDialog
|
||||
text: qsTr("Datenbankverbindung fehlgeschlagen")
|
||||
title: qsTr("Datenbank Verbindung")
|
||||
}
|
||||
|
||||
Dialog
|
||||
{
|
||||
|
||||
id: recoveryPasswordDialog
|
||||
modal: true
|
||||
title: qsTr("Wiederherstellung")
|
||||
anchors.centerIn: parent
|
||||
standardButtons: Dialog.Apply | Dialog.Cancel
|
||||
onApplied:
|
||||
{
|
||||
if (recoveryPasswordInput.text === repeatRecoveryPasswordInput.text)
|
||||
{
|
||||
recpass = recoveryPasswordInput.text
|
||||
saveRecoveryDialog.open()
|
||||
}
|
||||
else
|
||||
{
|
||||
recoveryPasswordInput.text = ""
|
||||
recoveryPasswordInput.placeholderText = qsTr("Passwort stimmt nicht überein")
|
||||
recoveryPasswordInput.placeholderTextColor = "red"
|
||||
repeatRecoveryPasswordInput.placeholderText = qsTr("")
|
||||
repeatRecoveryPasswordInput.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
onClosed: resetRecoveryPwDialog()
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
GridLayout
|
||||
{
|
||||
columns: 2
|
||||
Label
|
||||
{
|
||||
text: qsTr("Wiederherstellungspasswort festlegen: ")
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: recoveryPasswordInput
|
||||
text: ""
|
||||
echoMode: TextInput.Password
|
||||
implicitWidth: 300
|
||||
placeholderText: qsTr("Hier Wiederherstellungspasswort eingeben")
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Wiederherstellungspasswort wiederholen: ")
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: repeatRecoveryPasswordInput
|
||||
text: ""
|
||||
echoMode: TextInput.Password
|
||||
implicitWidth: 300
|
||||
placeholderText: qsTr("Hier Wiederherstellungspasswort wiederholen")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: saveRecoveryDialog
|
||||
title: qsTr("Wiederherstellungsdatei")
|
||||
fileMode: FileDialog.SaveFile
|
||||
nameFilters: ["PYQCRM Recovery files (*.pyqrec)"]
|
||||
currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
|
||||
onAccepted:
|
||||
{
|
||||
config.backupEncryptkey(saveRecoveryDialog.currentFile, recpass)
|
||||
}
|
||||
|
||||
onRejected:
|
||||
{
|
||||
recoveryPasswordDialog.close()
|
||||
resetRecoveryPwDialog()
|
||||
}
|
||||
}
|
||||
|
||||
function resetRecoveryPwDialog()
|
||||
{
|
||||
recoveryPasswordInput.text = ""
|
||||
recoveryPasswordInput.placeholderText = qsTr("Hier Wiederherstellungspasswort eingeben")
|
||||
recoveryPasswordInput.placeholderTextColor = repeatRecoveryPasswordInput.placeholderTextColor
|
||||
repeatRecoveryPasswordInput.text = ""
|
||||
repeatRecoveryPasswordInput.placeholderText = qsTr("Hier Wiederherstellungspasswort wiederholen")
|
||||
}
|
||||
|
||||
function resetRecoveryConfigDialog()
|
||||
{
|
||||
configPwd.text = ""
|
||||
configPwd.placeholderText = qsTr("Hier Wiederherstellungspasswort eingeben")
|
||||
configPwd.placeholderTextColor = repeatConfigPwd.placeholderTextColor
|
||||
repeatConfigPwd.text = ""
|
||||
repeatConfigPwd.placeholderText = qsTr("Hier Wiederherstellungspasswort wiederholen")
|
||||
}
|
||||
}
|
||||
10
Gui/main.qml
10
Gui/main.qml
@@ -62,6 +62,7 @@ ApplicationWindow
|
||||
property alias window: appWindow
|
||||
}
|
||||
|
||||
|
||||
Dialog
|
||||
{
|
||||
id: importDialog
|
||||
@@ -117,7 +118,9 @@ ApplicationWindow
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
config.configurationReady.connect(goToLogin)
|
||||
systray.activated.connect(showWindow)
|
||||
|
||||
if(bad_config)
|
||||
{
|
||||
importDialog.open()
|
||||
@@ -129,6 +132,7 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showWindow(why)
|
||||
{
|
||||
if (why === 3)
|
||||
@@ -153,4 +157,10 @@ ApplicationWindow
|
||||
console.log("Main window closed!! Was soll ich tun? kann ich mich beenden?!")
|
||||
}
|
||||
}
|
||||
|
||||
function goToLogin()
|
||||
{
|
||||
appLoader.source= "LoginScreen.qml"
|
||||
topBar.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
1
images/addoffer.svg
Normal file
1
images/addoffer.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5F6368"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h360v80H200v560h560v-360h80v360q0 33-23.5 56.5T760-120H200Zm120-160v-80h320v80H320Zm0-120v-80h320v80H320Zm0-120v-80h320v80H320Zm360-80v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"/></svg>
|
||||
|
After Width: | Height: | Size: 362 B |
@@ -41,6 +41,7 @@ class ConfigLoader(QObject):
|
||||
else:
|
||||
config_dir.mkdir(0o750, True, True)
|
||||
|
||||
|
||||
@Slot(dict, result = bool)
|
||||
def setConfig(self, app_config):
|
||||
# print(f"In {__file__} file, setConfig()")
|
||||
@@ -110,18 +111,13 @@ class ConfigLoader(QObject):
|
||||
self.backupEncryptionKey.emit()
|
||||
return admin
|
||||
|
||||
"""###################################################"""
|
||||
""" """
|
||||
""" TODO: Rename method and rename self.__encrypt_key """
|
||||
""" """
|
||||
"""###################################################"""
|
||||
|
||||
@Slot(str, str)
|
||||
def saveRecoveryKey(self, recovery_file, recovery_password):
|
||||
# print(f"In {__file__} file, saveRecoveryKey()")
|
||||
def __saveData(self, recovery_file, recovery_password, data):
|
||||
# print(f"In {__file__} file, __saveData()")
|
||||
local = False
|
||||
rp = self.__setRecoveryPassword(recovery_password)
|
||||
rf = rp[1] + self.__encrypt_key + rp[0]
|
||||
rf = rp[1] + data + rp[0]
|
||||
rf = Vermasseln().oscarVermasseln(rf, local)
|
||||
rec_file = urlparse(recovery_file)
|
||||
if os.name == "nt":
|
||||
@@ -197,7 +193,8 @@ class ConfigLoader(QObject):
|
||||
if ek:
|
||||
self.__config = toml.loads(ek)
|
||||
self.__saveConfig()
|
||||
self.configurationReady.emit()
|
||||
self.__configLoad()
|
||||
|
||||
else:
|
||||
self.invalidEncryptionKey.emit()
|
||||
except Exception as e:
|
||||
@@ -242,8 +239,9 @@ class ConfigLoader(QObject):
|
||||
|
||||
@Slot(str, str)
|
||||
def backupConfig(self, filename, password):
|
||||
self.__encrypt_key = toml.dumps(self.getConfig())
|
||||
self.saveRecoveryKey(filename, password)
|
||||
conf_file = toml.dumps(self.getConfig())
|
||||
self.__saveData(filename, password, conf_file)
|
||||
|
||||
|
||||
@Slot(dict)
|
||||
def saveCompanyInfo(self, company = None):
|
||||
@@ -263,3 +261,9 @@ class ConfigLoader(QObject):
|
||||
def systray(self):
|
||||
return self.__config['misc']['SYSTRAY']
|
||||
|
||||
|
||||
@Slot(str, str)
|
||||
def backupEncryptkey(self, filename, password):
|
||||
encrypt_key = self.__config['pyqcrm']['ENCRYPTION_KEY']
|
||||
self.__saveData(filename, password, encrypt_key)
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ class EmployeeModel(QAbstractTableModel):
|
||||
self.__employee_dao.newEmployeeAdded.connect(self.__refreshView)
|
||||
self.__conf = ConfigLoader().getConfig()
|
||||
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
|
||||
print(self.__key)
|
||||
self.__getData()
|
||||
|
||||
@Slot(dict, bool)
|
||||
|
||||
8
main.py
8
main.py
@@ -46,7 +46,7 @@ printers = None
|
||||
user = None
|
||||
|
||||
def initializeProgram():
|
||||
#print(f"In {__file__} file, initializeProgram()")
|
||||
print(f"In {__file__} file, initializeProgram()")
|
||||
global address_model, bad_config, business_model, user, business_type, contact_model, employee_model, object_model, db_con, printers
|
||||
if not bad_config:
|
||||
dbconf = config.getConfig()['database']
|
||||
@@ -63,7 +63,11 @@ def initializeProgram():
|
||||
object_model = ObjectModel()
|
||||
publishContext()
|
||||
|
||||
def configReady():
|
||||
global bad_config
|
||||
bad_config = False
|
||||
initializeProgram()
|
||||
|
||||
|
||||
def publishContext():
|
||||
# print(f"In {__file__} file, publishContext()")
|
||||
@@ -98,7 +102,7 @@ if __name__ == "__main__":
|
||||
|
||||
if not config.getConfig():
|
||||
bad_config = True
|
||||
config.configurationReady.connect(initializeProgram)
|
||||
config.configurationReady.connect(configReady)
|
||||
else:
|
||||
initializeProgram()
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<file>images/account.svg</file>
|
||||
<file>README</file>
|
||||
<file>LICENSE</file>
|
||||
<file>../tero.jpg</file>
|
||||
<file>images/tero.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user