From d2149c153c444d1e4d639b3dbd6824b58c2c6faa Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 27 May 2021 18:49:49 +0100 Subject: [PATCH] PDFViewer: Reset current page number to 1 when opening a file Also use set_current_number() instead of set_text(), so we don't have to create a string from the number ourselves. --- Userland/Applications/PDFViewer/PDFViewerWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 96addf693cd..2a55b4c5e51 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -110,8 +110,8 @@ void PDFViewerWidget::open_file(const String& path) m_total_page_label->set_text(String::formatted("of {}", document->get_page_count())); m_total_page_label->set_fixed_width(30); - m_page_text_box->set_text(String::number(m_viewer->current_page() + 1)); m_page_text_box->set_enabled(true); + m_page_text_box->set_current_number(1, false); m_page_text_box->set_max_number(document->get_page_count()); m_go_to_prev_page_action->set_enabled(false); m_go_to_next_page_action->set_enabled(document->get_page_count() > 1);