diff options
author | Evan Smal <evan.smal@hotmail.com> | 2023-01-01 21:04:08 -0500 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-01-02 09:50:37 -0500 |
commit | 50c0d0a3b0e4734b611e1db862c70891da242b08 (patch) | |
tree | 0a9761b3216f09450dde5a3fc2ed5e3e8d4a3538 /Userland/Games | |
parent | 88ebc44cbf620b09b0e3e307c2e3890b726ebb82 (diff) | |
download | serenity-50c0d0a3b0e4734b611e1db862c70891da242b08.zip |
Solitaire: Add link to help page
Diffstat (limited to 'Userland/Games')
-rw-r--r-- | Userland/Games/Solitaire/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Games/Solitaire/main.cpp | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Userland/Games/Solitaire/CMakeLists.txt b/Userland/Games/Solitaire/CMakeLists.txt index e27cf0daf9..dc4307266d 100644 --- a/Userland/Games/Solitaire/CMakeLists.txt +++ b/Userland/Games/Solitaire/CMakeLists.txt @@ -16,4 +16,4 @@ set(GENERATED_SOURCES ) serenity_app(Solitaire ICON app-solitaire) -target_link_libraries(Solitaire PRIVATE LibCards LibConfig LibGUI LibGfx LibCore LibMain) +target_link_libraries(Solitaire PRIVATE LibCards LibConfig LibGUI LibDesktop LibGfx LibCore LibMain) diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index 2d52635479..8d7e3b1123 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -7,10 +7,12 @@ */ #include "Game.h" +#include <AK/URL.h> #include <Games/Solitaire/SolitaireGML.h> #include <LibConfig/Client.h> #include <LibCore/System.h> #include <LibCore/Timer.h> +#include <LibDesktop/Launcher.h> #include <LibGUI/Action.h> #include <LibGUI/ActionGroup.h> #include <LibGUI/Application.h> @@ -30,6 +32,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-solitaire"sv)); + auto const man_file = "/usr/share/man/man6/Solitaire.md"sv; + + TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme(man_file) })); + TRY(Desktop::Launcher::seal_allowlist()); + Config::pledge_domains({ "Games", "Solitaire" }); Config::monitor_domain("Games"); @@ -208,6 +215,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Solitaire", app_icon, window))); + TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([&man_file](auto&) { + Desktop::Launcher::open(URL::create_with_file_scheme(man_file), "/bin/Help"); + }))); + window->set_resizable(false); window->resize(Solitaire::Game::width, Solitaire::Game::height + statusbar.max_height().as_int()); window->set_icon(app_icon.bitmap_for_size(16)); |