Allow selection of option 'Open in File Manager' even when a file/folder is not explicitly selected.

(cherry picked from commit b7348419a3)
This commit is contained in:
SaracenOne 2022-01-18 23:51:10 +00:00 committed by Rémi Verschelde
parent 58c460b3b7
commit 37910dd10f
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2456,6 +2456,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
String fpath = p_paths[0]; String fpath = p_paths[0];
String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager"); String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager");
p_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, FILE_SHOW_IN_EXPLORER); p_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, FILE_SHOW_IN_EXPLORER);
path = fpath;
} }
} }
@ -2490,6 +2491,9 @@ void FileSystemDock::_tree_rmb_empty(const Vector2 &p_pos) {
tree_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); tree_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
tree_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); tree_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
tree_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); tree_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
tree_popup->add_separator();
tree_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), FILE_SHOW_IN_EXPLORER);
tree_popup->set_position(tree->get_global_position() + p_pos); tree_popup->set_position(tree->get_global_position() + p_pos);
tree_popup->popup(); tree_popup->popup();
} }
@ -2528,6 +2532,8 @@ void FileSystemDock::_file_list_rmb_pressed(const Vector2 &p_pos) {
return; return;
} }
path = current_path->get_text();
file_list_popup->clear(); file_list_popup->clear();
file_list_popup->set_size(Size2(1, 1)); file_list_popup->set_size(Size2(1, 1));