From b9ed6663b4d37ad233fb89979f06498c09d157be Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Sun, 18 Jun 2023 11:12:18 +0200 Subject: [PATCH] App: fix enabled status of Previous/Next commands --- src/app/commands_window.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/commands_window.cpp b/src/app/commands_window.cpp index 5688a759..9b550f9a 100644 --- a/src/app/commands_window.cpp +++ b/src/app/commands_window.cpp @@ -169,7 +169,9 @@ void CommandPreviousDocument::execute() bool CommandPreviousDocument::getEnabledStatus() const { - return this->app()->documentCount() != 0 && this->currentDocumentIndex() > 0; + return this->app()->documentCount() != 0 + && this->context()->currentPage() == IAppContext::Page::Documents + && this->currentDocumentIndex() > 0; } CommandNextDocument::CommandNextDocument(IAppContext* context) @@ -192,7 +194,9 @@ void CommandNextDocument::execute() bool CommandNextDocument::getEnabledStatus() const { const int appDocumentCount = this->app()->documentCount(); - return appDocumentCount != 0 && this->currentDocumentIndex() < appDocumentCount - 1; + return appDocumentCount != 0 + && this->context()->currentPage() == IAppContext::Page::Documents + && this->currentDocumentIndex() < appDocumentCount - 1; } } // namespace Mayo