From 357a36b622f8ded1f4462377f08c35e5d466a568 Mon Sep 17 00:00:00 2001 From: David Lindbom Date: Sun, 9 Jan 2022 20:22:29 +0100 Subject: 2048: Add link to help pages in menu --- Userland/Games/2048/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Userland/Games/2048/main.cpp') diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index 8969bab788..af2e708945 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -7,8 +7,10 @@ #include "BoardView.h" #include "Game.h" #include "GameSizeDialog.h" +#include #include #include +#include #include #include #include @@ -37,9 +39,13 @@ ErrorOr serenity_main(Main::Arguments arguments) Config::pledge_domains("2048"); + TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man6/2048.md") })); + TRY(Desktop::Launcher::seal_allowlist()); + TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); + TRY(Core::System::unveil("/tmp/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); size_t board_size = Config::read_i32("2048", "", "board_size", 4); @@ -196,6 +202,9 @@ ErrorOr serenity_main(Main::Arguments arguments) }))); auto help_menu = TRY(window->try_add_menu("&Help")); + TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) { + Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man6/2048.md"), "/bin/Help"); + }))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("2048", app_icon, window))); window->show(); -- cgit v1.2.3