From 66e362e2dd53c01b8db48c242da027692a589dd1 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Tue, 10 Dec 2024 13:30:00 +0100 Subject: [PATCH] SPE 2553: Do a silent removal of desktop files. --- src/libslic3r/AppConfig.cpp | 5 ---- src/slic3r/GUI/GUI_App.cpp | 53 ++-------------------------------- src/slic3r/GUI/Preferences.cpp | 7 ----- 3 files changed, 3 insertions(+), 62 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 404ce6aa26..a5e9444cf6 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -238,11 +238,6 @@ void AppConfig::set_defaults() set("sys_menu_enabled", "1"); #endif // _WIN32 -#ifdef __linux__ - if (get("check_old_desktop_files").empty()) - set("check_old_desktop_files", "1"); // /"0" - dont check, "1" - check and ask, "auto" - check and dont ask -#endif // __linux__ - // Remove legacy window positions/sizes erase("", "main_frame_maximized"); erase("", "main_frame_pos"); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index cb854457d8..6cc0bf8c20 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1314,55 +1314,12 @@ static int get_app_font_pt_size(const AppConfig* app_config) #if defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION) void GUI_App::remove_desktop_files_dialog() { - if (app_config->get("check_old_desktop_files") == "0") { - return; - } // Find all old existing desktop file std::vector found_desktop_files; DesktopIntegrationDialog::find_all_desktop_files(found_desktop_files); if(found_desktop_files.empty()) { return; } - // Some files might be unaccessible for us, if already tried, it is saved in appconfig. - std::vector old_fails; - std::string old_fails_serialized = app_config->get("old_desktop_files_fails"); - boost::split(old_fails, old_fails_serialized, boost::is_any_of(";")); - if (found_desktop_files.size() <= old_fails.size()) { - bool all_are_fails = true; - for (const boost::filesystem::path& entry : found_desktop_files) { - if (std::find(old_fails.begin(), old_fails.end(), entry.string()) == old_fails.end()) { - all_are_fails = false; - break; - } - } - if (all_are_fails) { - BOOST_LOG_TRIVIAL(debug) << "Only desktop files that failed to remove before were found."; - return; - } - } - wxString text; - // Dialog asking to delete the files. - if (app_config->get("check_old_desktop_files") == "1") { - text = _L("Some outdated desktop files related to PrusaSlicer were found on your system. " - "These files are no longer used by this version of PrusaSlicer and may cause issues, such as problems logging in via third-party accounts."); - text += "\n\n"; - for (const boost::filesystem::path& entry : found_desktop_files) { - text += GUI::format_wxstr("%1%\n",entry.string()); - } - text += "\n"; - text += _L("Would you like to remove these files now?"); - RichMessageDialog dialog(nullptr, text, _L("Outdated Desktop Files Detected"), wxICON_QUESTION | wxYES_NO); - dialog.ShowCheckBox(_L("Don’t show this message again")); - // Wait for modal. - bool is_yes = dialog.ShowModal() == wxID_YES; - if (dialog.IsCheckBoxChecked()) { - app_config->set("check_old_desktop_files", is_yes ? "auto" : "0"); - } - if (!is_yes) { - return; - } - } - // Delete files. std::vector fails; DesktopIntegrationDialog::remove_desktop_file_list(found_desktop_files, fails); @@ -1371,17 +1328,13 @@ void GUI_App::remove_desktop_files_dialog() } // Inform about fails. std::string fails_serialized; - text = _L("Failed to remove desktop files."); - text += "\n\n"; + std::string text = _"Failed to remove desktop files:"; + text += "\n"; for (const boost::filesystem::path& entry : fails) { text += GUI::format_wxstr("%1%\n",entry.string()); fails_serialized += entry.string() + ";"; } - // Save fails for next run. - app_config->set("old_desktop_files_fails", fails_serialized); - - RichMessageDialog dlg2(nullptr, text, _L("Desktop integration"), wxICON_WARNING | wxOK_DEFAULT); - dlg2.ShowModal(); + BOOST_LOG_TRIVIAL(error) << text; } #endif //(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index f43609c2cb..0818d816b0 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -637,13 +637,6 @@ void PreferencesDialog::build() L("Show \"Log in\" button in application top bar"), L("If enabled, PrusaSlicer will show up \"Log in\" button in application top bar."), app_config->get_bool("show_login_button")); - -#if defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION) - append_bool_option(m_optgroup_other, "check_old_desktop_files", - L("Check outdated desktop files for removal"), - L("If enabled, PrusaSlicer will search for outdated desktop files at startup and ask for removal."), - app_config->get("check_old_desktop_files") == "1"); -#endif //defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION) append_bool_option(m_optgroup_other, "downloader_url_registered", L("Allow downloads from Printables.com"),