summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
authorDavid Lindbom <hi@davidlindbom.se>2022-01-09 20:31:11 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-01-13 03:45:17 -0800
commitae6d3263885e531cba35847e44232010af859290 (patch)
treecc53f1a1526b3f2ad3b215e6acd9b8d2778c2d12 /Userland/Games
parent535b0be7fe0492040235a0410386564a7d12315b (diff)
downloadserenity-ae6d3263885e531cba35847e44232010af859290.zip
Minesweeper: Add link to help pages in menu
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/Minesweeper/CMakeLists.txt2
-rw-r--r--Userland/Games/Minesweeper/main.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/Userland/Games/Minesweeper/CMakeLists.txt b/Userland/Games/Minesweeper/CMakeLists.txt
index 8118226563..ac76c1bb5f 100644
--- a/Userland/Games/Minesweeper/CMakeLists.txt
+++ b/Userland/Games/Minesweeper/CMakeLists.txt
@@ -14,4 +14,4 @@ set(SOURCES
)
serenity_app(Minesweeper ICON app-minesweeper)
-target_link_libraries(Minesweeper LibGUI LibConfig LibMain)
+target_link_libraries(Minesweeper LibGUI LibConfig LibMain LibDesktop)
diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp
index 6234c413f6..c3ce2be9b1 100644
--- a/Userland/Games/Minesweeper/main.cpp
+++ b/Userland/Games/Minesweeper/main.cpp
@@ -6,8 +6,10 @@
#include "CustomGameDialog.h"
#include "Field.h"
+#include <AK/URL.h>
#include <LibConfig/Client.h>
#include <LibCore/System.h>
+#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Application.h>
@@ -30,9 +32,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::pledge_domains("Minesweeper");
+ TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man6/Minesweeper.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));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-minesweeper"));
@@ -149,6 +155,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
difficulty_actions.add_action(action);
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/Minesweeper.md"), "/bin/Help");
+ })));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Minesweeper", app_icon, window)));
window->show();