mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
2048: Add link to help pages in menu
This commit is contained in:
parent
e59556d531
commit
357a36b622
2 changed files with 10 additions and 1 deletions
|
@ -12,4 +12,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(2048 ICON app-2048)
|
serenity_app(2048 ICON app-2048)
|
||||||
target_link_libraries(2048 LibConfig LibGUI LibMain)
|
target_link_libraries(2048 LibConfig LibGUI LibMain LibDesktop)
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
#include "BoardView.h"
|
#include "BoardView.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GameSizeDialog.h"
|
#include "GameSizeDialog.h"
|
||||||
|
#include <AK/URL.h>
|
||||||
#include <LibConfig/Client.h>
|
#include <LibConfig/Client.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
|
#include <LibDesktop/Launcher.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
|
@ -37,9 +39,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
Config::pledge_domains("2048");
|
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::pledge("stdio rpath recvfd sendfd"));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
|
TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
size_t board_size = Config::read_i32("2048", "", "board_size", 4);
|
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"));
|
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)));
|
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("2048", app_icon, window)));
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue