Explorar el Código

Bug fix: Pasting files using local tree view context menu pastes them to the current directory, instead of the selected one

(cherry picked from commit 6fabd1828695e2f9b17a018c522b1f950914ff42)

# Conflicts:
#	source/packages/filemng/DriveView.pas

Source commit: d0746bfe0f76ebeab67b3dbba2545308cb00e45d
Martin Prikryl hace 2 días
padre
commit
d265ab3b62
Se han modificado 1 ficheros con 7 adiciones y 11 borrados
  1. 7 11
      source/packages/filemng/DriveView.pas

+ 7 - 11
source/packages/filemng/DriveView.pas

@@ -276,6 +276,8 @@ type
     function DragCompleteFileList: Boolean; override;
     function DDExecute: TDragResult; override;
 
+    procedure PasteFromClipBoard(Node: TTreeNode);
+
   public
     property Images;
     property StateImages;
@@ -293,7 +295,6 @@ type
     function CopyToClipBoard(Node: TTreeNode): Boolean; dynamic;
     function CutToClipBoard(Node: TTreeNode): Boolean; dynamic;
     function CanPasteFromClipBoard: Boolean; dynamic;
-    function PasteFromClipBoard(TargetPath: string = ''): Boolean; dynamic;
     procedure PerformDragDropFileOperation(Node: TTreeNode; Effect: Integer); override;
 
     {Drive handling:}
@@ -2935,7 +2936,7 @@ begin
   if Verb = shcCopy then LastClipBoardOperation := cboCopy
     else
   if Verb = shcPaste then
-    PasteFromClipBoard(NodePathName(Node));
+    PasteFromClipBoard(Node);
 
   DropTarget := nil;
 
@@ -3258,32 +3259,27 @@ begin
   end;
 end; {CanPasteFromClipBoard}
 
-function TDriveView.PasteFromClipBoard(TargetPath: String = ''): Boolean;
+procedure TDriveView.PasteFromClipBoard(Node: TTreeNode);
 begin
   ClearDragFileList(FDragDropFilesEx.FileList);
-  Result := False;
-  if CanPasteFromClipBoard and {MP}FDragDropFilesEx.GetFromClipBoard{/MP}
-    then
+  if CanPasteFromClipBoard and FDragDropFilesEx.GetFromClipBoard then
   begin
-    if TargetPath = '' then
-      TargetPath := NodePathName(Selected);
     case LastClipBoardOperation of
       cboCopy,
       cboNone:
         begin
-          PerformDragDropFileOperation(Selected, DROPEFFECT_COPY);
+          PerformDragDropFileOperation(Node, DROPEFFECT_COPY);
           if Assigned(FOnDDExecuted) then
             FOnDDExecuted(Self, DROPEFFECT_COPY);
         end;
       cboCut:
         begin
-          PerformDragDropFileOperation(Selected, DROPEFFECT_MOVE);
+          PerformDragDropFileOperation(Node, DROPEFFECT_MOVE);
           if Assigned(FOnDDExecuted) then
             FOnDDExecuted(Self, DROPEFFECT_MOVE);
           EmptyClipBoard;
         end;
     end;
-    Result := True;
   end;
 end; {PasteFromClipBoard}