You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Hide non-functional "Show in File Manager" buttons in Android/web editor
The editor filesystem isn't readily accessible by OS applications on those platforms.
This commit is contained in:
@@ -620,12 +620,16 @@ void EditorFileDialog::_item_list_item_rmb_clicked(int p_item, const Vector2 &p_
|
|||||||
if (allow_delete) {
|
if (allow_delete) {
|
||||||
item_menu->add_icon_item(theme_cache.action_delete, TTR("Delete"), ITEM_MENU_DELETE, Key::KEY_DELETE);
|
item_menu->add_icon_item(theme_cache.action_delete, TTR("Delete"), ITEM_MENU_DELETE, Key::KEY_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
|
// Opening the system file manager is not supported on the Android and web editors.
|
||||||
if (single_item_selected) {
|
if (single_item_selected) {
|
||||||
item_menu->add_separator();
|
item_menu->add_separator();
|
||||||
Dictionary item_meta = item_list->get_item_metadata(p_item);
|
Dictionary item_meta = item_list->get_item_metadata(p_item);
|
||||||
String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
||||||
item_menu->add_icon_item(theme_cache.filesystem, item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
item_menu->add_icon_item(theme_cache.filesystem, item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (item_menu->get_item_count() > 0) {
|
if (item_menu->get_item_count() > 0) {
|
||||||
item_menu->set_position(item_list->get_screen_position() + p_pos);
|
item_menu->set_position(item_list->get_screen_position() + p_pos);
|
||||||
@@ -655,8 +659,11 @@ void EditorFileDialog::_item_list_empty_clicked(const Vector2 &p_pos, MouseButto
|
|||||||
item_menu->add_icon_item(theme_cache.folder, TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KeyModifierMask::CMD_OR_CTRL | Key::N);
|
item_menu->add_icon_item(theme_cache.folder, TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KeyModifierMask::CMD_OR_CTRL | Key::N);
|
||||||
}
|
}
|
||||||
item_menu->add_icon_item(theme_cache.reload, TTR("Refresh"), ITEM_MENU_REFRESH, Key::F5);
|
item_menu->add_icon_item(theme_cache.reload, TTR("Refresh"), ITEM_MENU_REFRESH, Key::F5);
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
|
// Opening the system file manager is not supported on the Android and web editors.
|
||||||
item_menu->add_separator();
|
item_menu->add_separator();
|
||||||
item_menu->add_icon_item(theme_cache.filesystem, TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
item_menu->add_icon_item(theme_cache.filesystem, TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||||
|
#endif
|
||||||
|
|
||||||
item_menu->set_position(item_list->get_screen_position() + p_pos);
|
item_menu->set_position(item_list->get_screen_position() + p_pos);
|
||||||
item_menu->reset_size();
|
item_menu->reset_size();
|
||||||
|
|||||||
@@ -2643,17 +2643,24 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
|
|||||||
new_menu->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("Script..."), FILE_NEW_SCRIPT);
|
new_menu->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("Script..."), FILE_NEW_SCRIPT);
|
||||||
new_menu->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("Resource..."), FILE_NEW_RESOURCE);
|
new_menu->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("Resource..."), FILE_NEW_RESOURCE);
|
||||||
new_menu->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("TextFile..."), FILE_NEW_TEXTFILE);
|
new_menu->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("TextFile..."), FILE_NEW_TEXTFILE);
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
p_popup->add_separator();
|
p_popup->add_separator();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
String fpath = p_paths[0];
|
const String fpath = p_paths[0];
|
||||||
bool is_directory = fpath.ends_with("/");
|
|
||||||
String item_text = is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
|
// Opening the system file manager is not supported on the Android and web editors.
|
||||||
|
const bool is_directory = fpath.ends_with("/");
|
||||||
|
const String item_text = is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
||||||
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
|
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
|
||||||
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), item_text);
|
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), item_text);
|
||||||
if (!is_directory) {
|
if (!is_directory) {
|
||||||
p_popup->add_icon_shortcut(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_OPEN_EXTERNAL);
|
p_popup->add_icon_shortcut(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_OPEN_EXTERNAL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
path = fpath;
|
path = fpath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2697,8 +2704,11 @@ void FileSystemDock::_tree_empty_click(const Vector2 &p_pos, MouseButton p_butto
|
|||||||
tree_popup->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("New Script..."), FILE_NEW_SCRIPT);
|
tree_popup->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||||
tree_popup->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
tree_popup->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||||
tree_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
|
tree_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
|
// Opening the system file manager is not supported on the Android and web editors.
|
||||||
tree_popup->add_separator();
|
tree_popup->add_separator();
|
||||||
tree_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
|
tree_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
|
||||||
|
#endif
|
||||||
|
|
||||||
tree_popup->set_position(tree->get_screen_position() + p_pos);
|
tree_popup->set_position(tree->get_screen_position() + p_pos);
|
||||||
tree_popup->reset_size();
|
tree_popup->reset_size();
|
||||||
@@ -3120,8 +3130,11 @@ FileSystemDock::FileSystemDock() {
|
|||||||
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), Key::KEY_DELETE);
|
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), Key::KEY_DELETE);
|
||||||
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
|
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
|
||||||
ED_SHORTCUT_OVERRIDE("filesystem_dock/rename", "macos", Key::ENTER);
|
ED_SHORTCUT_OVERRIDE("filesystem_dock/rename", "macos", Key::ENTER);
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
|
// Opening the system file manager or opening in an external program is not supported on the Android and web editors.
|
||||||
ED_SHORTCUT("filesystem_dock/show_in_explorer", TTR("Open in File Manager"));
|
ED_SHORTCUT("filesystem_dock/show_in_explorer", TTR("Open in File Manager"));
|
||||||
ED_SHORTCUT("filesystem_dock/open_in_external_program", TTR("Open in External Program"));
|
ED_SHORTCUT("filesystem_dock/open_in_external_program", TTR("Open in External Program"));
|
||||||
|
#endif
|
||||||
|
|
||||||
VBoxContainer *top_vbc = memnew(VBoxContainer);
|
VBoxContainer *top_vbc = memnew(VBoxContainer);
|
||||||
add_child(top_vbc);
|
add_child(top_vbc);
|
||||||
|
|||||||
@@ -1503,8 +1503,13 @@ void ProjectList::create_project_item_control(int p_index) {
|
|||||||
path_hb->add_child(show);
|
path_hb->add_child(show);
|
||||||
|
|
||||||
if (!item.missing) {
|
if (!item.missing) {
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
show->connect("pressed", callable_mp(this, &ProjectList::_show_project).bind(item.path));
|
show->connect("pressed", callable_mp(this, &ProjectList::_show_project).bind(item.path));
|
||||||
show->set_tooltip_text(TTR("Show in File Manager"));
|
show->set_tooltip_text(TTR("Show in File Manager"));
|
||||||
|
#else
|
||||||
|
// Opening the system file manager is not supported on the Android and web editors.
|
||||||
|
show->hide();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
show->set_tooltip_text(TTR("Error: Project is missing on the filesystem."));
|
show->set_tooltip_text(TTR("Error: Project is missing on the filesystem."));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user