View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037925 | Lazarus | Widgetset | public | 2020-10-14 14:30 | 2020-10-14 18:45 |
Reporter | Chris Rorden | Assigned To | Dmitry Boyarintsev | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Platform | MacBook | OS | Darwin | ||
Product Version | 2.1 (SVN) | ||||
Summary | 0037925: Cocoa: TSaveDialog ofOverwritePrompt issues | ||||
Description | The TSaveDialog does not implement ofOverwritePrompt properly. 1. The TSaveDialog ALWAYS generates an Overwrite Prompt, regardless of the setting of ofOverwritePrompt. 2. An Overwrite Prompt will be generated for "unit1.pas" but not when selecting "unit1" with ".pas" in the filter, even though both functions return precisely the same filename, e.g. "unit1.pas" that will overwrite a file. 3. TSaveDialog.Filter does not correctly set file extensions with two dots, e.g. TSaveDialog.Filter := 'Compressed Archive (.tar.gz)|*.tar.gz' will return 'filename.gz' not 'filename.tar.gz'. This impacts any format with double extensions, e.g. NII.GZ, TAR.GZ, TAR.BR, TAR.BZ, TAR.LPAQ, TAR.XZ, TAR.ZST | ||||
Steps To Reproduce | function TForm1.NiftiSaveDialogFilename(isOverwritePrompt: boolean): string; const kOutFilter = 'Pascal (.pas)|*.pas|Compressed NIfTI (.nii.gz)|*.nii.gz|Volume of interest (.voi)|*.voi|Blender Volume (.bvox)|*.bvox|OSPRay Volume (.osp)|*.osp|TIF (.tif)|*.tif|NRRD (.nrrd)|*.nrrd|Compressed NRRD (.nhdr)|*.nhdr'; kMaxExt = 8; kExt : array [1..kMaxExt] of string = ('*.pas', '*.nii.gz', '*.voi', '*.bvox', '*.osp', '*.tif', '*.nrrd', '*.nhdr'); var dlg : TSaveDialog; begin result := ''; dlg := TSaveDialog.Create(self); if isOverwritePrompt then dlg.Options := [ofEnableSizing, ofViewDetail, ofOverwritePrompt] else dlg.Options := [ofEnableSizing, ofViewDetail]; //NO disable ofOverwritePrompt dlg.Title := 'Save NIfTI volume'; dlg.FileName:= 'unit1'; dlg.Filter := kOutFilter; dlg.DefaultExt := kExt[1]; dlg.FilterIndex:= 1; if dlg.Execute then result := dlg.FileName; dlg.Free; end; | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
LazTarget | - | ||||
Widgetset | Cocoa | ||||
Attached Files |
|
|
|
|
Good finding. Other options of SaveDialog are ok? -AllowMultiSelect -CreatePrompt -FileMustExist -PathMustExist |
|
The number 3 problem is most likely in the LCL code and effects all I would guess. the code for getting the file extension most likely needs to be rewritten to capture the compile file name without the path attached and then use POS For the first "." and take the rest of the string for the extension there afterwards. I believe windows supports multiple dot addresses in file names.. maybe it should be looked at ? |
|
unlike Carbon, Cocoa doesn't provide flag similar to ofOverwritePrompt in macOS 10.14- , there was a hackish way to emulate the flag, but with macOS 10.15 and a new security restriction in place the approach no longer works |
|
https://wiki.freepascal.org/Cocoa_Internals/Dialogs#File_Dialog_Options |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-10-14 14:30 | Chris Rorden | New Issue | |
2020-10-14 14:30 | Chris Rorden | File Added: saveDialog.zip | |
2020-10-14 17:24 | CudaText man | Note Added: 0126298 | |
2020-10-14 18:00 | jamie philbrook | Note Added: 0126300 | |
2020-10-14 18:43 | Dmitry Boyarintsev | Assigned To | => Dmitry Boyarintsev |
2020-10-14 18:43 | Dmitry Boyarintsev | Status | new => acknowledged |
2020-10-14 18:43 | Dmitry Boyarintsev | LazTarget | => - |
2020-10-14 18:43 | Dmitry Boyarintsev | Note Added: 0126302 | |
2020-10-14 18:44 | Dmitry Boyarintsev | Note Added: 0126303 | |
2020-10-14 18:45 | Dmitry Boyarintsev | Note Edited: 0126302 | View Revisions |