Merge pull request #71482 from Calinou/editor-android-web-hide-show-in-file-manager
Hide non-functional "Show in File Manager" buttons in Android/web editor
This commit is contained in:
commit
155aac11b5
3 changed files with 28 additions and 3 deletions
|
@ -620,12 +620,16 @@ void EditorFileDialog::_item_list_item_rmb_clicked(int p_item, const Vector2 &p_
|
|||
if (allow_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) {
|
||||
item_menu->add_separator();
|
||||
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");
|
||||
item_menu->add_icon_item(theme_cache.filesystem, item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (item_menu->get_item_count() > 0) {
|
||||
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.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_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->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("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);
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
p_popup->add_separator();
|
||||
#endif
|
||||
}
|
||||
|
||||
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");
|
||||
const String fpath = p_paths[0];
|
||||
|
||||
#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->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), item_text);
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
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("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);
|
||||
#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_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->reset_size();
|
||||
|
@ -3120,8 +3130,11 @@ FileSystemDock::FileSystemDock() {
|
|||
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), Key::KEY_DELETE);
|
||||
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
|
||||
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/open_in_external_program", TTR("Open in External Program"));
|
||||
#endif
|
||||
|
||||
VBoxContainer *top_vbc = memnew(VBoxContainer);
|
||||
add_child(top_vbc);
|
||||
|
|
|
@ -1503,8 +1503,13 @@ void ProjectList::create_project_item_control(int p_index) {
|
|||
path_hb->add_child(show);
|
||||
|
||||
if (!item.missing) {
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
show->connect("pressed", callable_mp(this, &ProjectList::_show_project).bind(item.path));
|
||||
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 {
|
||||
show->set_tooltip_text(TTR("Error: Project is missing on the filesystem."));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue