import QtQuick import QtQuick.Layouts import QtQuick.Controls import QtQuick.Dialogs import QtCore ApplicationWindow { id: appWindow width: Screen.width * .75 height: Screen.height * .85 visible: true title: "TERO Personal" font: Typography.body color: Colors.mantle property string confile: "" property alias settingsFileDialog: settingsFiledialog TopBar { id:topBar anchors { rightMargin: 9 leftMargin: 9 } visible: bad_config || !db_con ? false: true } PrinterDialog { id: printerDialog } ReadMe { id: readMeWin } Item { id: mainView } Loader { id: appLoader anchors { left: parent.left right: parent.right top: topBar.bottom bottom: parent.bottom topMargin: 0 bottomMargin: 5 rightMargin: 9 leftMargin: 9 } property alias window: appWindow } Dialog { id: importDialog modal: true anchors.centerIn: parent standardButtons: Dialog.Yes | Dialog.No onAccepted: settingsFiledialog.open() onRejected: appLoader.source= "Firststart.qml" title: qsTr("Einstellungen importieren") } FileDialog { id: settingsFiledialog title: qsTr("PYQCRM Einstellungen") currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0] modality: "ApplicationModal" nameFilters: [qsTr("PYQCRM Einstellungen (*.pyqrec)")] onAccepted: { exportFilePassword.open() confile = selectedFile } } Dialog { id: exportFilePassword modal: true title: qsTr("PYQCRM Einstellungen") anchors.centerIn: parent standardButtons: Dialog.Ok | Dialog.Cancel onAccepted: config.importConfig(confile, exportPasswordInput.text) ColumnLayout { RowLayout { Label { text: qsTr("Passwort eingeben:") } TextField { id: exportPasswordInput echoMode: TextInput.Password implicitWidth: 300 } } } } 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() } } onWindowStateChanged: (windowState) => { if (windowState !== Qt.WindowMinimized) { systray.setVisible(false) appWindow.show() } } 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 } }