diff options
author | dgp <dgp@users.sourceforge.net> | 2011-10-05 19:18:20 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-10-05 19:18:20 (GMT) |
commit | 7f0c75ac2e61b2457146f5b2a39e252b250196b5 (patch) | |
tree | 4fe7f10e2615504ad9f1e944efb5fdb14ba6edd4 | |
parent | 7571c73ea570497dcb0c8900ba99fcef9f4cbbfe (diff) | |
download | tk-7f0c75ac2e61b2457146f5b2a39e252b250196b5.zip tk-7f0c75ac2e61b2457146f5b2a39e252b250196b5.tar.gz tk-7f0c75ac2e61b2457146f5b2a39e252b250196b5.tar.bz2 |
Revise the proposed "-nocomplain" option to "-confirmoverwrite"
-rw-r--r-- | library/tkfbox.tcl | 4 | ||||
-rw-r--r-- | win/tkWinDialog.c | 20 |
2 files changed, 13 insertions, 11 deletions
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index ffffb3e..214a31b 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -986,7 +986,7 @@ proc ::tk::dialog::file::Config {dataName type argList} { # The "-nocomplain" option is only available for the "save" file dialog. # if {$type eq "save"} { - lappend specs {-nocomplain "" "" "0"} + lappend specs {-confirmoverwrite "" "" "1"} } # 2: default values depending on the type of the dialog @@ -1865,7 +1865,7 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} { set Priv(selectFile) $data(selectFile) set Priv(selectPath) $data(selectPath) - if {($data(type) eq "save") && !$data(-nocomplain) && [file exists $selectFilePath]} { + if {($data(type) eq "save") && $data(-confirmoverwrite) && [file exists $selectFilePath]} { set reply [tk_messageBox -icon warning -type yesno -parent $w \ -message [mc "File \"%1\$s\" already exists.\nDo you want\ to overwrite it?" $selectFilePath]] diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index aca8e5d..457f0e9 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -591,7 +591,8 @@ GetFileNameW( WCHAR file[TK_MULTI_MAX_PATH]; OFNData ofnData; int cdlgerr; - int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0, noComplain = 0; + int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0; + int confirmOverwrite = 1; char *extension = NULL, *title = NULL; Tk_Window tkwin = (Tk_Window) clientData; HWND hWnd; @@ -602,8 +603,9 @@ GetFileNameW( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); static CONST char *saveOptionStrings[] = { - "-defaultextension", "-filetypes", "-initialdir", "-initialfile", - "-parent", "-title", "-typevariable", "-nocomplain", NULL + "-confirmoverwrite", "-defaultextension", "-filetypes", + "-initialdir", "-initialfile", "-parent", "-title", + "-typevariable", "-nocomplain", NULL }; static CONST char *openOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", @@ -612,9 +614,9 @@ GetFileNameW( CONST char **optionStrings; enum options { - FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE, - FILE_MULTIPLE, FILE_PARENT, FILE_TITLE, FILE_TYPEVARIABLE, - FILE_NOCOMPLAIN + FILE_CONFOW, FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, + FILE_INITFILE, FILE_MULTIPLE, FILE_PARENT, FILE_TITLE, + FILE_TYPEVARIABLE }; file[0] = '\0'; @@ -713,8 +715,8 @@ GetFileNameW( initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL, TCL_GLOBAL_ONLY); break; - case FILE_NOCOMPLAIN: - if (Tcl_GetBooleanFromObj(interp, valuePtr, &noComplain) != TCL_OK) { + case FILE_CONFOW: + if (Tcl_GetBooleanFromObj(interp, valuePtr, &confirmOverwrite) != TCL_OK) { return TCL_ERROR; } break; @@ -746,7 +748,7 @@ GetFileNameW( if (open != 0) { ofn.Flags |= OFN_FILEMUSTEXIST; - } else if (noComplain == 0) { + } else if (confirmOverwrite) { ofn.Flags |= OFN_OVERWRITEPROMPT; } if (tsdPtr->debugFlag != 0) { |