Skip to content

Commit

Permalink
App: fix enabled status of Previous/Next commands
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed Jun 18, 2023
1 parent 5107d6b commit b9ed666
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/commands_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit b9ed666

Please sign in to comment.