feat: enhance settings dialog to handle domain changes with restart prompt and silent reload for path changes

This commit is contained in:
claudi 2026-03-04 13:19:19 +01:00
parent 3f7623f11c
commit 1e848e84b2

View file

@ -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.