FIX: Open VFS list on the correct panel when there is only one drives toolbar.

This commit is contained in:
cobines 2012-04-05 07:45:00 +00:00
commit 4d9cd8d75d
2 changed files with 26 additions and 19 deletions

View file

@ -1646,8 +1646,20 @@ begin
end;
procedure TfrmMain.btnVirtualDriveClick(Sender: TObject);
var
Toolbar: TKASToolBar;
TargetPanel: TFileView;
begin
Commands.cm_OpenVirtualFileSystemList([((Sender as TSpeedButton).Parent as TKASToolBar).Name]);
if gDriveBar1 and gDriveBar2 then
begin
if (Sender as TSpeedButton).Parent = dskLeft then
TargetPanel := FrameLeft
else
TargetPanel := FrameRight;
end
else
TargetPanel := ActiveFrame;
Commands.DoOpenVirtualFileSystemList(TargetPanel);
end;
procedure TfrmMain.MainToolBarMouseUp(Sender: TObject; Button: TMouseButton;

View file

@ -59,6 +59,7 @@ type
// - arguments (instead of calling cm_... functions, in which case
// parameters would have to be converted to and from strings).
//
procedure DoOpenVirtualFileSystemList(Panel: TFileView);
procedure DoRemoveTab(Notebook: TFileViewNotebook; PageIndex: Integer);
procedure DoCopySelectedFileNamesToClipboard(FileView: TFileView; FullNames: Boolean);
procedure DoNewTab(Notebook: TFileViewNotebook);
@ -361,6 +362,17 @@ begin
NewPage.UpdateCaption(GetLastDir(ExcludeTrailingPathDelimiter(NewPage.FileView.CurrentPath)));
end;
procedure TMainCommands.DoOpenVirtualFileSystemList(Panel: TFileView);
var
FileSource: IFileSource;
begin
if (gWFXPlugins.Count = 0) and (gVfsModuleList.Count = 0) then
Exit;
FileSource:= TVfsFileSource.Create(gWFXPlugins);
if Assigned(FileSource) then
Panel.AddFileSource(FileSource, FileSource.GetRootDir);
end;
procedure TMainCommands.DoContextMenu(Panel: TFileView; X, Y: Integer; Background: Boolean);
var
aFile: TFile = nil;
@ -722,25 +734,8 @@ begin
end;
procedure TMainCommands.cm_OpenVirtualFileSystemList(const Params: array of string);
var
FileSource: IFileSource;
Param: String;
begin
Param := GetDefaultParam(Params);
with frmMain do
begin
if (gWFXPlugins.Count = 0) and (gVfsModuleList.Count = 0) then Exit;
FileSource:= TVfsFileSource.Create(gWFXPlugins);
if Assigned(FileSource) then
begin
if dskLeft.Name = Param then
FrameLeft.AddFileSource(FileSource, FileSource.GetRootDir)
else if dskRight.Name = Param then
FrameRight.AddFileSource(FileSource, FileSource.GetRootDir)
else
ActiveFrame.AddFileSource(FileSource, FileSource.GetRootDir)
end;
end;
DoOpenVirtualFileSystemList(frmMain.ActiveFrame);
end;
//------------------------------------------------------