diff options
author | David Lindbom <hi@davidlindbom.se> | 2022-01-09 20:24:46 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-01-13 03:45:17 -0800 |
commit | e5c6026a9a5ba58d780bd000dc9c3bab2c655e50 (patch) | |
tree | f7ffcf7e01b69c651e0013958e8d359fe4e80b75 /Userland | |
parent | b15b87486dd52dc07062bd25b82dc719ba3705b3 (diff) | |
download | serenity-e5c6026a9a5ba58d780bd000dc9c3bab2c655e50.zip |
Chess: Add link to help pages in menu
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Games/Chess/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Games/Chess/main.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Userland/Games/Chess/CMakeLists.txt b/Userland/Games/Chess/CMakeLists.txt index 218ebdd8bf..bfde3a5e36 100644 --- a/Userland/Games/Chess/CMakeLists.txt +++ b/Userland/Games/Chess/CMakeLists.txt @@ -13,4 +13,4 @@ set(SOURCES ) serenity_app(Chess ICON app-chess) -target_link_libraries(Chess LibChess LibConfig LibGUI LibCore LibMain) +target_link_libraries(Chess LibChess LibConfig LibGUI LibCore LibMain LibDesktop) diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index e116e719b4..7dc21e13f6 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -8,6 +8,7 @@ #include <LibConfig/Client.h> #include <LibCore/DirIterator.h> #include <LibCore/System.h> +#include <LibDesktop/Launcher.h> #include <LibGUI/ActionGroup.h> #include <LibGUI/Application.h> #include <LibGUI/Clipboard.h> @@ -27,6 +28,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Config::pledge_domains("Chess"); + TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man6/Chess.md") })); + TRY(Desktop::Launcher::seal_allowlist()); + TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd thread proc exec")); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-chess")); @@ -37,6 +41,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/bin/ChessEngine", "x")); TRY(Core::System::unveil("/etc/passwd", "r")); + TRY(Core::System::unveil("/tmp/portal/launch", "rw")); TRY(Core::System::unveil(Core::StandardPaths::home_directory().characters(), "wcbr")); TRY(Core::System::unveil(nullptr, nullptr)); @@ -183,6 +188,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/Chess.md"), "/bin/Help"); + }))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Chess", app_icon, window))); window->show(); |