From 1e848e84b2a78899505dd00bd8e572d42c35c0b2 Mon Sep 17 00:00:00 2001 From: claudi Date: Wed, 4 Mar 2026 13:19:19 +0100 Subject: [PATCH] feat: enhance settings dialog to handle domain changes with restart prompt and silent reload for path changes --- src/webdrop_bridge/ui/main_window.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/webdrop_bridge/ui/main_window.py b/src/webdrop_bridge/ui/main_window.py index 0c79ed6..accafcf 100644 --- a/src/webdrop_bridge/ui/main_window.py +++ b/src/webdrop_bridge/ui/main_window.py @@ -1389,6 +1389,8 @@ class MainWindow(QMainWindow): """Show Settings dialog for configuration management. After closing, checks if webapp URL changed and reloads if needed. + For domain changes, shows restart dialog. + For path-only changes, reloads silently without dialog. """ from webdrop_bridge.ui.settings_dialog import SettingsDialog @@ -1412,17 +1414,10 @@ class MainWindow(QMainWindow): self._handle_domain_change_restart() else: logger.info("Path changed but domain is same - reloading...") - # Just clear cache and reload + # Clear cache and navigate to home asynchronously + # Use timer to ensure dialog is fully closed before reloading self.web_view.clear_cache_and_cookies() - self._load_webapp() - - from PySide6.QtWidgets import QMessageBox - - QMessageBox.information( - self, - "Configuration Updated", - "Web application URL has been updated and reloaded.", - ) + QTimer.singleShot(100, self._navigate_home) def _check_domain_changed(self, old_url: str, new_url: str) -> bool: """Check if the domain/host has changed between two URLs. @@ -1481,9 +1476,9 @@ class MainWindow(QMainWindow): self._restart_application() else: logger.info("User chose to restart later - clearing cache and loading new URL") - # Clear cache and load anyway + # Clear cache and load new URL directly self.web_view.clear_cache_and_cookies() - self._load_webapp() + self._navigate_home() def _restart_application(self) -> None: """Restart the application automatically.