mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Solitaire: Add link to help page
This commit is contained in:
parent
88ebc44cbf
commit
50c0d0a3b0
2 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue