FIX: Bug [0000652] "Cant open folder in Search inside of 'Feed to list box'"

This commit is contained in:
Alexander Koblov 2013-04-24 18:38:06 +00:00
commit e663329655
3 changed files with 35 additions and 31 deletions

View file

@ -29,6 +29,8 @@ function ChooseArchive(aFileView: TFileView; aFile: TFile; bForce: Boolean = Fal
procedure ChooseSymbolicLink(aFileView: TFileView; aFile: TFile);
procedure SetFileSystemPath(aFileView: TFileView; aPath: UTF8String);
function RenameFile(aFileSource: IFileSource; const aFile: TFile;
const NewFileName: UTF8String; Interactive: Boolean): Boolean;
@ -267,6 +269,34 @@ begin
end;
end;
procedure SetFileSystemPath(aFileView: TFileView; aPath: UTF8String);
var
i: Integer;
begin
// Search for filesystem file source in this view, and remove others.
with aFileView do
begin
for i := FileSourcesCount - 1 downto 0 do
begin
// Search FileSource with same class name, we can not use "is"
// operator because it also works for descendant classes
if TFileSystemFileSource.ClassNameIs(FileSources[i].ClassName) then
begin
CurrentPath := aPath;
Break;
end
else
RemoveCurrentFileSource;
end;
if FileSourcesCount = 0 then
begin
// If not found, get a new filesystem file source.
AddFileSource(TFileSystemFileSource.GetFileSource, aPath);
end;
end;
end;
function RenameFile(aFileSource: IFileSource; const aFile: TFile;
const NewFileName: UTF8String; Interactive: Boolean): Boolean;
var
@ -317,4 +347,3 @@ begin
end;
end.

View file

@ -2554,7 +2554,11 @@ begin
if Assigned(aFile) and aFile.IsNameValid and
(aFile.IsDirectory or aFile.IsLinkToDirectory) then
begin
CurrentPath := CurrentPath + IncludeTrailingPathDelimiter(aFile.Name);
// Workaround for Search Result File Source
if FileSource is TSearchResultFileSource then
SetFileSystemPath(Self, aFile.FullPath)
else
CurrentPath := CurrentPath + IncludeTrailingPathDelimiter(aFile.Name);
end;
end;

View file

@ -564,7 +564,6 @@ type
procedure UpdateDriveButtonSelection(DriveButton: TSpeedButton; FileView: TFileView);
procedure UpdateSelectedDrive(ANoteBook: TFileViewNotebook);
procedure UpdateSelectedDrives;
procedure SetFileSystemPath(aFileView: TFileView; aPath: UTF8String);
procedure SetPanelDrive(aPanel: TFilePanelSelect; Drive: PDrive; ActivateIfNeeded: Boolean);
procedure OnDriveWatcherEvent(EventType: TDriveWatcherEvent; const ADrive: PDrive);
procedure AppActivate(Sender: TObject);
@ -5067,34 +5066,6 @@ begin
end;
end;
procedure TfrmMain.SetFileSystemPath(aFileView: TFileView; aPath: UTF8String);
var
i: Integer;
begin
// Search for filesystem file source in this view, and remove others.
with aFileView do
begin
for i := FileSourcesCount - 1 downto 0 do
begin
// Search FileSource with same class name, we can not use "is"
// operator because it also works for descendant classes
if TFileSystemFileSource.ClassNameIs(FileSources[i].ClassName) then
begin
CurrentPath := aPath;
Break;
end
else
RemoveCurrentFileSource;
end;
if FileSourcesCount = 0 then
begin
// If not found, get a new filesystem file source.
AddFileSource(TFileSystemFileSource.GetFileSource, aPath);
end;
end;
end;
procedure TfrmMain.SetPanelDrive(aPanel: TFilePanelSelect; Drive: PDrive; ActivateIfNeeded: Boolean);
var
aFileView, OtherFileView: TFileView;