summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-08-05 16:42:23 -0400
committerJustin Luth <jluth@mail.com>2023-08-06 03:58:21 +0200
commit6444f5e2c5c8b3d1fac12755af09339083c74055 (patch)
tree2053d6c105fe43339e3da29355cc8fc4beeef1ed
parentb3053b63c65372627c5fb4df6b4ddcd5e12e16f7 (diff)
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 <jluth@mail.com> Tested-by: Jenkins
-rw-r--r--svx/source/dialog/docrecovery.cxx22
-rw-r--r--svx/source/inc/docrecovery.hxx2
2 files changed, 23 insertions, 1 deletions
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