mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: refactor GetFileName() from TiCloudFileSource to TMountedFileSource
This commit is contained in:
parent
345ea783dc
commit
19e82d61ce
2 changed files with 20 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, Generics.Collections,
|
||||
uFileSource, uFileSourceManager,
|
||||
uFile, uFileSource, uFileSourceManager,
|
||||
uFileSystemFileSource, uFileSystemMoveOperation,
|
||||
uFileSourceOperation, uFileSourceOperationTypes,
|
||||
uDCUtils, DCStrUtils;
|
||||
|
|
@ -27,10 +27,12 @@ type
|
|||
strict private
|
||||
_path: String;
|
||||
_point: String;
|
||||
_name: String;
|
||||
public
|
||||
constructor Create( const path: String; const point: String );
|
||||
property path: String read _path;
|
||||
property point: String read _point;
|
||||
property name: String read _name;
|
||||
end;
|
||||
|
||||
TMountPoints = specialize TList<TMountPoint>;
|
||||
|
|
@ -54,6 +56,7 @@ type
|
|||
function GetProcessor: TFileSourceProcessor; override;
|
||||
function GetRealPath(const APath: String): String; override;
|
||||
function GetVirtualPath(const APath: String): String; override;
|
||||
function GetFileName(aFile: TFile): String; override;
|
||||
|
||||
function GetParentDir(sPath : String): String; override;
|
||||
function GetRootDir(sPath : String): String; override;
|
||||
|
|
@ -88,6 +91,7 @@ constructor TMountPoint.Create(const path: String; const point: String);
|
|||
begin
|
||||
_path:= path;
|
||||
_point:= point;
|
||||
_name:= ExcludeLeadingPathDelimiter(ExcludeTrailingPathDelimiter( _point ));
|
||||
end;
|
||||
|
||||
{ TMountedFileSource }
|
||||
|
|
@ -181,6 +185,21 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TMountedFileSource.GetFileName(aFile: TFile): String;
|
||||
var
|
||||
mountPoint: TMountPoint;
|
||||
path: String;
|
||||
begin
|
||||
path:= IncludeTrailingPathDelimiter( aFile.FullPath );
|
||||
for mountPoint in _mountPoints do begin
|
||||
if path.Equals(mountPoint.path) then begin
|
||||
Result:= mountPoint.name;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
Result:= inherited;
|
||||
end;
|
||||
|
||||
function TMountedFileSource.GetParentDir(sPath : String): String;
|
||||
begin
|
||||
Result := DCStrUtils.GetParentDir(sPath);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ type
|
|||
function IsSystemFile(aFile: TFile): Boolean; override;
|
||||
function IsPathAtRoot(Path: String): Boolean; override;
|
||||
function GetDisplayFileName(aFile: TFile): String; override;
|
||||
function GetFileName(aFile: TFile): String; override;
|
||||
function QueryContextMenu(AFiles: TFiles; var AMenu: TPopupMenu): Boolean; override;
|
||||
end;
|
||||
|
||||
|
|
@ -352,11 +351,6 @@ begin
|
|||
Result:= getMacOSDisplayNameFromPath( aFile.FullPath );
|
||||
end;
|
||||
|
||||
function TiCloudDriverFileSource.GetFileName(aFile: TFile): String;
|
||||
begin
|
||||
Result:= self.GetDisplayFileName( aFile );
|
||||
end;
|
||||
|
||||
function TiCloudDriverFileSource.QueryContextMenu(AFiles: TFiles; var AMenu: TPopupMenu): Boolean;
|
||||
var
|
||||
menuItem: TMenuItem;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue