Terminal+LibVT: Use GUI::FileIconProvider for app icons

This commit is contained in:
Linus Groh 2020-12-24 16:10:33 +01:00 committed by Andreas Kling
parent bcecd2fa2f
commit b53011a198
2 changed files with 10 additions and 4 deletions

View file

@ -419,6 +419,11 @@ int main(int argc, char** argv)
return 1;
}
if (unveil("/bin", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil("/bin/Terminal", "x") < 0) {
perror("unveil");
return 1;

View file

@ -39,6 +39,8 @@
#include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h>
#include <LibGUI/DragOperation.h>
#include <LibGUI/FileIconProvider.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
@ -858,10 +860,9 @@ void TerminalWidget::context_menu_event(GUI::ContextMenuEvent& event)
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_icon = af->read_entry("Icons", "16x16", {});
auto icon = Gfx::Bitmap::load_from_file(handler_icon);
auto action = GUI::Action::create(String::format("Open in %s", handler_name.characters()), move(icon), [this, handler](auto&) {
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&) {
Desktop::Launcher::open(m_context_menu_href, handler);
});