mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 15:47:18 +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)
|
TIDESaveDialog = class(TSaveDialog)
|
||||||
protected
|
protected
|
||||||
function DoExecute: boolean; override;
|
function DoExecute: boolean; override;
|
||||||
|
public
|
||||||
|
class function NeedOverwritePrompt: boolean; virtual;
|
||||||
end;
|
end;
|
||||||
TIDESaveDialogClass = class of TIDESaveDialog;
|
TIDESaveDialogClass = class of TIDESaveDialog;
|
||||||
|
|
||||||
@ -179,6 +181,11 @@ begin
|
|||||||
LazFileCache.InvalidateFileStateCache;
|
LazFileCache.InvalidateFileStateCache;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TIDESaveDialog.NeedOverwritePrompt: boolean;
|
||||||
|
begin
|
||||||
|
Result:={$if defined(LCLCocoa)}false{$else}true{$endif};
|
||||||
|
end;
|
||||||
|
|
||||||
{ TIDEOpenDialog }
|
{ TIDEOpenDialog }
|
||||||
|
|
||||||
function TIDEOpenDialog.DoExecute: boolean;
|
function TIDEOpenDialog.DoExecute: boolean;
|
||||||
|
@ -4624,6 +4624,7 @@ var
|
|||||||
OldUnitName, NewUnitName: string;
|
OldUnitName, NewUnitName: string;
|
||||||
ACaption, AText, APath: string;
|
ACaption, AText, APath: string;
|
||||||
Filter, AllEditorExt, AllFilter: string;
|
Filter, AllEditorExt, AllFilter: string;
|
||||||
|
NeedOverwritePrompt: Boolean;
|
||||||
begin
|
begin
|
||||||
if (AnUnitInfo<>nil) and (AnUnitInfo.OpenEditorInfoCount>0) then
|
if (AnUnitInfo<>nil) and (AnUnitInfo.OpenEditorInfoCount>0) then
|
||||||
SrcEdit := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent)
|
SrcEdit := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent)
|
||||||
@ -4787,7 +4788,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// check overwrite existing file
|
// 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
|
and FileExistsUTF8(NewFilename) then
|
||||||
begin
|
begin
|
||||||
ACaption:=lisOverwriteFile;
|
ACaption:=lisOverwriteFile;
|
||||||
@ -7755,10 +7758,13 @@ begin
|
|||||||
// Note: if user confirms overwriting .lpi do not ask for overwriting .lpr
|
// Note: if user confirms overwriting .lpi do not ask for overwriting .lpr
|
||||||
if FileExistsUTF8(NewLPIFilename) then
|
if FileExistsUTF8(NewLPIFilename) then
|
||||||
begin
|
begin
|
||||||
ACaption:=lisOverwriteFile;
|
if IDESaveDialogClass.NeedOverwritePrompt then
|
||||||
AText:=Format(lisAFileAlreadyExistsReplaceIt, [NewLPIFilename, LineEnding]);
|
begin
|
||||||
Result:=IDEMessageDialog(ACaption, AText, mtConfirmation, [mbOk, mbCancel]);
|
ACaption:=lisOverwriteFile;
|
||||||
if Result=mrCancel then exit;
|
AText:=Format(lisAFileAlreadyExistsReplaceIt, [NewLPIFilename, LineEnding]);
|
||||||
|
Result:=IDEMessageDialog(ACaption, AText, mtConfirmation, [mbOk, mbCancel]);
|
||||||
|
if Result=mrCancel then exit;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user