summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2021-12-27 13:41:01 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-06 21:25:02 +0100
commit45085122eea5cd43c88cfb7e542d6b22e69168b3 (patch)
treebcb0387404e4e598e5e391235cd7814d7eee9dd3 /Userland/Applications
parente114e2e66d6ecc696b593c59ea85967c77120d07 (diff)
downloadserenity-45085122eea5cd43c88cfb7e542d6b22e69168b3.zip
PDFViewer: Fix sidebar toggle logic
The open_outline_action logic was backwards resulting in it being closed on the first click and opened on the second, and opposite if document->outline() was true. There was also a collision with the Ctrl+O shortcut for opening a document, this changes it to Ctrl+S instead. This commit also changes the wording to 'Toogle' instead of 'Open/Close' since the text wasn't updated as expected, and lastly, add a View menu with the action.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index 7e6b13c78f..aac25ba043 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -56,6 +56,9 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window)
GUI::Application::the()->quit();
}));
+ auto& view_menu = window.add_menu("&View");
+ view_menu.add_action(*m_toggle_sidebar_action);
+
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_about_action("PDF Viewer", GUI::Icon::default_icon("app-pdf-viewer"), &window));
}
@@ -66,10 +69,9 @@ void PDFViewerWidget::create_toolbar()
auto& toolbar = toolbar_container.add<GUI::Toolbar>();
auto open_outline_action = GUI::Action::create(
- "Open &Sidebar", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png").release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
+ "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_sidebar_open = !m_sidebar_open;
- m_sidebar->set_fixed_width(m_sidebar_open ? 0 : 200);
- action.set_text(m_sidebar_open ? "Open &Sidebar" : "Close &Sidebar");
+ m_sidebar->set_fixed_width(m_sidebar_open ? 200 : 0);
},
nullptr);
open_outline_action->set_enabled(false);