mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
ADD: Save create directory history
FIX: Bug [0002417] Double commander allows trailing space filenames on NTFS
This commit is contained in:
parent
5c4cbf0648
commit
23292853d2
5 changed files with 50 additions and 33 deletions
|
|
@ -59,7 +59,6 @@ uses
|
|||
fHackForm,
|
||||
fMain,
|
||||
uAccentsUtils,
|
||||
fMkDir,
|
||||
dmHigh, dmHelpManager, dmCommonData,
|
||||
uShowMsg,
|
||||
uCryptProc,
|
||||
|
|
@ -205,7 +204,6 @@ begin
|
|||
Application.CreateForm(TdmHighl, dmHighl); // highlighters
|
||||
Application.CreateForm(TdmComData, dmComData); // common data
|
||||
Application.CreateForm(TdmHelpManager, dmHelpMgr); // help manager
|
||||
Application.CreateForm(TfrmMkDir, frmMkDir); // 21.05.2009 - makedir form
|
||||
|
||||
{$IF DEFINED(LCLGTK2) AND (lcl_fullversion >= 093100)}
|
||||
// LCLGTK2 uses Application.MainForm as the clipboard widget, however our
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ object frmMkDir: TfrmMkDir
|
|||
Constraints.MinWidth = 350
|
||||
KeyPreview = True
|
||||
OnKeyPress = FormKeyPress
|
||||
Position = poScreenCenter
|
||||
Position = poOwnerFormCenter
|
||||
LCLVersion = '1.1'
|
||||
object lblMakeDir: TLabel
|
||||
Left = 6
|
||||
|
|
|
|||
|
|
@ -18,56 +18,69 @@ type
|
|||
lblMakeDir: TLabel;
|
||||
pnlButtons: TPanel;
|
||||
pnlBottom: TPanel;
|
||||
|
||||
procedure FormKeyPress(Sender: TObject; var Key: Char);
|
||||
public
|
||||
function ShowMkDir(var sPath:string):Boolean; // 21.05.2009 - перенес в public
|
||||
|
||||
end;
|
||||
|
||||
var frmMkDir: TfrmMkDir; // 21.05.2009 - создаем из файла проекта
|
||||
function ShowMkDir(TheOwner: TComponent; var sPath: String): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
uGlobs;
|
||||
|
||||
procedure TfrmMkDir.FormKeyPress(Sender: TObject; var Key: Char);
|
||||
begin
|
||||
inherited;
|
||||
if Key=#27 then
|
||||
if Key = #27 then
|
||||
begin
|
||||
ModalResult:=mrCancel;
|
||||
ModalResult:= mrCancel;
|
||||
Key := #0;
|
||||
end
|
||||
else if Key=#13 then
|
||||
else if Key = #13 then
|
||||
begin
|
||||
ModalResult:=mrOK;
|
||||
Key:=#0;
|
||||
ModalResult:= mrOK;
|
||||
Key:= #0;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TfrmMkDir.ShowMkDir(var sPath:string):Boolean; var Index: Integer;
|
||||
function ShowMkDir(TheOwner: TComponent; var sPath: String): Boolean;
|
||||
const
|
||||
MAX_LINES = 20;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
ActiveControl := cbMkDir;
|
||||
if (sPath <> '..') then
|
||||
cbMkDir.Text := sPath
|
||||
else
|
||||
cbMkDir.Text := '';
|
||||
cbMkDir.SelectAll;
|
||||
Result := (ShowModal = mrOK);
|
||||
sPath := cbMkDir.Text;
|
||||
If Result then
|
||||
begin
|
||||
Index := cbMkDir.Items.IndexOf(cbMkDir.Text);
|
||||
if (Index = -1) then
|
||||
cbMkDir.Items.Insert(0, cbMkDir.Text)
|
||||
else
|
||||
cbMkDir.Items.Move(Index, 0);
|
||||
with TfrmMkDir .Create(TheOwner) do
|
||||
try
|
||||
ActiveControl := cbMkDir;
|
||||
cbMkDir.Items.Assign(glsCreateDirectoriesHistory);
|
||||
if (sPath <> '..') then
|
||||
cbMkDir.Text := sPath
|
||||
else begin
|
||||
cbMkDir.Text := '';
|
||||
end;
|
||||
cbMkDir.SelectAll;
|
||||
Result := (ShowModal = mrOK);
|
||||
if Result then
|
||||
begin
|
||||
sPath := TrimRight(cbMkDir.Text);
|
||||
sPath := StringReplace(sPath, ' ' + PathDelim, PathDelim, [rfReplaceAll]);
|
||||
glsCreateDirectoriesHistory.CaseSensitive := FileNameCaseSensitive;
|
||||
Index := glsCreateDirectoriesHistory.IndexOf(cbMkDir.Text);
|
||||
|
||||
if (cbMkDir.Items.Count > MAX_LINES) then
|
||||
cbMkDir.Items.Delete(cbMkDir.Items.Count - 1);
|
||||
end;
|
||||
if (Index = -1) then
|
||||
glsCreateDirectoriesHistory.Insert(0, sPath)
|
||||
else
|
||||
glsCreateDirectoriesHistory.Move(Index, 0);
|
||||
|
||||
if (glsCreateDirectoriesHistory.Count > MAX_LINES) then
|
||||
glsCreateDirectoriesHistory.Delete(glsCreateDirectoriesHistory.Count - 1);
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -340,6 +340,7 @@ var
|
|||
glsSearchPathHistory : TStringListEx;
|
||||
glsReplaceHistory : TStringListEx;
|
||||
glsReplacePathHistory : TStringListEx;
|
||||
glsCreateDirectoriesHistory : TStringListEx;
|
||||
glsSearchDirectories: TStringList;
|
||||
glsSearchExcludeFiles: TStringList;
|
||||
glsSearchExcludeDirectories: TStringList;
|
||||
|
|
@ -873,6 +874,7 @@ begin
|
|||
LoadHistory('SearchTextPath', glsSearchPathHistory);
|
||||
LoadHistory('ReplaceText', glsReplaceHistory);
|
||||
LoadHistory('ReplaceTextPath', glsReplacePathHistory);
|
||||
LoadHistory('CreateDirectories', glsCreateDirectoriesHistory);
|
||||
LoadHistory('SearchDirectories', glsSearchDirectories);
|
||||
LoadHistory('SearchExcludeFiles', glsSearchExcludeFiles);
|
||||
LoadHistory('SearchExcludeDirectories', glsSearchExcludeDirectories);
|
||||
|
|
@ -919,6 +921,7 @@ begin
|
|||
SaveHistory('SearchTextPath', glsSearchPathHistory);
|
||||
SaveHistory('ReplaceText', glsReplaceHistory);
|
||||
SaveHistory('ReplaceTextPath', glsReplacePathHistory);
|
||||
SaveHistory('CreateDirectories', glsCreateDirectoriesHistory);
|
||||
SaveHistory('SearchDirectories', glsSearchDirectories);
|
||||
SaveHistory('SearchExcludeFiles', glsSearchExcludeFiles);
|
||||
SaveHistory('SearchExcludeDirectories', glsSearchExcludeDirectories);
|
||||
|
|
@ -1437,6 +1440,7 @@ begin
|
|||
glsSearchPathHistory := TStringListEx.Create;
|
||||
glsReplaceHistory := TStringListEx.Create;
|
||||
glsReplacePathHistory := TStringListEx.Create;
|
||||
glsCreateDirectoriesHistory := TStringListEx.Create;
|
||||
glsIgnoreList := TStringListEx.Create;
|
||||
glsSearchDirectories := TStringList.Create;
|
||||
glsSearchExcludeFiles:= TStringList.Create;
|
||||
|
|
@ -1466,6 +1470,7 @@ begin
|
|||
FreeThenNil(glsSearchPathHistory);
|
||||
FreeThenNil(glsReplaceHistory);
|
||||
FreeThenNil(glsReplacePathHistory);
|
||||
FreeAndNil(glsCreateDirectoriesHistory);
|
||||
FreeThenNil(glsIgnoreList);
|
||||
FreeThenNil(glsSearchDirectories);
|
||||
FreeThenNil(glsSearchExcludeFiles);
|
||||
|
|
@ -2045,6 +2050,7 @@ begin
|
|||
glsSearchPathHistory.Clear;
|
||||
glsReplaceHistory.Clear;
|
||||
glsReplacePathHistory.Clear;
|
||||
glsCreateDirectoriesHistory.Clear;
|
||||
glsIgnoreList.Clear;
|
||||
gSearchTemplateList.Clear;
|
||||
gDSXPlugins.Clear;
|
||||
|
|
|
|||
|
|
@ -2291,7 +2291,7 @@ begin
|
|||
else
|
||||
sPath := EmptyStr;
|
||||
|
||||
if not frmMkDir.ShowMkDir(sPath) then Exit; // show makedir dialog
|
||||
if not ShowMkDir(frmMain, sPath) then Exit; // show makedir dialog
|
||||
if (sPath = EmptyStr) then Exit;
|
||||
|
||||
if bMakeViaCopy then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue