mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:38:11 +00:00
PDFViewer: Toggle prev/next page actions when page changes
These actions were not updated accordingly when one scrolled through the document, and thus one could accidentally, for example, move to the next page when standing on the last, which caused a crash. This commit fixes that behavior, toggling the actions' enabled status depending on the new page being displayed.
This commit is contained in:
parent
a740423e23
commit
cbb373e135
1 changed files with 2 additions and 0 deletions
|
@ -37,6 +37,8 @@ PDFViewerWidget::PDFViewerWidget()
|
|||
m_viewer = splitter.add<PDFViewer>();
|
||||
m_viewer->on_page_change = [&](auto new_page) {
|
||||
m_page_text_box->set_current_number(new_page + 1, GUI::AllowCallback::No);
|
||||
m_go_to_prev_page_action->set_enabled(new_page > 0);
|
||||
m_go_to_next_page_action->set_enabled(new_page < m_viewer->document()->get_page_count() - 1);
|
||||
};
|
||||
|
||||
initialize_toolbar(toolbar);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue