From c06f0fc17c7c109a25877cdbd0d274620bae5aa9 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 24 Oct 2011 20:19:53 +0000 Subject: TIP 382: Existence and argument validation for -confirmoverwrite on Cocoa. Option is ignored for now. --- macosx/tkMacOSXDialog.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index a5138ad..23b3de5 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -33,11 +33,13 @@ enum openOptions { }; static const char *const saveOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", - "-message", "-parent", "-title", "-typevariable", "-command", NULL + "-message", "-parent", "-title", "-typevariable", "-command", + "-confirmoverwrite", NULL }; enum saveOptions { SAVE_DEFAULT, SAVE_FILETYPES, SAVE_INITDIR, SAVE_INITFILE, SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE, SAVE_TYPEVARIABLE, SAVE_COMMAND, + SAVE_CONFIRMOW }; static const char *const chooseOptionStrings[] = { "-initialdir", "-message", "-mustexist", "-parent", "-title", "-command", @@ -534,6 +536,7 @@ Tk_GetSaveFileObjCmd( Tk_Window tkwin = clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; + int confirmOverwrite = 1; int index, len; FileFilterList fl; Tcl_Obj *cmdObj = NULL; @@ -613,6 +616,12 @@ Tk_GetSaveFileObjCmd( case SAVE_COMMAND: cmdObj = objv[i+1]; break; + case SAVE_CONFIRMOW: + if (Tcl_GetBooleanFromObj(interp, objv[i + 1], + &confirmOverwrite) != TCL_OK) { + goto end; + } + break; } } if (fl.filters || defaultType) { -- cgit v0.12