summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorRodrigo Tobar <rtobar@icrar.org>2022-12-17 20:41:59 +0800
committerAndreas Kling <kling@serenityos.org>2022-12-17 19:40:52 +0100
commitd116b9a8c659b618d21508b01456e14059142f38 (patch)
treeeedd712b9e062d12ca06b78067845161eb13edfb /Userland/Applications
parentd739877807150d7854f81669ed48d4c5616769ba (diff)
downloadserenity-d116b9a8c659b618d21508b01456e14059142f38.zip
PDFViewer: Move to page when outline item is selected
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index eb6fc348ce..c779a3604f 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -10,6 +10,7 @@
#include "AK/DeprecatedString.h"
#include "AK/Format.h"
#include "LibGUI/Forward.h"
+#include "LibPDF/Document.h"
#include <AK/HashMap.h>
#include <AK/HashTable.h>
#include <AK/Variant.h>
@@ -167,6 +168,13 @@ PDFViewerWidget::PDFViewerWidget()
m_sidebar = h_splitter.add<SidebarWidget>();
m_sidebar->set_preferred_width(200);
m_sidebar->set_visible(false);
+ m_sidebar->on_destination_selected = [&](PDF::Destination const& destination) {
+ auto maybe_page = destination.page;
+ if (!maybe_page.has_value())
+ return;
+ auto page = maybe_page.release_value();
+ m_viewer->set_current_page(page);
+ };
auto& v_splitter = h_splitter.add<GUI::VerticalSplitter>();
v_splitter.layout()->set_spacing(4);