UIManager: Fixed update after change selection and process it

This commit is contained in:
YuSanka 2024-05-07 16:23:29 +02:00 committed by David Kocik
parent 2e5b155861
commit d4d2c13235
2 changed files with 14 additions and 7 deletions

View File

@ -61,6 +61,9 @@ void UIManager::fill_entries()
m_online_entries.clear();
m_offline_entries.clear();
m_online_selections.clear();
m_offline_selections.clear();
const ArchiveRepositoryVector& archs = m_pad->get_archive_repositories();
const std::map<std::string, bool>& selected_repos = m_pad->get_selected_repositories_uuid();
@ -267,7 +270,7 @@ void UIManager::load_offline_repos()
update();
}
void UIManager::set_selected_repositories()
bool UIManager::set_selected_repositories()
{
std::vector<std::string> used_ids;
for (const std::string& id : m_online_selections)
@ -276,9 +279,13 @@ void UIManager::set_selected_repositories()
used_ids.push_back(id);
std::string msg;
if (!m_pad->set_selected_repositories(used_ids, msg)) {
ErrorDialog(m_parent, msg, false).ShowModal();
}
if (m_pad->set_selected_repositories(used_ids, msg))
return true;
ErrorDialog(m_parent, msg, false).ShowModal();
// update selection on UI
update();
return false;
}
@ -320,8 +327,8 @@ void ManageUpdatesDialog::onCloseDialog(wxEvent &)
void ManageUpdatesDialog::onOkDialog(wxEvent&)
{
m_manager->set_selected_repositories();
this->EndModal(wxID_CLOSE);
if (m_manager->set_selected_repositories())
this->EndModal(wxID_CLOSE);
}
} // namespace GUI

View File

@ -67,7 +67,7 @@ public:
~UIManager() {}
wxSizer* get_sizer() { return m_main_sizer; }
void set_selected_repositories();
bool set_selected_repositories();
};
class ManageUpdatesDialog : public DPIDialog