mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Editor - disable save action with read-only file (fixes #1379)
This commit is contained in:
parent
7720dd970e
commit
822bb09f8f
3 changed files with 8 additions and 12 deletions
|
|
@ -917,13 +917,6 @@ object frmEditor: TfrmEditor
|
|||
ImageIndex = 12
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actSaveAll: TAction
|
||||
Category = 'File'
|
||||
Caption = 'Sa&ve All'
|
||||
HelpType = htKeyword
|
||||
Hint = 'Save All'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actEditFind: TAction
|
||||
Category = 'Edit'
|
||||
Caption = '&Find'
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@
|
|||
{"hash":21703,"name":"tfrmeditor.actfilenew.hint","sourcebytes":[78,101,119],"value":"New"},
|
||||
{"hash":4710148,"name":"tfrmeditor.actfileexit.caption","sourcebytes":[69,38,120,105,116],"value":"E&xit"},
|
||||
{"hash":315140,"name":"tfrmeditor.actfileexit.hint","sourcebytes":[69,120,105,116],"value":"Exit"},
|
||||
{"hash":231153436,"name":"tfrmeditor.actsaveall.caption","sourcebytes":[83,97,38,118,101,32,65,108,108],"value":"Sa&ve All"},
|
||||
{"hash":147276732,"name":"tfrmeditor.actsaveall.hint","sourcebytes":[83,97,118,101,32,65,108,108],"value":"Save All"},
|
||||
{"hash":2805828,"name":"tfrmeditor.acteditfind.caption","sourcebytes":[38,70,105,110,100],"value":"&Find"},
|
||||
{"hash":315460,"name":"tfrmeditor.acteditfind.hint","sourcebytes":[70,105,110,100],"value":"Find"},
|
||||
{"hash":147268901,"name":"tfrmeditor.acteditrplc.caption","sourcebytes":[38,82,101,112,108,97,99,101],"value":"&Replace"},
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ type
|
|||
miReplace: TMenuItem;
|
||||
Help1: TMenuItem;
|
||||
miAbout: TMenuItem;
|
||||
actSaveAll: TAction;
|
||||
StatusBar: TStatusBar;
|
||||
Editor: TSynEdit;
|
||||
miHighlight: TMenuItem;
|
||||
|
|
@ -237,7 +236,8 @@ implementation
|
|||
uses
|
||||
Clipbrd, dmCommonData, dmHigh, SynEditTypes, LCLType, LConvEncoding,
|
||||
uLng, uShowMsg, uGlobs, fOptions, DCClassesUtf8, uAdministrator, uHighlighters,
|
||||
uOSUtils, uConvEncoding, fOptionsToolsEditor, uDCUtils, uClipboard, uFindFiles;
|
||||
uOSUtils, uConvEncoding, fOptionsToolsEditor, uDCUtils, uClipboard, uFindFiles,
|
||||
DCOSUtils;
|
||||
|
||||
procedure ShowEditor(const sFileName: String; WaitData: TWaitData = nil);
|
||||
var
|
||||
|
|
@ -420,6 +420,7 @@ begin
|
|||
Reader := TFileStreamUAC.Create(aFileName, fmOpenRead or fmShareDenyNone);
|
||||
try
|
||||
SetLength(sOriginalText, Reader.Size);
|
||||
actFileSave.Enabled:= not FileIsReadOnly(Reader.Handle);
|
||||
Reader.Read(Pointer(sOriginalText)^, Length(sOriginalText));
|
||||
finally
|
||||
Reader.Free;
|
||||
|
|
@ -918,6 +919,7 @@ begin
|
|||
FileName := rsMsgNewFile;
|
||||
Editor.Lines.Clear;
|
||||
Editor.Modified:= False;
|
||||
actFileSave.Enabled:= True;
|
||||
bNoname:= True;
|
||||
UpdateStatus;
|
||||
end;
|
||||
|
|
@ -961,7 +963,10 @@ begin
|
|||
Exit;
|
||||
|
||||
FileName := dmComData.SaveDialog.FileName;
|
||||
SaveFile(FileName);
|
||||
if SaveFile(FileName) then
|
||||
begin
|
||||
actFileSave.Enabled:= True;
|
||||
end;
|
||||
bNoname:=False;
|
||||
|
||||
UpdateStatus;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue