mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:35:07 +00:00
FileManager: Add "Open in TextEditor..." action to context menu
This commit is contained in:
parent
5da385c16e
commit
1ce8a175e1
1 changed files with 13 additions and 0 deletions
|
@ -342,11 +342,24 @@ int main(int argc, char** argv)
|
|||
delete_action->set_enabled(!view.selection().is_empty());
|
||||
};
|
||||
|
||||
auto open_in_text_editor_action = GAction::create("Open in TextEditor...", GraphicsBitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) {
|
||||
for (auto& path : selected_file_paths()) {
|
||||
if (!fork()) {
|
||||
int rc = execl("/bin/TextEditor", "TextEditor", path.characters(), nullptr);
|
||||
if (rc < 0)
|
||||
perror("execl");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
auto context_menu = make<GMenu>();
|
||||
context_menu->add_action(copy_action);
|
||||
context_menu->add_action(paste_action);
|
||||
context_menu->add_action(delete_action);
|
||||
context_menu->add_separator();
|
||||
context_menu->add_action(open_in_text_editor_action);
|
||||
context_menu->add_separator();
|
||||
context_menu->add_action(properties_action);
|
||||
|
||||
directory_view->on_context_menu_request = [&](const GAbstractView&, const GModelIndex&, const GContextMenuEvent& event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue