From aeb433b2a1eb6bd8a2e2e42dde1ec1d48fc3b2c4 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 15 Feb 2022 09:29:32 +0100 Subject: [PATCH] Keep showing ip enter dialog after wrongly entered ip address In component discover um 3 dialog. After a "complete" action the dialog will immediately close. This was undesired behaviour as we want to keep the dialog active if an IP address is wrongly added. Additionally, it is no longer necessary to close/hide the dialog after a reject/accept as this is done by default. CURA-8955 --- .../resources/qml/DiscoverUM3Action.qml | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 94e265e4b8..3117775eaf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -333,18 +333,16 @@ Cura.MachineAction } } - onRejected: - { - manualPrinterDialog.reject() - manualPrinterDialog.hide() - } onAccepted: { // Validate the input first if (!networkingUtil.isValidIP(manualPrinterDialog.addressText)) { - invalidIPAddressMessageDialog.open() - return + // prefent closing of element, as we want to keep the dialog active after a wrongly entered IP adress + manualPrinterDialog.open() + // show invalid ip warning + invalidIPAddressMessageDialog.open(); + return; } // if the entered IP address has already been discovered, switch the current item to that item @@ -354,14 +352,12 @@ Cura.MachineAction var device = manager.foundDevices[i] if (device.address == manualPrinterDialog.addressText) { - currentItemIndex = i - manualPrinterDialog.hide() - return + currentItemIndex = i; + return; } } - manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) - manualPrinterDialog.hide() + manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText); } } }