summaryrefslogtreecommitdiff
path: root/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications/PDFViewer/PDFViewerWidget.cpp')
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index 6be1475080..d0e5063341 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -211,9 +211,9 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window)
{
auto& file_menu = window.add_menu("&File");
file_menu.add_action(GUI::CommonActions::make_open_action([&](auto&) {
- auto response = FileSystemAccessClient::Client::the().try_open_file_deprecated(&window);
+ auto response = FileSystemAccessClient::Client::the().open_file(&window);
if (!response.is_error())
- open_file(*response.value());
+ open_file(response.value().filename(), response.value().release_stream());
}));
file_menu.add_separator();
file_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
@@ -349,9 +349,9 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
m_show_images->on_checked = [&](auto checked) { m_viewer->set_show_images(checked); };
}
-void PDFViewerWidget::open_file(Core::File& file)
+void PDFViewerWidget::open_file(StringView path, NonnullOwnPtr<Core::Stream::File> file)
{
- auto maybe_error = try_open_file(file);
+ auto maybe_error = try_open_file(path, move(file));
if (maybe_error.is_error()) {
auto error = maybe_error.release_error();
warnln("{}", error.message());
@@ -360,11 +360,11 @@ void PDFViewerWidget::open_file(Core::File& file)
}
}
-PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(Core::File& file)
+PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwnPtr<Core::Stream::File> file)
{
- window()->set_title(DeprecatedString::formatted("{} - PDF Viewer", file.filename()));
+ window()->set_title(DeprecatedString::formatted("{} - PDF Viewer", path));
- m_buffer = file.read_all();
+ m_buffer = TRY(file->read_until_eof());
auto document = TRY(PDF::Document::create(m_buffer));
if (auto sh = document->security_handler(); sh && !sh->has_user_password()) {