diff --git a/README.md b/README.md index 218c66a0..887ee093 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ sudo apt install "./crossdesk-virtual-desktop-xfce-linux-amd64-.deb" ### 检查更新 -客户端启动后会在后台检查版本。发现新版本时,主窗口菜单入口会显示更新提示;打开 **☰ → 关于** 可查看版本,也可点击 **检查更新** 手动检查。发现更新后可查看更新说明并前往下载页面。 +客户端启动后会在后台检查版本,发现新版本时自动弹出更新提示,可查看更新说明并前往下载页面。关闭提示后,本次运行中的后台检查不会再次弹窗,主窗口菜单入口仍会显示更新提示;重新启动客户端后,如仍有新版本则再次提示。打开 **☰ → 关于** 可查看版本和更新说明,也可点击 **检查更新** 手动检查。

关于窗口与检查更新按钮,版本号和检查结果为演示数据 diff --git a/README_EN.md b/README_EN.md index dbb49e4e..e858850f 100644 --- a/README_EN.md +++ b/README_EN.md @@ -171,7 +171,7 @@ Open **☰ → Settings** in the top-right corner and click **OK** to save. Conf ### Check for updates -The client checks for updates in the background after launch. A new version adds an update indicator to the main window menu. Open **☰ → About** to view the version or click **Check for updates** to check manually. When an update is available, you can view its release notes and open the download page. +The client checks for updates in the background after launch and automatically opens the update dialog when a new version is found, showing release notes and a link to the download page. After you dismiss the dialog, background checks will not reopen it during the current run, while the main window menu keeps its update indicator. Restarting the client shows the dialog again if an update is still available. Open **☰ → About** to view the version and release notes or click **Check for updates** to check manually.

About dialog with the Check for updates button; version and check result are demonstration data diff --git a/apps/desktop/src/gui/ui/main_window.slint b/apps/desktop/src/gui/ui/main_window.slint index ae6db768..4838ab01 100644 --- a/apps/desktop/src/gui/ui/main_window.slint +++ b/apps/desktop/src/gui/ui/main_window.slint @@ -423,7 +423,9 @@ export component MainWindow inherits Window { if !root.self-host-settings-open { root.self-host-settings-error = ""; } } in-out property about-open: false; - in-out property update-open: false; + // Follow the first available update. Dismissing the dialog replaces this + // binding, so background checks do not reopen it during this launch. + in-out property update-open: root.update-available; in-out property reset-password-open: false; in-out property reset-password-invalid: false; in-out property new-password-input: ""; diff --git a/apps/desktop/tests/slint_ui_smoke_test.cpp b/apps/desktop/tests/slint_ui_smoke_test.cpp index fe6bd154..fdbc55cc 100644 --- a/apps/desktop/tests/slint_ui_smoke_test.cpp +++ b/apps/desktop/tests/slint_ui_smoke_test.cpp @@ -495,9 +495,20 @@ int main() { window->set_about_open(true); assert(window->get_settings_open()); assert(window->get_about_open()); - window->set_update_available(true); if (window->get_update_open()) { - std::cerr << "Automatic update checks must not open the update dialog\n"; + std::cerr << "The update dialog must stay closed before an update is found\n"; + return 8; + } + window->set_update_available(true); + if (!window->get_update_open()) { + std::cerr << "Finding an update must automatically open the update dialog\n"; + return 8; + } + // The Later button closes the dialog by assigning update-open = false. + window->set_update_open(false); + window->set_update_available(true); + if (window->get_update_open() || !window->get_update_available()) { + std::cerr << "Repeated checks must preserve dismissal and the update badge\n"; return 8; } bool update_check_requested = false; @@ -512,6 +523,26 @@ int main() { return 8; } window->set_update_available(false); + window->set_update_available(true); + if (window->get_update_open()) { + std::cerr << "A dismissed update dialog must stay closed during this launch\n"; + return 8; + } + window->set_update_open(true); + if (!window->get_update_open()) { + std::cerr << "Update details must still be available after dismissal\n"; + return 8; + } + window->set_update_open(false); + { + auto next_launch = crossdesk::ui::MainWindow::create(); + next_launch->set_update_available(true); + if (!next_launch->get_update_open()) { + std::cerr << "A new launch must show the available update again\n"; + return 8; + } + } + window->set_update_available(false); window->set_update_check_status(crossdesk::ui::UpdateCheckStatus::Idle); if (const char *snapshot_path = std::getenv("CROSSDESK_SETTINGS_UI_SNAPSHOT")) {