Add show in filesystem option for file favorites
This commit is contained in:
parent
30e71782af
commit
ca2005f658
2 changed files with 33 additions and 1 deletions
|
@ -2385,6 +2385,12 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case FILE_SHOW_IN_FILESYSTEM: {
|
||||||
|
if (!p_selected.is_empty()) {
|
||||||
|
navigate_to_path(p_selected[0]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
case FILE_DEPENDENCIES: {
|
case FILE_DEPENDENCIES: {
|
||||||
// Checkout the file dependencies.
|
// Checkout the file dependencies.
|
||||||
if (!p_selected.is_empty()) {
|
if (!p_selected.is_empty()) {
|
||||||
|
@ -3261,8 +3267,33 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
||||||
if (p_paths.size() == 1) {
|
if (p_paths.size() == 1) {
|
||||||
const String &fpath = p_paths[0];
|
const String &fpath = p_paths[0];
|
||||||
|
|
||||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
bool added_separator = false;
|
||||||
|
|
||||||
|
if (favorites_list.has(fpath)) {
|
||||||
|
TreeItem *favorites_item = tree->get_root()->get_first_child();
|
||||||
|
TreeItem *cursor_item = tree->get_selected();
|
||||||
|
bool is_item_in_favorites = false;
|
||||||
|
while (cursor_item != nullptr) {
|
||||||
|
if (cursor_item == favorites_item) {
|
||||||
|
is_item_in_favorites = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor_item = cursor_item->get_parent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_item_in_favorites) {
|
||||||
p_popup->add_separator();
|
p_popup->add_separator();
|
||||||
|
added_separator = true;
|
||||||
|
p_popup->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTR("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||||
|
if (!added_separator) {
|
||||||
|
p_popup->add_separator();
|
||||||
|
added_separator = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Opening the system file manager is not supported on the Android and web editors.
|
// Opening the system file manager is not supported on the Android and web editors.
|
||||||
const bool is_directory = fpath.ends_with("/");
|
const bool is_directory = fpath.ends_with("/");
|
||||||
|
|
|
@ -116,6 +116,7 @@ private:
|
||||||
FILE_INSTANTIATE,
|
FILE_INSTANTIATE,
|
||||||
FILE_ADD_FAVORITE,
|
FILE_ADD_FAVORITE,
|
||||||
FILE_REMOVE_FAVORITE,
|
FILE_REMOVE_FAVORITE,
|
||||||
|
FILE_SHOW_IN_FILESYSTEM,
|
||||||
FILE_DEPENDENCIES,
|
FILE_DEPENDENCIES,
|
||||||
FILE_OWNERS,
|
FILE_OWNERS,
|
||||||
FILE_MOVE,
|
FILE_MOVE,
|
||||||
|
|
Loading…
Reference in a new issue