diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-09-11 03:32:14 -0300 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-09-21 19:42:06 -0300 |
commit | 622bae393b7bbaf966a178c308080f0ec98eabc5 (patch) | |
tree | 22121575b1c093c9e59e9caed17f4bcc558a8c37 /editor | |
parent | ef7b384861d59e566badf1adf28c8b56255c912e (diff) |
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++) { |