Compare commits
5 Commits
e81407b43d
...
35c977c89e
| Author | SHA256 | Date | |
|---|---|---|---|
| 35c977c89e | |||
| bd232a2a28 | |||
| b414a050be | |||
| 821da47f98 | |||
| fb81b764f1 |
@@ -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
|
||||
|
||||
Loader
|
||||
{
|
||||
anchors.centerIn: parent
|
||||
id: dialog
|
||||
title: "Title"
|
||||
standardButtons: Dialog.Apply | Dialog.Cancel
|
||||
|
||||
onApplied:
|
||||
{
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
22
Gui/MiscConf.qml
Executable file
22
Gui/MiscConf.qml
Executable file
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ GridLayout
|
||||
{
|
||||
property var contacts: null
|
||||
columns: 2
|
||||
|
||||
Layout.fillWidth: true
|
||||
Label
|
||||
{
|
||||
text: qsTr("Kontaktdaten")
|
||||
@@ -15,7 +15,7 @@ GridLayout
|
||||
|
||||
ComboBox
|
||||
{
|
||||
property string name: "contacttype"
|
||||
//property string name: "contacttype"
|
||||
id: contacttype
|
||||
Layout.fillWidth: true
|
||||
editable: false
|
||||
@@ -150,12 +150,13 @@ 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()
|
||||
contacts[num_contacts]["mobile"] = mobile.text.trim()
|
||||
contacts[num_contacts]["position"] = posizion.text.trim()
|
||||
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), mobile: mobile.text.trim(), posizion: posizion.text.trim()})
|
||||
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), mobile: mobile.text.trim(), posizion: posizion.text.trim(), cdata: contacttype.currentText})
|
||||
if (checkFields())
|
||||
{
|
||||
saveBtn.enabled = true
|
||||
@@ -184,59 +185,65 @@ GridLayout
|
||||
id: contactModel
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: headline
|
||||
Row
|
||||
{
|
||||
Text
|
||||
{
|
||||
id: cpname
|
||||
text: qsTr("Name")
|
||||
width: 175
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
// Component
|
||||
// {
|
||||
// id: headline
|
||||
// Row
|
||||
// {
|
||||
// spacing: 9
|
||||
// Text
|
||||
// {
|
||||
// id: cpname
|
||||
// text: qsTr("Name")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
Text
|
||||
{
|
||||
id: cpphone
|
||||
text: qsTr("Telefon")
|
||||
width: 100
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
// Text
|
||||
// {
|
||||
// id: cpphone
|
||||
// text: qsTr("Telefon")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
Text
|
||||
{
|
||||
id: cpmobile
|
||||
text: qsTr("Mobil")
|
||||
width: 100
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
// Text
|
||||
// {
|
||||
// id: cpmobile
|
||||
// text: qsTr("Mobil")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
Text
|
||||
{
|
||||
id: cppos
|
||||
text: qsTr("Position")
|
||||
width: 150
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
// Text
|
||||
// {
|
||||
// id: cppos
|
||||
// text: qsTr("Position")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
|
||||
// Text
|
||||
// {
|
||||
// id: cttype
|
||||
// text: qsTr("Typ")
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// color: "white"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Component
|
||||
{
|
||||
id: highlight
|
||||
Rectangle
|
||||
{
|
||||
width: 230; height: 15
|
||||
width: parent.width
|
||||
color: "lightsteelblue"; radius: 5
|
||||
y: contactView.currentItem.y
|
||||
Behavior on y
|
||||
@@ -257,70 +264,87 @@ GridLayout
|
||||
implicitHeight: 100
|
||||
color: firstname.palette.base
|
||||
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
||||
clip: true
|
||||
|
||||
ListView
|
||||
ScrollView
|
||||
{
|
||||
id: contactView
|
||||
implicitHeight: parent.height
|
||||
implicitWidth: parent.width
|
||||
model: contactModel
|
||||
header: headline
|
||||
highlight: Rectangle { color: "grey"}
|
||||
highlightFollowsCurrentItem: false
|
||||
onActiveFocusChanged: if(!focus) currentIndex = -1
|
||||
delegate: Item
|
||||
id: objContactView
|
||||
// Layout.fillWidth: true
|
||||
// Layout.preferredHeight: 100
|
||||
//Layout.columnSpan: 3
|
||||
anchors.fill: mainRect
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
||||
|
||||
|
||||
ListView
|
||||
{
|
||||
width: contactView.width
|
||||
|
||||
height: 15
|
||||
MouseArea
|
||||
id: contactView
|
||||
anchors.fill: objContactView
|
||||
// implicitHeight: objContactView.height
|
||||
// implicitWidth: objContactView.width
|
||||
model: contactModel
|
||||
// header: headline
|
||||
highlight: Rectangle { color: "slategray"; radius: 3}
|
||||
highlightFollowsCurrentItem: false
|
||||
//focus: true
|
||||
onActiveFocusChanged: if(!focus) currentIndex = -1
|
||||
delegate: Item
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
width: contactView.width
|
||||
height: 77
|
||||
|
||||
MouseArea
|
||||
{
|
||||
contactView.currentIndex = index
|
||||
contactView.highlightFollowsCurrentItem = true
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
contactView.currentIndex = index
|
||||
contactView.highlightFollowsCurrentItem = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row
|
||||
{
|
||||
//spacing: 9
|
||||
Text
|
||||
Column
|
||||
{
|
||||
text: model.name
|
||||
width: 175
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: model.phone
|
||||
width: 100
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: model.mobile
|
||||
width: 100
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: model.posizion
|
||||
width: 150
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
anchors.margins: 5
|
||||
|
||||
//spacing: 3
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Name: ') + '</b>' + model.name
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Telefon: ') + '</b>' + model.phone
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Handy: ') + '</b>' + model.mobile
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Position: ') + '</b>' + model.posizion
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
|
||||
}
|
||||
Text
|
||||
{
|
||||
text: '<b>' + qsTr('Typ: ') + '</b>' + model.cdata
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: "white"
|
||||
}
|
||||
|
||||
} // Column
|
||||
} // delegate
|
||||
} // Listview
|
||||
} // Scrollview
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -123,12 +123,21 @@ Window
|
||||
{
|
||||
copiesSpinBox.value = 1
|
||||
colorPrint.checked = true
|
||||
if (!sys_printers)
|
||||
{
|
||||
printers = sys_printers.getPrinters()
|
||||
if (sys_printers.getDefaultPrinter())
|
||||
allPrinters.currentIndex = allPrinters.indexOfValue(sys_printers.getDefaultPrinter())
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
printers = sys_printers.getPrinters()
|
||||
if (sys_printers.getDefaultPrinter())
|
||||
allPrinters.currentIndex = allPrinters.indexOfValue(sys_printers.getDefaultPrinter())
|
||||
if (sys_printers)
|
||||
{
|
||||
printers = sys_printers.getPrinters()
|
||||
if (sys_printers.getDefaultPrinter())
|
||||
allPrinters.currentIndex = allPrinters.indexOfValue(sys_printers.getDefaultPrinter())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
60
Gui/main.qml
60
Gui/main.qml
@@ -62,18 +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
|
||||
{
|
||||
@@ -127,4 +115,52 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
config.configurationReady.connect(goToLogin)
|
||||
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?!")
|
||||
}
|
||||
}
|
||||
|
||||
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 |
BIN
images/tero.jpg
Normal file
BIN
images/tero.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
@@ -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,6 +239,31 @@ 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):
|
||||
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']
|
||||
|
||||
|
||||
@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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
19
main.py
19
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
|
||||
@@ -45,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']
|
||||
@@ -62,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()")
|
||||
@@ -86,11 +91,18 @@ 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():
|
||||
bad_config = True
|
||||
config.configurationReady.connect(initializeProgram)
|
||||
config.configurationReady.connect(configReady)
|
||||
else:
|
||||
initializeProgram()
|
||||
|
||||
@@ -98,6 +110,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)
|
||||
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
<file>images/account.svg</file>
|
||||
<file>README</file>
|
||||
<file>LICENSE</file>
|
||||
<file>images/tero.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user