diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-09-22 10:31:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-22 10:31:21 +0200 |
commit | 29c557a29a7ec47217233726797c4b91374b0a5e (patch) | |
tree | 3787e7ce2fb18a63aa63ac7940765c89ff031d99 /editor | |
parent | 6555bf88379fde6bd2e9bfb6d956137e937c176f (diff) | |
parent | 622bae393b7bbaf966a178c308080f0ec98eabc5 (diff) |
Merge pull request #21963 from YeldhamDev/dir_select_fix
Make EditorFileDialog be able to pick a folder when entering it
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_file_dialog.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index f11a30bb86..08fd8a1319 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -198,8 +198,18 @@ void EditorFileDialog::update_dir() { dir->set_text(dir_access->get_current_dir()); - // Disable "Open" button only when we in selecting file(s) mode or open dir mode. + // Disable "Open" button only when selecting file(s) mode. get_ok()->set_disabled(_is_open_should_be_disabled()); + switch (mode) { + + case MODE_OPEN_FILE: + case MODE_OPEN_FILES: + get_ok()->set_text(TTR("Open")); + break; + case MODE_OPEN_DIR: + get_ok()->set_text(TTR("Select Current Folder")); + break; + } } void EditorFileDialog::_dir_entered(String p_dir) { @@ -453,6 +463,8 @@ void EditorFileDialog::_item_selected(int p_item) { file->set_text(d["name"]); _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); + } else if (mode == MODE_OPEN_DIR) { + get_ok()->set_text(TTR("Select This Folder")); } get_ok()->set_disabled(_is_open_should_be_disabled()); @@ -637,7 +649,7 @@ bool EditorFileDialog::_is_open_should_be_disabled() { Vector<int> items = item_list->get_selected_items(); if (items.size() == 0) - return true; + return mode != MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder. for (int i = 0; i < items.size(); i++) { |