You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
[FileDialog] Update filename/buttons state when first item is selected on folder/filter change.
This commit is contained in:
@@ -664,10 +664,12 @@ void FileDialog::_tree_selected() {
|
|||||||
} else {
|
} else {
|
||||||
set_ok_button_text(ETR("Open"));
|
set_ok_button_text(ETR("Open"));
|
||||||
}
|
}
|
||||||
} else if (mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY) {
|
} else if (mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY || !dir_access->file_exists(file->get_text())) {
|
||||||
file->set_text("");
|
file->set_text("");
|
||||||
|
if (mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY) {
|
||||||
set_ok_button_text(ETR("Select This Folder"));
|
set_ok_button_text(ETR("Select This Folder"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get_ok_button()->set_disabled(_is_open_should_be_disabled());
|
get_ok_button()->set_disabled(_is_open_should_be_disabled());
|
||||||
}
|
}
|
||||||
@@ -931,6 +933,7 @@ void FileDialog::update_file_list() {
|
|||||||
// Select the first file from list if nothing is selected.
|
// Select the first file from list if nothing is selected.
|
||||||
if (tree->get_root() && tree->get_root()->get_first_child() && tree->get_selected() == nullptr) {
|
if (tree->get_root() && tree->get_root()->get_first_child() && tree->get_selected() == nullptr) {
|
||||||
tree->get_root()->get_first_child()->select(0);
|
tree->get_root()->get_first_child()->select(0);
|
||||||
|
_tree_selected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -949,6 +952,7 @@ void FileDialog::_filename_filter_changed() {
|
|||||||
void FileDialog::_tree_select_first() {
|
void FileDialog::_tree_select_first() {
|
||||||
if (tree->get_root() && tree->get_root()->get_first_child()) {
|
if (tree->get_root() && tree->get_root()->get_first_child()) {
|
||||||
tree->get_root()->get_first_child()->select(0);
|
tree->get_root()->get_first_child()->select(0);
|
||||||
|
_tree_selected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user