UPD: Create hardlink and symlink dialogs

This commit is contained in:
Alexander Koblov 2023-10-25 23:18:28 +03:00
commit 585e804c10
6 changed files with 45 additions and 58 deletions

View file

@ -8,12 +8,14 @@ object frmHardLink: TfrmHardLink
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Create hard link'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 177
ClientWidth = 512
KeyPreview = True
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.0.4.0'
Position = poOwnerFormCenter
LCLVersion = '1.8.4.0'
object lblExistingFile: TLabel
AnchorSideLeft.Control = edtExistingFile
AnchorSideTop.Control = edtLinkToCreate
@ -34,7 +36,6 @@ object frmHardLink: TfrmHardLink
Height = 16
Top = 6
Width = 69
BorderSpacing.Top = 6
Caption = '&Link name'
FocusControl = edtLinkToCreate
ParentColor = False
@ -43,16 +44,12 @@ object frmHardLink: TfrmHardLink
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = lblExistingFile
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 25
Top = 81
Width = 500
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
Constraints.MinWidth = 400
TabOrder = 1
end
@ -60,16 +57,12 @@ object frmHardLink: TfrmHardLink
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = lblLinkToCreate
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 25
Top = 28
Width = 500
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
Constraints.MinWidth = 400
TabOrder = 0
end
@ -85,7 +78,6 @@ object frmHardLink: TfrmHardLink
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
BorderSpacing.InnerBorder = 2
Caption = '&OK'
Constraints.MinWidth = 100
@ -107,7 +99,6 @@ object frmHardLink: TfrmHardLink
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Bottom = 6
BorderSpacing.InnerBorder = 2
Cancel = True
Caption = '&Cancel'

View file

@ -27,7 +27,7 @@ type
CurrentPath: String); reintroduce;
end;
function ShowHardLinkForm(const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
function ShowHardLinkForm(TheOwner: TComponent; const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
implementation
@ -36,9 +36,9 @@ implementation
uses
LazFileUtils, uLng, uGlobs, uLog, uShowMsg, DCStrUtils, DCOSUtils, uAdministrator;
function ShowHardLinkForm(const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
function ShowHardLinkForm(TheOwner: TComponent; const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
begin
with TfrmHardLink.Create(Application, CurrentPath) do
with TfrmHardLink.Create(TheOwner, CurrentPath) do
begin
try
edtLinkToCreate.Text := sLinkToCreate;

View file

@ -2023,9 +2023,9 @@ begin
TargetFileName := TargetPath + ExtractFileName(SourceFileName);
if ((Operation = ddoSymLink) and
ShowSymLinkForm(SourceFileName, TargetFileName, TargetPath))
ShowSymLinkForm(Self, SourceFileName, TargetFileName, TargetPath))
or ((Operation = ddoHardLink) and
ShowHardLinkForm(SourceFileName, TargetFileName, TargetPath))
ShowHardLinkForm(Self, SourceFileName, TargetFileName, TargetPath))
then
TargetFileSource.Reload(TargetPath);
end

View file

@ -1,12 +1,8 @@
object frmSymLink: TfrmSymLink
Left = 318
Height = 193
Top = 251
Width = 602
HorzScrollBar.Page = 399
HorzScrollBar.Range = 344
VertScrollBar.Page = 151
VertScrollBar.Range = 128
Left = 320
Height = 177
Top = 320
Width = 512
ActiveControl = edtLinkToCreate
AutoSize = True
BorderIcons = [biSystemMenu]
@ -14,20 +10,20 @@ object frmSymLink: TfrmSymLink
Caption = 'Create symbolic link'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 193
ClientWidth = 602
ClientHeight = 177
ClientWidth = 512
KeyPreview = True
OnShow = FormShow
Position = poScreenCenter
Position = poOwnerFormCenter
LCLVersion = '1.8.4.0'
object lblExistingFile: TLabel
AnchorSideLeft.Control = edtExistingFile
AnchorSideTop.Control = edtLinkToCreate
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 62
Width = 222
Height = 16
Top = 59
Width = 240
BorderSpacing.Top = 6
Caption = '&Destination that the link will point to'
FocusControl = edtExistingFile
@ -37,9 +33,9 @@ object frmSymLink: TfrmSymLink
AnchorSideLeft.Control = edtLinkToCreate
AnchorSideTop.Control = Owner
Left = 6
Height = 18
Height = 16
Top = 6
Width = 64
Width = 69
Caption = '&Link name'
FocusControl = edtLinkToCreate
ParentColor = False
@ -50,9 +46,9 @@ object frmSymLink: TfrmSymLink
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 6
Height = 26
Top = 86
Width = 590
Height = 25
Top = 81
Width = 500
BorderSpacing.Top = 6
Constraints.MinWidth = 400
TabOrder = 1
@ -63,13 +59,26 @@ object frmSymLink: TfrmSymLink
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 6
Height = 26
Top = 30
Width = 590
Height = 25
Top = 28
Width = 500
BorderSpacing.Top = 6
Constraints.MinWidth = 400
TabOrder = 0
end
object chkUseRelativePath: TCheckBox
AnchorSideLeft.Control = edtExistingFile
AnchorSideTop.Control = edtExistingFile
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 6
Height = 24
Top = 118
Width = 219
BorderSpacing.Top = 6
Caption = 'Use &relative path when possible'
TabOrder = 2
end
object btnOK: TBitBtn
AnchorSideTop.Control = chkUseRelativePath
AnchorSideTop.Side = asrBottom
@ -111,17 +120,4 @@ object frmSymLink: TfrmSymLink
ModalResult = 2
TabOrder = 4
end
object chkUseRelativePath: TCheckBox
AnchorSideLeft.Control = edtExistingFile
AnchorSideTop.Control = edtExistingFile
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 6
Height = 24
Top = 118
Width = 219
BorderSpacing.Top = 6
Caption = 'Use &relative path when possible'
TabOrder = 2
end
end

View file

@ -28,7 +28,7 @@ type
CurrentPath: String); reintroduce;
end;
function ShowSymLinkForm(const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
function ShowSymLinkForm(TheOwner: TComponent; const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
implementation
@ -37,9 +37,9 @@ implementation
uses
LazFileUtils, uLng, uGlobs, uLog, uShowMsg, DCStrUtils, DCOSUtils, uAdministrator;
function ShowSymLinkForm(const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
function ShowSymLinkForm(TheOwner: TComponent; const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
begin
with TfrmSymLink.Create(Application, CurrentPath) do
with TfrmSymLink.Create(TheOwner, CurrentPath) do
begin
try
edtLinkToCreate.Text := sLinkToCreate;

View file

@ -3454,7 +3454,7 @@ begin
sLinkToCreate := sLinkToCreate + SelectedFiles[0].Name;
if ShowSymLinkForm(sExistingFile, sLinkToCreate, ActiveFrame.CurrentPath) then
if ShowSymLinkForm(frmMain, sExistingFile, sLinkToCreate, ActiveFrame.CurrentPath) then
begin
ActiveFrame.Reload;
if NotActiveFrame.FileSource.IsClass(TFileSystemFileSource) then
@ -3504,7 +3504,7 @@ begin
sLinkToCreate := sLinkToCreate + SelectedFiles[0].Name;
if ShowHardLinkForm(sExistingFile, sLinkToCreate, ActiveFrame.CurrentPath) then
if ShowHardLinkForm(frmMain, sExistingFile, sLinkToCreate, ActiveFrame.CurrentPath) then
begin
ActiveFrame.Reload;
if NotActiveFrame.FileSource.IsClass(TFileSystemFileSource) then