svx/source/dialog/docrecovery.cxx | 22 +++++++++++++++++++++- svx/source/inc/docrecovery.hxx | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-)
New commits: commit 6444f5e2c5c8b3d1fac12755af09339083c74055 Author: Justin Luth <jl...@mail.com> AuthorDate: Sat Aug 5 16:42:23 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Sun Aug 6 03:58:21 2023 +0200 tdf#145606 autorecover: skip "Finish" button if all recovered OK. Change-Id: I59036b98b33d85305b13430113a3a3d399dea27d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155379 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 6675a05c64ea..f77418227c78 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -737,6 +737,21 @@ RecoveryDialog::~RecoveryDialog() xComp->dispose(); } +bool RecoveryDialog::allSuccessfullyRecovered() +{ + const int c = m_xFileListLB->n_children(); + for (int i = 0; i < c; ++i) + { + TURLInfo* pInfo = weld::fromId<TURLInfo*>(m_xFileListLB->get_id(i)); + if (!pInfo) + continue; + + if (pInfo->RecoveryState != E_SUCCESSFULLY_RECOVERED) + return false; + } + return true; +} + short RecoveryDialog::execute() { ::SolarMutexGuard aSolarLock; @@ -761,7 +776,12 @@ short RecoveryDialog::execute() Application::Yield(); m_pCore->setUpdateListener(nullptr); - m_eRecoveryState = RecoveryDialog::E_RECOVERY_CORE_DONE; + + // Skip FINISH button if everything was successfully recovered + if (allSuccessfullyRecovered()) + m_eRecoveryState = RecoveryDialog::E_RECOVERY_DONE; + else + m_eRecoveryState = RecoveryDialog::E_RECOVERY_CORE_DONE; return execute(); } diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index d7442d2c7ab1..9660f20bef3a 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -438,6 +438,8 @@ class RecoveryDialog final : public weld::GenericDialogController virtual void stepNext(TURLInfo* pItem) override; virtual void end() override; + bool allSuccessfullyRecovered(); + short execute(); // helper