FIX: Renaming/deletion a file in a smb:// location brings cursor to the top of file list (issue #350)

This commit is contained in:
Alexander Koblov 2022-02-15 21:47:41 +03:00
commit ed3de09bcc
2 changed files with 18 additions and 3 deletions

View file

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Dialogs, URIParser, SyncObjs,
uFileSourceProperty, uFileSourceOperationTypes,
uRealFileSource, uFileProperty, uFileSource,
uRealFileSource, uFileProperty, uFileSource, DCStrUtils,
uFileSourceOperation, uFile, uGLib2, uGObject2, uGio2;
type
@ -35,6 +35,7 @@ type
class function IsSupportedPath(const Path: String): Boolean; override;
function GetPathType(sPath : String): TPathType; override;
function CreateDirectory(const Path: String): Boolean; override;
function FileSystemEntryExists(const Path: String): Boolean; override;
function GetFreeSpace(Path: String; out FreeSize, TotalSize : Int64) : Boolean; override;
@ -78,7 +79,7 @@ uses
DCFileAttributes, DCDateTimeUtils, uGioListOperation, uGioCopyOperation,
uGioDeleteOperation, uGioExecuteOperation, uGioCreateDirectoryOperation,
uGioMoveOperation, uGioSetFilePropertyOperation, uDebug, fGioAuthDlg,
DCBasicTypes, DCStrUtils, uShowMsg, uGioCalcStatisticsOperation, uGio;
DCBasicTypes, uShowMsg, uGioCalcStatisticsOperation, uGio;
{ TGioFileSource }
@ -351,6 +352,14 @@ begin
end;
end;
function TGioFileSource.GetPathType(sPath: String): TPathType;
begin
if (Pos('://', sPath) > 0) then
Result:= ptAbsolute
else
Result:= inherited GetPathType(sPath);
end;
function TGioFileSource.CreateDirectory(const Path: String): Boolean;
var
AGFile: PGFile;

View file

@ -869,6 +869,7 @@ function TOrderedFileView.SetActiveFileNow(aFilePath: String;
end;
var
APath: String;
Index: PtrInt;
PathIsAbsolute: Boolean;
begin
@ -889,7 +890,12 @@ begin
end;
if (FLastActiveFileIndex > -1) then
begin
if FlatView or IsInPath(CurrentPath, LastActiveFile, False, False) then
if (StrBegins(LastActiveFile, CurrentAddress)) then
APath:= CurrentLocation
else begin
APath:= CurrentPath;
end;
if FlatView or IsInPath(APath, LastActiveFile, False, False) then
begin
if (PathIsAbsolute and mbCompareFileNames(LastActiveFile, aFilePath)) or
(FlatView) or (mbCompareFileNames(LastActiveFile, CurrentPath + aFilePath)) then