summaryrefslogtreecommitdiff
path: root/Userland/Applications/Magnifier
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-11-24 19:24:27 -0500
committerAndreas Kling <kling@serenityos.org>2022-12-10 13:15:35 +0100
commit31f4ec66c55a8dda53b84174eb55114a65a60aa5 (patch)
tree279e9aeb7e8311249634b48cfeba0198651d3053 /Userland/Applications/Magnifier
parent5e96ad0345acd660f83e50a46975648cdc69ed9c (diff)
downloadserenity-31f4ec66c55a8dda53b84174eb55114a65a60aa5.zip
Magnifier: Add a manual to Help menu and propagate construction errors
Diffstat (limited to 'Userland/Applications/Magnifier')
-rw-r--r--Userland/Applications/Magnifier/CMakeLists.txt2
-rw-r--r--Userland/Applications/Magnifier/main.cpp11
2 files changed, 10 insertions, 3 deletions
diff --git a/Userland/Applications/Magnifier/CMakeLists.txt b/Userland/Applications/Magnifier/CMakeLists.txt
index 5574351140..8ca63dad84 100644
--- a/Userland/Applications/Magnifier/CMakeLists.txt
+++ b/Userland/Applications/Magnifier/CMakeLists.txt
@@ -10,4 +10,4 @@ set(SOURCES
)
serenity_app(Magnifier ICON app-magnifier)
-target_link_libraries(Magnifier PRIVATE LibCore LibGfx LibGUI LibIPC LibMain LibFileSystemAccessClient)
+target_link_libraries(Magnifier PRIVATE LibCore LibDesktop LibGfx LibGUI LibIPC LibMain LibFileSystemAccessClient)
diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp
index cba66e6db9..0e30e4189d 100644
--- a/Userland/Applications/Magnifier/main.cpp
+++ b/Userland/Applications/Magnifier/main.cpp
@@ -7,6 +7,7 @@
#include "MagnifierWidget.h"
#include <AK/LexicalPath.h>
#include <LibCore/System.h>
+#include <LibDesktop/Launcher.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Application.h>
@@ -40,6 +41,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd unix"));
auto app = TRY(GUI::Application::try_create(arguments));
+ TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/Magnifier.md") }));
+ TRY(Desktop::Launcher::seal_allowlist());
+
TRY(Core::System::unveil("/sys/kernel/processes", "r"));
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
TRY(Core::System::unveil("/res", "r"));
@@ -140,8 +144,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(window->try_add_menu(TRY(GUI::CommonMenus::make_accessibility_menu(magnifier))));
auto help_menu = TRY(window->try_add_menu("&Help"));
- help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
- help_menu->add_action(GUI::CommonActions::make_about_action("Magnifier", app_icon, window));
+ TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
+ TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
+ Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Magnifier.md"), "/bin/Help");
+ })));
+ TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Magnifier", app_icon, window)));
window->show();
window->set_always_on_top(true);