Magnifier: Add a manual to Help menu and propagate construction errors

This commit is contained in:
thankyouverycool 2022-11-24 19:24:27 -05:00 committed by Andreas Kling
parent 5e96ad0345
commit 31f4ec66c5
Notes: sideshowbarker 2024-07-17 21:16:31 +09:00
2 changed files with 10 additions and 3 deletions

View file

@ -10,4 +10,4 @@ set(SOURCES
)
serenity_app(Magnifier ICON app-magnifier)
target_link_libraries(Magnifier PRIVATE LibCore LibGfx LibGUI LibIPC LibMain LibFileSystemAccessClient)
target_link_libraries(Magnifier PRIVATE LibCore LibDesktop LibGfx LibGUI LibIPC LibMain LibFileSystemAccessClient)

View file

@ -7,6 +7,7 @@
#include "MagnifierWidget.h"
#include <AK/LexicalPath.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Application.h>
@ -40,6 +41,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd unix"));
auto app = TRY(GUI::Application::try_create(arguments));
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/Magnifier.md") }));
TRY(Desktop::Launcher::seal_allowlist());
TRY(Core::System::unveil("/sys/kernel/processes", "r"));
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
TRY(Core::System::unveil("/res", "r"));
@ -140,8 +144,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(window->try_add_menu(TRY(GUI::CommonMenus::make_accessibility_menu(magnifier))));
auto help_menu = TRY(window->try_add_menu("&Help"));
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu->add_action(GUI::CommonActions::make_about_action("Magnifier", app_icon, window));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Magnifier.md"), "/bin/Help");
})));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Magnifier", app_icon, window)));
window->show();
window->set_always_on_top(true);