mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 04:58:11 +02:00
IDE: do not confirm overwrite on Cocoa, where the dialog is already confirms replace
git-svn-id: trunk@63605 -
This commit is contained in:
parent
e9adb1add4
commit
3c431cf740
@ -40,6 +40,8 @@ type
|
||||
TIDESaveDialog = class(TSaveDialog)
|
||||
protected
|
||||
function DoExecute: boolean; override;
|
||||
public
|
||||
class function NeedOverwritePrompt: boolean; virtual;
|
||||
end;
|
||||
TIDESaveDialogClass = class of TIDESaveDialog;
|
||||
|
||||
@ -179,6 +181,11 @@ begin
|
||||
LazFileCache.InvalidateFileStateCache;
|
||||
end;
|
||||
|
||||
class function TIDESaveDialog.NeedOverwritePrompt: boolean;
|
||||
begin
|
||||
Result:={$if defined(LCLCocoa)}false{$else}true{$endif};
|
||||
end;
|
||||
|
||||
{ TIDEOpenDialog }
|
||||
|
||||
function TIDEOpenDialog.DoExecute: boolean;
|
||||
|
@ -4624,6 +4624,7 @@ var
|
||||
OldUnitName, NewUnitName: string;
|
||||
ACaption, AText, APath: string;
|
||||
Filter, AllEditorExt, AllFilter: string;
|
||||
NeedOverwritePrompt: Boolean;
|
||||
begin
|
||||
if (AnUnitInfo<>nil) and (AnUnitInfo.OpenEditorInfoCount>0) then
|
||||
SrcEdit := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent)
|
||||
@ -4787,7 +4788,9 @@ begin
|
||||
end;
|
||||
|
||||
// check overwrite existing file
|
||||
if ((not FilenameIsAbsolute(AFilename)) or (CompareFilenames(NewFilename,AFilename)<>0))
|
||||
if IDESaveDialogClass.NeedOverwritePrompt
|
||||
and ((not FilenameIsAbsolute(AFilename))
|
||||
or (CompareFilenames(NewFilename,AFilename)<>0))
|
||||
and FileExistsUTF8(NewFilename) then
|
||||
begin
|
||||
ACaption:=lisOverwriteFile;
|
||||
@ -7755,10 +7758,13 @@ begin
|
||||
// Note: if user confirms overwriting .lpi do not ask for overwriting .lpr
|
||||
if FileExistsUTF8(NewLPIFilename) then
|
||||
begin
|
||||
ACaption:=lisOverwriteFile;
|
||||
AText:=Format(lisAFileAlreadyExistsReplaceIt, [NewLPIFilename, LineEnding]);
|
||||
Result:=IDEMessageDialog(ACaption, AText, mtConfirmation, [mbOk, mbCancel]);
|
||||
if Result=mrCancel then exit;
|
||||
if IDESaveDialogClass.NeedOverwritePrompt then
|
||||
begin
|
||||
ACaption:=lisOverwriteFile;
|
||||
AText:=Format(lisAFileAlreadyExistsReplaceIt, [NewLPIFilename, LineEnding]);
|
||||
Result:=IDEMessageDialog(ACaption, AText, mtConfirmation, [mbOk, mbCancel]);
|
||||
if Result=mrCancel then exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user