From dedd878af13119e164955f833bb9a216bb244a89 Mon Sep 17 00:00:00 2001 From: Ian Chua Date: Tue, 9 Jun 2026 16:41:58 +0800 Subject: [PATCH] fix: tombstone resolution for 409 status code with error code -3 --- src/slic3r/GUI/GUI_App.cpp | 19 ++++++++++++++----- src/slic3r/GUI/NotificationManager.cpp | 14 ++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 8a5897622b..f990d2e29e 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4953,16 +4953,25 @@ void GUI_App::on_http_error(wxCommandEvent &evt) auto* plater = wxGetApp().plater(); if (plater != nullptr && wxGetApp().imgui()->display_initialized()) { std::string text; - if (conflict_code == -1) { + + switch (conflict_code) { + case -1: text = _u8L("Cloud sync conflict: this preset has a newer version in OrcaCloud.\n" "Pull downloads the cloud copy. Force push overwrites it with your local preset."); - } else { + break; + case -2: text = _u8L("Cloud sync conflict: a preset with this name already exists in OrcaCloud.\n" "Pull downloads the cloud copy. Force push overwrites it with your local preset."); - } + break; + case -3: + text = _u8L("Cloud sync conflict: a preset with the same name was previously deleted from the cloud.\n" + "Do you want to push this new copy to the cloud?"); + break; + }; + plater->get_notification_manager()->push_orca_sync_conflict_notification( text, - [this](wxEvtHandler*) { + conflict_code == -3 ? nullptr : std::function{[this](wxEvtHandler*) { // Runs on the GUI thread (on_http_error is a queued wx event); restart_sync_user_preset() // already joins the old sync thread off the UI thread, so no extra thread is needed here. if (is_closing() || !m_agent || !preset_bundle) @@ -4970,7 +4979,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt) BOOST_LOG_TRIVIAL(info) << "Pulling Orca Cloud settings to resolve sync conflict."; restart_sync_user_preset(); return true; - }, + }}, [this, conflict_setting_id](wxEvtHandler*) { if (mainframe == nullptr) return false; diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 5079dfecf0..835ae29522 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -2416,12 +2416,18 @@ void NotificationManager::OrcaSyncConflictNotification::render_text(ImGuiWrapper } const float action_y = starting_y + m_endlines.size() * shift_y; - const std::string pull_text = _u8L("Pull"); - render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull", - [this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); }); + std::string pull_text = ""; + float padding = 0.f; + + if (m_pull_callback) { + pull_text = _u8L("Pull"); + padding = ImGui::CalcTextSize((pull_text + " ").c_str()).x; + render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull", + [this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); }); + } if (m_force_push_callback) { const std::string force_push_text = _u8L("Force push"); - const float force_x = x_offset + ImGui::CalcTextSize((pull_text + " ").c_str()).x; + const float force_x = x_offset + padding; render_hyperlink_action(imgui, force_x, action_y, force_push_text, "##orca_sync_force_push", [this] { if (m_force_push_callback && m_force_push_callback(m_evt_handler)) close(); }); }