forked from doublecmd/doublecmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathufilesourcelistoperation.pas
103 lines (75 loc) · 2.05 KB
/
ufilesourcelistoperation.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
unit uFileSourceListOperation;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
uFileSourceOperation,
uFileSourceOperationTypes,
uFile,
uFileSource;
type
{ TFileSourceListOperation }
TFileSourceListOperation = class(TFileSourceOperation)
private
FFileSource: IFileSource;
FPath: String;
protected
FFiles: TFiles;
FFlatView: Boolean;
function GetFiles: TFiles;
function GetID: TFileSourceOperationType; override;
procedure UpdateStatisticsAtStartTime; override;
property FileSource: IFileSource read FFileSource;
public
constructor Create(aFileSource: IFileSource; aPath: String); virtual reintroduce;
destructor Destroy; override;
function GetDescription(Details: TFileSourceOperationDescriptionDetails): String; override;
// Retrieves files and revokes ownership of TFiles list.
// The result of this function should be freed by the caller.
function ReleaseFiles: TFiles;
property Files: TFiles read GetFiles;
property Path: String read FPath;
property FlatView: Boolean write FFlatView;
end;
implementation
uses
uLng;
constructor TFileSourceListOperation.Create(aFileSource: IFileSource; aPath: String);
begin
FFileSource := aFileSource;
FPath := aPath;
inherited Create(FFileSource);
end;
destructor TFileSourceListOperation.Destroy;
begin
inherited Destroy;
if Assigned(FFiles) then
FreeAndNil(FFiles);
end;
function TFileSourceListOperation.GetDescription(Details: TFileSourceOperationDescriptionDetails): String;
begin
case Details of
fsoddJobAndTarget:
Result := Format(rsOperListingIn, [Path]);
else
Result := rsOperListing;
end;
end;
function TFileSourceListOperation.GetID: TFileSourceOperationType;
begin
Result := fsoList;
end;
function TFileSourceListOperation.GetFiles: TFiles;
begin
Result := FFiles;
end;
function TFileSourceListOperation.ReleaseFiles: TFiles;
begin
Result := FFiles;
FFiles := nil; // revoke ownership
end;
procedure TFileSourceListOperation.UpdateStatisticsAtStartTime;
begin
// Empty.
end;
end.