From b1e42be046d17e8daff8dbf7880010cf7a4f41a5 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sat, 30 Jul 2022 23:19:47 +0200 Subject: [PATCH] page_load: Disable loading when loading is impossible When loading the preview fails because we couldn't extract the preview from the save, be conservative and disable the "Load" button (how could the server load the file if we can't?). Also hide the preview from the previously selected item, if any. See #1166. --- client/page_load.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/page_load.cpp b/client/page_load.cpp index 3d7369b686..3a159b2db9 100644 --- a/client/page_load.cpp +++ b/client/page_load.cpp @@ -340,5 +340,14 @@ void page_load::slot_selection_changed(const QItemSelection &selected, } } ui.load_save_text->setText(final_str); + + ui.load_save_text->show(); + ui.load_pix->show(); + ui.buttons->button(QDialogButtonBox::Ok)->setEnabled(true); + } else { + // Couldn't load the save. Clear the preview and prevent loading it. + ui.load_save_text->hide(); + ui.load_pix->hide(); + ui.buttons->button(QDialogButtonBox::Ok)->setEnabled(false); } }