diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 6f46c68c304..409afabf02b 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -2756,6 +2756,37 @@ void WM_OT_read_homefile(wmOperatorType *ot) /* omit poll to run in background mode */ } +static int wm_read_factory_settings_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/) +{ + const bool unsaved = wm_file_or_session_data_has_unsaved_changes(CTX_data_main(C), + CTX_wm_manager(C)); + std::string title; + const bool template_only = U.app_template[0] && + RNA_boolean_get(op->ptr, "use_factory_startup_app_template_only"); + + if (template_only) { + char display_name[FILE_MAX]; + BLI_path_to_display_name(display_name, sizeof(display_name), IFACE_(U.app_template)); + title = fmt::format(IFACE_("Load Factory \"{}\" Startup File and Preferences"), + IFACE_(display_name)); + } + else { + title = IFACE_("Load Factory Default Startup File and Preferences"); + } + + return WM_operator_confirm_ex( + C, + op, + title.c_str(), + unsaved ? IFACE_("To make changes to Preferences permanent, use \"Save " + "Preferences\"\nWarning: Your file is " + "unsaved! Proceeding will abandon your changes.") : + IFACE_("To make changes to Preferences permanent, use \"Save Preferences.\""), + IFACE_("Load"), + ALERT_ICON_WARNING, + false); +} + void WM_OT_read_factory_settings(wmOperatorType *ot) { ot->name = "Load Factory Settings"; @@ -2764,7 +2795,7 @@ void WM_OT_read_factory_settings(wmOperatorType *ot) "Load factory default startup file and preferences. " "To make changes permanent, use \"Save Startup File\" and \"Save Preferences\""; - ot->invoke = WM_operator_confirm; + ot->invoke = wm_read_factory_settings_invoke; ot->exec = wm_homefile_read_exec; /* Omit poll to run in background mode. */