diff options
author | Linus Groh <mail@linusgroh.de> | 2020-12-27 19:13:57 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-27 22:46:52 +0100 |
commit | ddeb261bc26defc51433d2a49b7b961117212db2 (patch) | |
tree | b48ae4b71b56c8306e9ab6fc882ab58a02f2d87d /Libraries | |
parent | 6f95a6ca27dd1443aec525b4c44758e53d81cdf9 (diff) | |
download | serenity-ddeb261bc26defc51433d2a49b7b961117212db2.zip |
Terminal+LibVT: Use GUI::AppFile
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibVT/TerminalWidget.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index 774fff8fea..dc345a1862 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -36,6 +36,7 @@ #include <LibCore/MimeData.h> #include <LibDesktop/Launcher.h> #include <LibGUI/Action.h> +#include <LibGUI/AppFile.h> #include <LibGUI/Application.h> #include <LibGUI/Clipboard.h> #include <LibGUI/DragOperation.h> @@ -857,12 +858,10 @@ void TerminalWidget::context_menu_event(GUI::ContextMenuEvent& event) // Then add them to the context menu. // FIXME: Adapt this code when we actually support calling LaunchServer with a specific handler in mind. for (auto& handler : handlers) { - auto af_path = String::format("/res/apps/%s.af", LexicalPath(handler).basename().characters()); - auto af = Core::ConfigFile::open(af_path); - auto handler_name = af->read_entry("App", "Name", handler); - auto handler_executable = af->read_entry("App", "Executable"); - auto handler_icon = GUI::FileIconProvider::icon_for_path(handler_executable).bitmap_for_size(16); - auto action = GUI::Action::create(String::format("Open in %s", handler_name.characters()), handler_icon, [this, handler](auto&) { + auto af = GUI::AppFile::get_for_app(LexicalPath(handler).basename()); + if (!af->is_valid()) + continue; + auto action = GUI::Action::create(String::formatted("Open in {}", af->name()), af->icon().bitmap_for_size(16), [this, handler](auto&) { Desktop::Launcher::open(m_context_menu_href, handler); }); |