Преглед изворни кода

Bug 1572: Failure when changing remote working directory using directory tree

https://winscp.net/tracker/1572

Source commit: 5731a8284955aea11750a49cb85f38ffb41ad578
Martin Prikryl пре 8 година
родитељ
комит
eedb27d652

+ 2 - 0
source/components/UnixDriveView.cpp

@@ -480,6 +480,7 @@ void __fastcall TCustomUnixDriveView::Change(TTreeNode * Node)
         }
 
         FDirectoryLoaded = false;
+        StartBusy();
         try
         {
           Terminal->ChangeDirectory(NodePathName(Node));
@@ -487,6 +488,7 @@ void __fastcall TCustomUnixDriveView::Change(TTreeNode * Node)
         }
         __finally
         {
+          EndBusy();
           if (!FDirectoryLoaded)
           {
             DebugAssert(!FIgnoreChange);

+ 1 - 0
source/components/UnixDriveView.h

@@ -194,6 +194,7 @@ __published:
   __property OnMouseUp;
   __property OnStartDock;
   __property OnStartDrag;
+  __property OnBusy;
 
 public:
   __fastcall TUnixDriveView(TComponent * Owner);

+ 1 - 0
source/forms/CustomScpExplorer.dfm

@@ -134,6 +134,7 @@ object CustomScpExplorerForm: TCustomScpExplorerForm
       ReadOnly = True
       TabOrder = 2
       OnEnter = RemoteDriveViewEnter
+      OnBusy = DirViewBusy
     end
   end
   object QueuePanel: TPanel

+ 26 - 0
source/packages/filemng/CustomDriveView.pas

@@ -60,6 +60,7 @@ type
     FOnDDEnd: TNotifyEvent;
     FOnDDCreateDataObject: TDDOnCreateDataObject;
     FLastDDResult: TDragResult;
+    FOnBusy: TDirViewBusy;
 
     function GetTargetPopupMenu: Boolean;
     procedure SetTargetPopUpMenu(Value: Boolean);
@@ -145,6 +146,10 @@ type
     procedure ScrollOnDragOverBeforeUpdate(ObjectToValidate: TObject);
     procedure ScrollOnDragOverAfterUpdate;
 
+    function DoBusy(Busy: Integer): Boolean;
+    function StartBusy: Boolean;
+    procedure EndBusy;
+
     property ImageList: TImageList read FImageList;
 
   public
@@ -202,6 +207,8 @@ type
       read FOnDDCreateDataObject write FOnDDCreateDataObject;
     property OnDDMenuPopup: TOnMenuPopup read FOnDDMenuPopup write FOnDDMenuPopup;
 
+    property OnBusy: TDirViewBusy read FOnBusy write FOnBusy;
+
     { Show popupmenu when dropping a file with the right mouse button }
     property TargetPopUpMenu: Boolean read GetTargetPopUpMenu write SetTargetPopUpMenu default True;
 
@@ -1222,4 +1229,23 @@ begin
     Selected := nil;
 end; {SetDirectory}
 
+function TCustomDriveView.DoBusy(Busy: Integer): Boolean;
+begin
+  Result := True;
+  if Assigned(OnBusy) then
+  begin
+    OnBusy(Self, Busy, Result);
+  end;
+end;
+
+function TCustomDriveView.StartBusy: Boolean;
+begin
+  Result := DoBusy(1);
+end;
+
+procedure TCustomDriveView.EndBusy;
+begin
+  DoBusy(-1);
+end;
+
 end.