Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2019-09-06 12:06:32 +0300
committerJulian Eisel <eiseljulian@gmail.com>2019-09-06 12:06:32 +0300
commite10f8c27a256eb8881bb17eb1ba7426573ff208a (patch)
tree7f4e5c0ec2fb7329e8e9b787fdfcf770d1fd5f1e /source/blender/editors/space_file/file_ops.c
parentf1659c5dd8dd3295d1beb0875cd4ab54506346d3 (diff)
UI: Confirmation prompt for file path auto-create
This confirmation prompt was there earlier, we removed the prompts for creating new directories all together, but in this case it's reasonable. Without it, it's simply too easy to create new directories by accident.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 5168300d21e..cb3b11fb8e6 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -2059,6 +2059,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
ot->idname = "FILE_OT_directory_new";
/* api callbacks */
+ ot->invoke = WM_operator_confirm_or_exec;
ot->exec = file_directory_new_exec;
ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
@@ -2067,6 +2068,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "open", false, "Open", "Open new directory");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ WM_operator_properties_confirm_or_exec(ot);
}
/* TODO This should go to BLI_path_utils. */
@@ -2198,6 +2200,8 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN
WM_operator_properties_create_ptr(&ptr, ot);
RNA_string_set(&ptr, "directory", sfile->params->dir);
RNA_boolean_set(&ptr, "open", true);
+ /* Enable confirmation prompt, else it's too easy to accidentaly create new directories. */
+ RNA_boolean_set(&ptr, "confirm", true);
if (lastdir) {
BLI_strncpy(sfile->params->dir, lastdir, sizeof(sfile->params->dir));