diff options
author | David Lindbom <hi@davidlindbom.se> | 2022-01-09 20:22:29 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-01-13 03:45:17 -0800 |
commit | 357a36b622f8ded1f4462377f08c35e5d466a568 (patch) | |
tree | ab89987856deba7122bfe867dfa6394029a1ca74 /Userland | |
parent | e59556d53197093cf6ac22fb8239b0fdd81c1aec (diff) | |
download | serenity-357a36b622f8ded1f4462377f08c35e5d466a568.zip |
2048: Add link to help pages in menu
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Games/2048/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Games/2048/main.cpp | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Userland/Games/2048/CMakeLists.txt b/Userland/Games/2048/CMakeLists.txt index 27bed755f7..b92d95ed1f 100644 --- a/Userland/Games/2048/CMakeLists.txt +++ b/Userland/Games/2048/CMakeLists.txt @@ -12,4 +12,4 @@ set(SOURCES ) serenity_app(2048 ICON app-2048) -target_link_libraries(2048 LibConfig LibGUI LibMain) +target_link_libraries(2048 LibConfig LibGUI LibMain LibDesktop) 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 <AK/URL.h> #include <LibConfig/Client.h> #include <LibCore/System.h> +#include <LibDesktop/Launcher.h> #include <LibGUI/Action.h> #include <LibGUI/Application.h> #include <LibGUI/BoxLayout.h> @@ -37,9 +39,13 @@ ErrorOr<int> 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<int> 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(); |