mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Operation options
This commit is contained in:
parent
6ce905e5aa
commit
698fc12a67
4 changed files with 176 additions and 1 deletions
65
src/filesources/gio/fgiocopymoveoperationoptions.lfm
Normal file
65
src/filesources/gio/fgiocopymoveoperationoptions.lfm
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
object GioCopyMoveOperationOptionsUI: TGioCopyMoveOperationOptionsUI
|
||||
Left = 453
|
||||
Height = 158
|
||||
Top = 166
|
||||
Width = 549
|
||||
AutoSize = True
|
||||
ClientHeight = 158
|
||||
ClientWidth = 549
|
||||
LCLVersion = '1.4.0.4'
|
||||
object pnlComboBoxes: TPanel
|
||||
AnchorSideLeft.Control = Owner
|
||||
Left = 0
|
||||
Height = 20
|
||||
Top = 0
|
||||
Width = 203
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ChildSizing.HorizontalSpacing = 5
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 20
|
||||
ClientWidth = 203
|
||||
TabOrder = 0
|
||||
object lblFileExists: TLabel
|
||||
Left = 0
|
||||
Height = 14
|
||||
Top = 3
|
||||
Width = 98
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'When file exists'
|
||||
FocusControl = cmbFileExists
|
||||
ParentColor = False
|
||||
end
|
||||
object cmbFileExists: TComboBox
|
||||
Left = 103
|
||||
Height = 20
|
||||
Top = 0
|
||||
Width = 100
|
||||
ItemHeight = 14
|
||||
Items.Strings = (
|
||||
'Ask'
|
||||
'Overwrite'
|
||||
'Skip'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object pnlCheckboxes: TPanel
|
||||
AnchorSideLeft.Control = pnlComboBoxes
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = pnlComboBoxes
|
||||
Left = 211
|
||||
Height = 0
|
||||
Top = 0
|
||||
Width = 0
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BevelOuter = bvNone
|
||||
BevelWidth = 8
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
99
src/filesources/gio/fgiocopymoveoperationoptions.pas
Normal file
99
src/filesources/gio/fgiocopymoveoperationoptions.pas
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
unit fGioCopyMoveOperationOptions;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, StdCtrls, ExtCtrls,
|
||||
uFileSourceOperationOptionsUI,
|
||||
uGioCopyOperation,
|
||||
uGioMoveOperation;
|
||||
|
||||
type
|
||||
|
||||
{ TGioCopyMoveOperationOptionsUI }
|
||||
|
||||
TGioCopyMoveOperationOptionsUI = class(TFileSourceOperationOptionsUI)
|
||||
cmbFileExists: TComboBox;
|
||||
grpOptions: TGroupBox;
|
||||
lblFileExists: TLabel;
|
||||
pnlCheckboxes: TPanel;
|
||||
pnlComboBoxes: TPanel;
|
||||
private
|
||||
procedure SetOperationOptions(CopyOperation: TGioCopyOperation); overload;
|
||||
procedure SetOperationOptions(MoveOperation: TGioMoveOperation); overload;
|
||||
public
|
||||
constructor Create(AOwner: TComponent; AFileSource: IInterface); override;
|
||||
procedure SaveOptions; override;
|
||||
procedure SetOperationOptions(Operation: TObject); override;
|
||||
end;
|
||||
|
||||
TGioCopyOperationOptionsUI = class(TGioCopyMoveOperationOptionsUI)
|
||||
end;
|
||||
|
||||
TGioMoveOperationOptionsUI = class(TGioCopyMoveOperationOptionsUI)
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
WfxPlugin, uGlobs, uWfxPluginFileSource, uFileSourceOperationOptions;
|
||||
|
||||
{ TGioCopyMoveOperationOptionsUI }
|
||||
|
||||
constructor TGioCopyMoveOperationOptionsUI.Create(AOwner: TComponent; AFileSource: IInterface);
|
||||
begin
|
||||
inherited Create(AOwner, AFileSource);
|
||||
|
||||
// Load default options.
|
||||
case gOperationOptionFileExists of
|
||||
fsoofeNone : cmbFileExists.ItemIndex := 0;
|
||||
fsoofeOverwrite: cmbFileExists.ItemIndex := 1;
|
||||
fsoofeSkip : cmbFileExists.ItemIndex := 2;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGioCopyMoveOperationOptionsUI.SaveOptions;
|
||||
begin
|
||||
// TODO: Saving options for each file source operation separately.
|
||||
end;
|
||||
|
||||
procedure TGioCopyMoveOperationOptionsUI.SetOperationOptions(Operation: TObject);
|
||||
begin
|
||||
if Operation is TGioCopyOperation then
|
||||
SetOperationOptions(Operation as TGioCopyOperation)
|
||||
else if Operation is TGioMoveOperation then
|
||||
SetOperationOptions(Operation as TGioMoveOperation);
|
||||
end;
|
||||
|
||||
procedure TGioCopyMoveOperationOptionsUI.SetOperationOptions(
|
||||
CopyOperation: TGioCopyOperation);
|
||||
begin
|
||||
with CopyOperation do
|
||||
begin
|
||||
case cmbFileExists.ItemIndex of
|
||||
0: FileExistsOption := fsoofeNone;
|
||||
1: FileExistsOption := fsoofeOverwrite;
|
||||
2: FileExistsOption := fsoofeSkip;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGioCopyMoveOperationOptionsUI.SetOperationOptions(
|
||||
MoveOperation: TGioMoveOperation);
|
||||
begin
|
||||
with MoveOperation do
|
||||
begin
|
||||
case cmbFileExists.ItemIndex of
|
||||
0: FileExistsOption := fsoofeNone;
|
||||
1: FileExistsOption := fsoofeOverwrite;
|
||||
2: FileExistsOption := fsoofeSkip;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -10,6 +10,7 @@ uses
|
|||
uFileSourceCopyOperation,
|
||||
uFileSource,
|
||||
uFileSourceOperationTypes,
|
||||
uFileSourceOperationOptionsUI,
|
||||
uFile,
|
||||
uGioFileSourceUtil;
|
||||
|
||||
|
|
@ -36,6 +37,8 @@ type
|
|||
procedure MainExecute; override;
|
||||
procedure Finalize; override;
|
||||
|
||||
class function GetOptionsUIClass: TFileSourceOperationOptionsUIClass; override;
|
||||
|
||||
end;
|
||||
|
||||
{
|
||||
|
|
@ -65,7 +68,7 @@ type
|
|||
implementation
|
||||
|
||||
uses
|
||||
uGio2, uGlobs;
|
||||
fGioCopyMoveOperationOptions, uGio2, uGlobs;
|
||||
|
||||
constructor TGioCopyOperation.Create(aSourceFileSource: IFileSource;
|
||||
aTargetFileSource: IFileSource;
|
||||
|
|
@ -129,6 +132,11 @@ begin
|
|||
FOperationHelper.Free;
|
||||
end;
|
||||
|
||||
class function TGioCopyOperation.GetOptionsUIClass: TFileSourceOperationOptionsUIClass;
|
||||
begin
|
||||
Result := TGioCopyOperationOptionsUI;
|
||||
end;
|
||||
|
||||
{ TGioCopyInOperation }
|
||||
|
||||
function TGioCopyInOperation.GetID: TFileSourceOperationType;
|
||||
|
|
|
|||
|
|
@ -265,6 +265,9 @@ constructor TGioFileSource.Create(const URI: TURI);
|
|||
begin
|
||||
inherited Create(URI);
|
||||
FOperationsClasses[fsoMove] := TGioMoveOperation.GetOperationClass;
|
||||
FOperationsClasses[fsoCopy] := TGioCopyOperation.GetOperationClass;
|
||||
FOperationsClasses[fsoCopyIn] := TGioCopyInOperation.GetOperationClass;
|
||||
FOperationsClasses[fsoCopyOut] := TGioCopyOutOperation.GetOperationClass;
|
||||
end;
|
||||
|
||||
class function TGioFileSource.IsSupportedPath(const Path: String): Boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue