Просмотр исходного кода

It is always possible to use drag & drop to move remote files to external applications, while copy is always the default operation

Source commit: 6be4c3b07723840de740608beb2aab3e4a7fe349
Martin Prikryl 7 лет назад
Родитель
Сommit
a862d8a47d

+ 2 - 15
source/components/UnixDirView.cpp

@@ -48,11 +48,11 @@ __fastcall TUnixDirView::TUnixDirView(TComponent* Owner)
   FTerminal = NULL;
 #endif
   FCaseSensitive = true;
-  DDAllowMove = false;
   FShowInaccesibleDirectories = true;
   FFullLoad = false;
   FDriveView = NULL;
   FInvalidNameChars = L"/";
+  DragDropFilesEx->PreferCopy = true;
 }
 //---------------------------------------------------------------------------
 __fastcall TUnixDirView::~TUnixDirView()
@@ -799,22 +799,9 @@ void __fastcall TUnixDirView::DDChooseEffect(int grfKeyState, int &dwEffect)
   TCustomDirView::DDChooseEffect(grfKeyState, dwEffect);
 }
 //---------------------------------------------------------------------------
-void __fastcall TUnixDirView::SetDDAllowMove(bool value)
-{
-  if (DDAllowMove != value)
-  {
-    DebugAssert(DragDropFilesEx);
-    FDDAllowMove = value;
-    DragDropFilesEx->SourceEffects = DragSourceEffects;
-  }
-}
-//---------------------------------------------------------------------------
 TDropEffectSet __fastcall TUnixDirView::GetDragSourceEffects()
 {
-  TDropEffectSet Result;
-  Result << deCopy;
-  if (DDAllowMove) Result << deMove;
-  return Result;
+  return TDropEffectSet() << deCopy << deMove;
 }
 //---------------------------------------------------------------------------
 void __fastcall TUnixDirView::ChangeDirectory(UnicodeString Path)

+ 0 - 5
source/components/UnixDirView.h

@@ -23,7 +23,6 @@ class PACKAGE TUnixDirView : public TCustomUnixDirView
 {
 friend class TCustomUnixDriveView;
 private:
-  bool FDDAllowMove;
   bool FDirLoadedAfterChangeDir;
   TNotifyEvent FOnDisplayProperties;
   bool FFullLoad;
@@ -35,7 +34,6 @@ private:
   bool __fastcall GetActive();
   TCustomUnixDriveView * FDriveView;
   TNotifyEvent FOnRead;
-  void __fastcall SetDDAllowMove(bool value);
   void __fastcall SetTerminal(TTerminal *value);
   void __fastcall DoSetTerminal(TTerminal *value, bool Replace);
   void __fastcall SetShowInaccesibleDirectories(bool value);
@@ -104,8 +102,6 @@ public:
   __property bool Active = { read = GetActive };
   __property TTerminal *Terminal = { read = FTerminal, write = SetTerminal };
 __published:
-  __property bool DDAllowMove = { read = FDDAllowMove,
-    write = SetDDAllowMove, default = False };
   __property TDDDragFileName OnDDDragFileName = { read = FOnDDDragFileName,
     write = FOnDDDragFileName};
   __property OnBusy;
@@ -144,7 +140,6 @@ __published:
   __property OnDDFileOperation;
   __property OnDDFileOperationExecuted;
   __property OnDDCreateDataObject;
-  __property OnDDMenuPopup;
 
   __property OnContextPopup;
   __property OnHistoryChange;

+ 2 - 8
source/components/UnixDriveView.cpp

@@ -47,10 +47,10 @@ __fastcall TCustomUnixDriveView::TCustomUnixDriveView(TComponent* Owner) :
   FRootName = Customunixdirview_SUnixDefaultRootName;
   FIgnoreChange = false;
   FPrevSelected = NULL;
-  DDAllowMove = false;
   FShowInaccesibleDirectories = true;
   FDummyDragFile = NULL;
   FPendingDelete = new TList();
+  FDragDropFilesEx->PreferCopy = true;
 }
 //---------------------------------------------------------------------------
 __fastcall TCustomUnixDriveView::~TCustomUnixDriveView()
@@ -624,13 +624,7 @@ bool __fastcall TCustomUnixDriveView::DragCompleteFileList()
 //---------------------------------------------------------------------------
 TDropEffectSet __fastcall TCustomUnixDriveView::DDSourceEffects()
 {
-  TDropEffectSet Result;
-  Result << deCopy;
-  if (DDAllowMove)
-  {
-    Result << deMove;
-  }
-  return Result;
+  return TDropEffectSet() << deCopy << deMove;
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TCustomUnixDriveView::NodePathName(TTreeNode * Node)

+ 0 - 3
source/components/UnixDriveView.h

@@ -24,7 +24,6 @@ public:
 
   __property TUnixDirView * DirView = { read = FDirView, write = SetDirView };
   __property UnicodeString RootName = { read = FRootName, write = FRootName, stored = IsRootNameStored };
-  __property bool DDAllowMove = { read = FDDAllowMove, write = FDDAllowMove, default = False };
   __property TDDDragFileName OnDDDragFileName = { read = FOnDDDragFileName, write = FOnDDDragFileName};
   __property bool ShowInaccesibleDirectories = { read=FShowInaccesibleDirectories, write=SetShowInaccesibleDirectories, default=true  };
 
@@ -91,7 +90,6 @@ private:
   bool FDirectoryLoaded;
   bool FIgnoreChange;
   TTreeNode * FPrevSelected;
-  bool FDDAllowMove;
   TDDDragFileName FOnDDDragFileName;
   bool FShowInaccesibleDirectories;
   TRemoteFile * FDummyDragFile;
@@ -126,7 +124,6 @@ __published:
   __property OnDDExecuted;
   __property OnDDFileOperation;
   __property OnDDFileOperationExecuted;
-  __property OnDDMenuPopup;
   __property OnDDCreateDragFileList;
   __property OnDDCreateDataObject;
 

+ 3 - 52
source/forms/CustomScpExplorer.cpp

@@ -196,7 +196,6 @@ __fastcall TCustomScpExplorerForm::TCustomScpExplorerForm(TComponent* Owner):
   FProgressForm = NULL;
   FRefreshLocalDirectory = false;
   FRefreshRemoteDirectory = false;
-  FDDMoveSlipped = false;
   FDDExtMapFile = NULL;
   // CreateMutexW keeps failing with ERROR_NOACCESS
   FDDExtMutex = CreateMutexA(NULL, false, AnsiString(DRAG_EXT_MUTEX).c_str());
@@ -999,7 +998,6 @@ void __fastcall TCustomScpExplorerForm::UpdateSessionsPageControlHeight()
 void __fastcall TCustomScpExplorerForm::ConfigurationChanged()
 {
   DebugAssert(Configuration && RemoteDirView);
-  RemoteDirView->DDAllowMove = WinConfiguration->DDAllowMoveInit;
   RemoteDirView->DimmHiddenFiles = WinConfiguration->DimmHiddenFiles;
   RemoteDirView->ShowHiddenFiles = WinConfiguration->ShowHiddenFiles;
   RemoteDirView->FormatSizeBytes = WinConfiguration->FormatSizeBytes;
@@ -1013,7 +1011,6 @@ void __fastcall TCustomScpExplorerForm::ConfigurationChanged()
     RemoteDirView->Invalidate();
   }
 
-  RemoteDriveView->DDAllowMove = WinConfiguration->DDAllowMoveInit;
   RemoteDriveView->DimmHiddenDirs = WinConfiguration->DimmHiddenFiles;
   RemoteDriveView->ShowHiddenDirs = WinConfiguration->ShowHiddenFiles;
   RemoteDriveView->ShowInaccesibleDirectories = WinConfiguration->ShowInaccesibleDirectories;
@@ -1090,22 +1087,6 @@ bool __fastcall TCustomScpExplorerForm::CopyParamDialog(
 {
   bool Result = true;
   DebugAssert(Terminal && Terminal->Active);
-  // Temp means d&d here so far, may change in future!
-  if (Temp && (Direction == tdToLocal) && (Type == ttMove) &&
-      !WinConfiguration->DDAllowMove)
-  {
-    TMessageParams Params(mpNeverAskAgainCheck);
-    unsigned int Answer = MessageDialog(LoadStr(DND_DOWNLOAD_MOVE_WARNING), qtWarning,
-      qaOK | qaCancel, HELP_DND_DOWNLOAD_MOVE_WARNING, &Params);
-    if (Answer == qaNeverAskAgain)
-    {
-      WinConfiguration->DDAllowMove = true;
-    }
-    else if (Answer == qaCancel)
-    {
-      Result = false;
-    }
-  }
 
   // these parameters are known in advance
   int Params =
@@ -7073,7 +7054,6 @@ void __fastcall TCustomScpExplorerForm::DDFakeFileInitDrag(TFileList * FileList,
     UnmapViewOfFile(CommStruct);
   }
 
-  FDDMoveSlipped = false;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TCustomScpExplorerForm::RemoteFileControlFileOperation(
@@ -7162,11 +7142,6 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
             break;
         }
 
-        if (FDDMoveSlipped)
-        {
-          Operation = foMove;
-        }
-
         TTransferOperationParam Param;
         UnicodeString CounterName;
         bool ForceQueue;
@@ -7226,22 +7201,8 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::RemoteFileControlDDGiveFeedback(
-  TObject * Sender, int dwEffect, HRESULT & /*Result*/)
+  TObject * /*Sender*/, int dwEffect, HRESULT & /*Result*/)
 {
-  HCURSOR SlippedCopyCursor;
-
-  FDDMoveSlipped =
-    (FDragMoveCursor != NULL) &&
-    (!WinConfiguration->DDAllowMoveInit) && (dwEffect == DROPEFFECT_Copy) &&
-    ((IsFileControl(FDDTargetControl, osRemote) && (GetKeyState(VK_CONTROL) >= 0) &&
-      FTerminal->IsCapable[fcRemoteMove]) ||
-     (IsFileControl(FDDTargetControl, osLocal) && (GetKeyState(VK_SHIFT) < 0)));
-
-  SlippedCopyCursor = FDDMoveSlipped ? FDragMoveCursor : Dragdrop::DefaultCursor;
-
-  DragDropFiles(Sender)->CHCopy = SlippedCopyCursor;
-  DragDropFiles(Sender)->CHScrollCopy = SlippedCopyCursor;
-
   // Remember drop effect so we know (when user drops files), if we copy or move
   FLastDropEffect = dwEffect;
 }
@@ -7379,11 +7340,7 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDTargetDrop()
     }
     else
     {
-      // when move from remote side is disabled, we allow copying inside the remote
-      // panel, but we interpret is as moving (we also slip in the move cursor)
-      if ((FLastDropEffect == DROPEFFECT_MOVE) ||
-          (!WinConfiguration->DDAllowMoveInit && (FLastDropEffect == DROPEFFECT_COPY) &&
-           FDDMoveSlipped))
+      if (FLastDropEffect == DROPEFFECT_MOVE)
       {
         Operation = foRemoteMove;
       }
@@ -7482,7 +7439,7 @@ class TFakeDataObjectFilesEx : public TDataObjectFilesEx
 {
 public:
         __fastcall TFakeDataObjectFilesEx(TFileList * AFileList, bool RenderPIDL,
-    bool RenderFilename) : TDataObjectFilesEx(AFileList, RenderPIDL, RenderFilename)
+    bool RenderFilename) : TDataObjectFilesEx(AFileList, RenderPIDL, RenderFilename, true)
   {
   }
 
@@ -7902,12 +7859,6 @@ void __fastcall TCustomScpExplorerForm::RemoteFileContolDDChooseEffect(
         {
           dwEffect = DROPEFFECT_None;
         }
-        // when moving is disabled, we need to keep effect to "copy",
-        // which will be later interpretted as move (with slipped-in cursor)
-        else if (!WinConfiguration->DDAllowMoveInit && FLAGCLEAR(grfKeyState, MK_CONTROL))
-        {
-          // no-op, keep copy
-        }
         else
         {
           // The default effect inside remote panel is move,

+ 0 - 1
source/forms/CustomScpExplorer.h

@@ -320,7 +320,6 @@ protected:
   TProgressForm * FProgressForm;
   TSynchronizeProgressForm * FSynchronizeProgressForm;
   HANDLE FDDExtMapFile;
-  bool FDDMoveSlipped;
   TTimer * FUserActionTimer;
   TQueueItemProxy * FPendingQueueActionItem;
   TTBXPopupMenu * FHistoryMenu[2][2];

+ 0 - 5
source/forms/Preferences.cpp

@@ -262,7 +262,6 @@ void __fastcall TPreferencesDialog::LoadConfiguration()
     BOOLPROP(ConfirmCommandSession);
     BOOLPROP(ContinueOnError);
     BOOLPROP(SynchronizeSummary);
-    BOOLPROP(DDAllowMoveInit);
     BOOLPROP(BeepOnFinish);
     BOOLPROP(TemporaryDirectoryAppendSession);
     BOOLPROP(TemporaryDirectoryAppendPath);
@@ -289,7 +288,6 @@ void __fastcall TPreferencesDialog::LoadConfiguration()
 
     DDFakeFileEnabledButton->Checked = WinConfiguration->DDFakeFile;
     DDFakeFileDisabledButton->Checked = !DDFakeFileEnabledButton->Checked;
-    DDWarnOnMoveCheck->Checked = !WinConfiguration->DDAllowMove;
 
     if (WinConfiguration->DDTemporaryDirectory.IsEmpty())
     {
@@ -646,7 +644,6 @@ void __fastcall TPreferencesDialog::SaveConfiguration()
     BOOLPROP(ConfirmCommandSession);
     BOOLPROP(ContinueOnError);
     BOOLPROP(SynchronizeSummary);
-    BOOLPROP(DDAllowMoveInit);
     BOOLPROP(BeepOnFinish);
     BOOLPROP(TemporaryDirectoryAppendSession);
     BOOLPROP(TemporaryDirectoryAppendPath);
@@ -665,7 +662,6 @@ void __fastcall TPreferencesDialog::SaveConfiguration()
       static_cast<double>(BeepOnFinishAfterEdit->Value / SecsPerDay);
     BOOLPROP(BalloonNotifications);
 
-    WinConfiguration->DDAllowMove = !DDWarnOnMoveCheck->Checked;
     WinConfiguration->DDFakeFile = DDFakeFileEnabledButton->Checked;
 
     if (DDSystemTemporaryDirectoryButton->Checked)
@@ -1239,7 +1235,6 @@ void __fastcall TPreferencesDialog::UpdateControls()
     EnableControl(DDFakeFileDisabledPanel, DDFakeFileDisabledButton->Checked);
     EnableControl(DDTemporaryDirectoryEdit, DDCustomTemporaryDirectoryButton->Enabled &&
       DDCustomTemporaryDirectoryButton->Checked);
-    EnableControl(DDWarnOnMoveCheck, DDFakeFileDisabledButton->Checked && DDAllowMoveInitCheck->Checked);
     EnableControl(ConfirmTemporaryDirectoryCleanupCheck,
       TemporaryDirectoryCleanupCheck->Checked);
     // allow only when some of the known storages is selected,

+ 12 - 32
source/forms/Preferences.dfm

@@ -1313,16 +1313,16 @@ object PreferencesDialog: TPreferencesDialog
           Left = 8
           Top = 8
           Width = 389
-          Height = 277
+          Height = 230
           Anchors = [akLeft, akTop, akRight]
           Caption = 'Drag && Drop downloads'
           TabOrder = 0
           DesignSize = (
             389
-            277)
+            230)
           object DDFakeFileEnabledLabel: TLabel
             Left = 35
-            Top = 68
+            Top = 44
             Width = 345
             Height = 53
             Anchors = [akLeft, akTop, akRight]
@@ -1337,7 +1337,7 @@ object PreferencesDialog: TPreferencesDialog
           end
           object DDFakeFileDisabledLabel: TLabel
             Left = 35
-            Top = 165
+            Top = 141
             Width = 346
             Height = 54
             Anchors = [akLeft, akTop, akRight]
@@ -1351,7 +1351,7 @@ object PreferencesDialog: TPreferencesDialog
           end
           object DragExtStatusLabel: TLabel
             Left = 35
-            Top = 120
+            Top = 96
             Width = 345
             Height = 26
             Anchors = [akLeft, akTop, akRight]
@@ -1362,17 +1362,17 @@ object PreferencesDialog: TPreferencesDialog
           end
           object DDFakeFileEnabledButton: TRadioButton
             Left = 16
-            Top = 48
+            Top = 24
             Width = 364
             Height = 17
             Anchors = [akLeft, akTop, akRight]
             Caption = 'Determine drop target by dragging a &fake file'
-            TabOrder = 1
+            TabOrder = 0
             OnClick = ControlChange
           end
           object DDFakeFileDisabledButton: TRadioButton
             Left = 16
-            Top = 145
+            Top = 121
             Width = 356
             Height = 17
             Anchors = [akLeft, akTop, akRight]
@@ -1382,14 +1382,14 @@ object PreferencesDialog: TPreferencesDialog
           end
           object DDFakeFileDisabledPanel: TPanel
             Left = 34
-            Top = 216
+            Top = 192
             Width = 315
-            Height = 51
+            Height = 28
             BevelOuter = bvNone
-            TabOrder = 3
+            TabOrder = 1
             DesignSize = (
               315
-              51)
+              28)
             object DDWarnLackOfTempSpaceCheck: TCheckBox
               Left = 0
               Top = 5
@@ -1400,26 +1400,6 @@ object PreferencesDialog: TPreferencesDialog
               TabOrder = 0
               OnClick = ControlChange
             end
-            object DDWarnOnMoveCheck: TCheckBox
-              Left = 0
-              Top = 28
-              Width = 315
-              Height = 17
-              Anchors = [akLeft, akTop, akRight]
-              Caption = 'Warn when mo&ving via temporary directory'
-              TabOrder = 1
-              OnClick = ControlChange
-            end
-          end
-          object DDAllowMoveInitCheck: TCheckBox
-            Left = 16
-            Top = 24
-            Width = 364
-            Height = 17
-            Anchors = [akLeft, akTop, akRight]
-            Caption = 'Allow &moving from remote directory to other applications'
-            TabOrder = 0
-            OnClick = ControlChange
           end
         end
       end

+ 0 - 2
source/forms/Preferences.h

@@ -89,7 +89,6 @@ __published:
   TRadioButton *DDFakeFileDisabledButton;
   TPanel *DDFakeFileDisabledPanel;
   TCheckBox *DDWarnLackOfTempSpaceCheck;
-  TCheckBox *DDWarnOnMoveCheck;
   TCheckBox *ConfirmExitOnCompletionCheck;
   TTabSheet *QueueSheet;
   TGroupBox *QueueGroup;
@@ -101,7 +100,6 @@ __published:
   TRadioButton *QueueViewHideButton;
   TCheckBox *QueueAutoPopupCheck;
   TCheckBox *QueueCheck;
-  TCheckBox *DDAllowMoveInitCheck;
   TCheckBox *ConfirmResumeCheck;
   TTabSheet *StorageSheet;
   TGroupBox *StorageGroup;

+ 0 - 51
source/forms/ScpCommander.cpp

@@ -1437,20 +1437,6 @@ void __fastcall TScpCommanderForm::LocalDirViewDDTargetHasDropHandler(
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TScpCommanderForm::LocalFileControlDDDragOver(TObject * /*Sender*/,
-  int grfKeyState, TPoint & /*Point*/, int & dwEffect)
-{
-  if (IsFileControl(DropSourceControl, osRemote))
-  {
-    if (((grfKeyState & (MK_CONTROL | MK_SHIFT)) == 0) ||
-        (((grfKeyState & (MK_CONTROL | MK_SHIFT)) == MK_SHIFT) &&
-          !WinConfiguration->DDAllowMoveInit))
-    {
-      dwEffect = DROPEFFECT_Copy;
-    }
-  }
-}
-//---------------------------------------------------------------------------
 bool __fastcall TScpCommanderForm::DDGetTarget(
   UnicodeString & Directory, bool & ForceQueue, UnicodeString & CounterName)
 {
@@ -1497,10 +1483,6 @@ void __fastcall TScpCommanderForm::LocalFileControlDDFileOperation(
         DebugAssert(dwEffect == DROPEFFECT_Copy || dwEffect == DROPEFFECT_Move);
         TGUICopyParamType CopyParams = GUIConfiguration->CurrentCopyParam;
         TTransferType TransferType = dwEffect == DROPEFFECT_Copy ? ttCopy : ttMove;
-        if (FDDMoveSlipped)
-        {
-          TransferType = ttMove;
-        }
         int Options =
           FLAGMASK(DraggingAllFilesFromDirView(osRemote, FInternalDDDownloadList), coAllFiles);
         if (CopyParamDialog(tdToLocal, TransferType,
@@ -1712,39 +1694,6 @@ void __fastcall TScpCommanderForm::Resize()
   UpdateControls();
 }
 //---------------------------------------------------------------------------
-void __fastcall TScpCommanderForm::LocalFileControlDDMenuPopup(TObject * /*Sender*/,
-  HMENU AMenu, IDataObject * /*DataObj*/, int /*AMinCustCmd*/, int /*grfKeyState*/,
-  TPoint & /*pt*/)
-{
-  if (IsFileControl(DropSourceControl, osRemote) &&
-      !WinConfiguration->DDAllowMoveInit)
-  {
-    // index of copy item
-    int Index = GetMenuDefaultItem(AMenu, TRUE, 0);
-    DebugAssert(Index >= 0);
-
-    UnicodeString Caption = Dragdrop_MIMoveStr;
-
-    MENUITEMINFO MI;
-    memset(&MI, 0, sizeof(MI));
-    MI.cbSize = sizeof(MI);
-    MI.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
-    MI.fType = MFT_STRING;
-    MI.wID = 1 /*DragDrop::CmdMove*/;
-    MI.dwTypeData = Caption.c_str();
-    MI.cch = Caption.Length();
-    MI.fState = MFS_ENABLED;
-    InsertMenuItem(AMenu, Index, TRUE, &MI);
-
-    if (FDDMoveSlipped)
-    {
-      SetMenuDefaultItem(AMenu, Index, TRUE);
-    }
-
-    FDDMoveSlipped = false;
-  }
-}
-//---------------------------------------------------------------------------
 void __fastcall TScpCommanderForm::PathLabelDblClick(TObject * Sender)
 {
   OpenDirectory(Sender == LocalPathLabel ? osLocal : osRemote);

+ 0 - 4
source/forms/ScpCommander.dfm

@@ -1437,10 +1437,8 @@ inherited ScpCommanderForm: TScpCommanderForm
       OnLoaded = DirViewLoaded
       OnDDDragEnter = LocalFileControlDDDragEnter
       OnDDDragLeave = FileControlDDDragLeave
-      OnDDDragOver = LocalFileControlDDDragOver
       OnDDTargetHasDropHandler = LocalDirViewDDTargetHasDropHandler
       OnDDFileOperation = LocalFileControlDDFileOperation
-      OnDDMenuPopup = LocalFileControlDDMenuPopup
       OnExecFile = LocalDirViewExecFile
       OnMatchMask = DirViewMatchMask
       OnGetOverlay = DirViewGetOverlay
@@ -1641,9 +1639,7 @@ inherited ScpCommanderForm: TScpCommanderForm
       OnBusy = DirViewBusy
       OnDDDragEnter = LocalFileControlDDDragEnter
       OnDDDragLeave = FileControlDDDragLeave
-      OnDDDragOver = LocalFileControlDDDragOver
       OnDDFileOperation = LocalFileControlDDFileOperation
-      OnDDMenuPopup = LocalFileControlDDMenuPopup
       Align = alTop
       Constraints.MinHeight = 30
       DoubleBuffered = True

+ 0 - 4
source/forms/ScpCommander.h

@@ -437,8 +437,6 @@ __published:
   void __fastcall LocalFileControlDDDragEnter(TObject *Sender,
     IDataObject *DataObj, int grfKeyState, TPoint &Point,
     int &dwEffect, bool &Accept);
-  void __fastcall LocalFileControlDDDragOver(TObject *Sender, int grfKeyState,
-    TPoint &Point, int &dwEffect);
   void __fastcall LocalFileControlDDFileOperation(TObject *Sender,
     int dwEffect, UnicodeString SourcePath, UnicodeString TargetPath,
     bool &DoOperation);
@@ -446,8 +444,6 @@ __published:
     int dwEffect, UnicodeString SourcePath, UnicodeString TargetPath);
   void __fastcall LocalDirViewDDTargetHasDropHandler(TObject *Sender,
     TListItem *Item, int &Effect, bool &DropHandler);
-  void __fastcall LocalFileControlDDMenuPopup(TObject *Sender, HMENU AMenu,
-    IDataObject *DataObj, int AMinCustCmd, int grfKeyState, TPoint &pt);
   void __fastcall PathLabelDblClick(TObject *Sender);
   void __fastcall LocalDirViewEnter(TObject *Sender);
   void __fastcall LocalPathLabelGetStatus(TCustomPathLabel *Sender,

+ 39 - 3
source/packages/dragndrop/DragDropFilesEx.pas

@@ -107,8 +107,9 @@ type
      FilenameMapList:TStringList;
      FilenamesAreMapped:boolean;
      FOnRelease: TNotifyEvent;
+     FPreferCopy: Boolean;
   public
-     constructor Create(AFileList:TFileList; RenderPIDL, RenderFilename: boolean);
+     constructor Create(AFileList:TFileList; RenderPIDL, RenderFilename, PreferCopy: boolean);
      destructor Destroy; override;
      function RenderData(FormatEtc:TFormatEtc;
         var StgMedium: TStgMedium):HResult; override;
@@ -149,6 +150,7 @@ type
      FShellExtension:TShellExtension;
      FCMList:TList;
      FOnDataObjectRelease: TNotifyEvent;
+     FPreferCopy: Boolean;
   protected
      function CreateDataObject:TDataObject; override;
      procedure DataObjectRelease(Sender: TObject);
@@ -166,6 +168,7 @@ type
         var dwEffect: longint): boolean;
      property FileList: TFileList read FFileList write FFileList;
      property FileNamesAreMapped: boolean read FFileNamesAreMapped;
+     property PreferCopy: Boolean read FPreferCopy write FPreferCopy;
   published
      property NeedValid: TFileExMustDnDSet read FNeedValid write FNeedValid;
      property CompleteFileList: boolean read FCompleteFileList
@@ -451,7 +454,7 @@ end;
 
 // TDataObjectFilesEx -------------------------------------------------------------
 
-constructor TDataObjectFilesEx.Create(AFileList: TFileList; RenderPIDL, RenderFilename: Boolean);
+constructor TDataObjectFilesEx.Create(AFileList: TFileList; RenderPIDL, RenderFilename, PreferCopy: Boolean);
 var
   i: DWORD;
   FE: TFormatEtc;
@@ -563,6 +566,19 @@ begin
                 SetData(FE,SM,false);
           end;
      end;
+     FPreferCopy := PreferCopy;
+     if PreferCopy then
+     begin
+          with FE do
+          begin
+               cfFormat := CF_PREFERREDDROPEFFECT;
+               ptd := nil;
+               dwAspect := DVASPECT_CONTENT;
+               lindex := -1;
+               tymed := TYMED_HGLOBAL;
+          end;
+          SetData(FE, SM, False);
+     end;
 end;
 
 destructor TDataObjectFilesEx.Destroy;
@@ -666,6 +682,25 @@ begin
           end;
           result:=S_OK;
      end;
+     if (FormatEtc.cfFormat = CF_PREFERREDDROPEFFECT) and FPreferCopy then
+     begin
+          h := GlobalAlloc(GHND or GMEM_SHARE, SizeOf(DWORD));
+          if h = 0 then
+          begin
+               Result := E_OUTOFMEMORY;
+               Exit;
+          end;
+          p := GlobalLock(h);
+          PDWORD(p)^ := DROPEFFECT_COPY;
+          GlobalUnlock(h);
+          with StgMedium do
+          begin
+               tymed := TYMED_HGLOBAL;
+               hGlobal := h;
+               unkForRelease := nil;
+          end;
+          Result := S_OK;
+     end;
 end;
 
 function TDataObjectFilesEx.IsValid(Formatpidl, FormatHDrop:boolean):boolean;
@@ -842,6 +877,7 @@ begin
      FFileNamesAreMapped:=false;
      FCMList:=TList.Create;
      FShellExtension:=TShellExtension.Create;
+     FPreferCopy := False;
 end;
 
 destructor TDragDropFilesEx.Destroy;
@@ -876,7 +912,7 @@ begin
      end;
      if FFileList.Count>0 then
      begin
-          DataObject:=TDataObjectFilesEx.Create(FFileList, RPidl, RFname);
+          DataObject:=TDataObjectFilesEx.Create(FFileList, RPidl, RFname, FPreferCopy);
           DataObject.OnRelease := DataObjectRelease;
           if DataObject.IsValid((nvPIDL in FNeedValid),
              (nvFilename in FNeedValid))=false then DataObject._Release

+ 2 - 0
source/packages/dragndrop/PIDL.pas

@@ -54,6 +54,7 @@ var
   CF_FILENAMEMAP: UINT;
   CF_FILENAMEMAPW: UINT;
   CF_SHELLIDLIST: UINT;
+  CF_PREFERREDDROPEFFECT: UINT;
 
 implementation
 
@@ -302,6 +303,7 @@ initialization
   CF_FILENAMEMAP := RegisterClipboardFormat('FileNameMap');
   CF_FILENAMEMAPW := RegisterClipboardFormat('FileNameMapW');
   CF_SHELLIDLIST := RegisterClipboardFormat('Shell IDList Array');
+  CF_PREFERREDDROPEFFECT := RegisterClipboardFormat('Preferred DropEffect');
 
 finalization
   // ShellMalloc._Release; -> automaticly done by D4

+ 0 - 6
source/packages/filemng/CustomDirView.pas

@@ -128,7 +128,6 @@ type
     FOnDDEnd: TNotifyEvent;
     FOnDDCreateDataObject: TDDOnCreateDataObject;
     FOnDDTargetHasDropHandler: TDDOnTargetHasDropHandler;
-    FOnDDMenuPopup: TOnMenuPopup;
     FOnExecFile: TDirViewExecFileEvent;
     FForceRename: Boolean;
     FLastDDResult: TDragResult;
@@ -458,7 +457,6 @@ type
     property OnDDFileOperationExecuted: TDDFileOperationExecutedEvent
       read FOnDDFileOperationExecuted write FOnDDFileOperationExecuted;
     {Set AllowExec to false, if actual file should not be executed:}
-    property OnDDMenuPopup: TOnMenuPopup read FOnDDMenuPopup write FOnDDMenuPopup;
     property OnExecFile: TDirViewExecFileEvent
       read FOnExecFile write FOnExecFile;
     property OnHistoryChange: TDirViewNotifyEvent read FOnHistoryChange write FOnHistoryChange;
@@ -2300,10 +2298,6 @@ end;
 procedure TCustomDirView.DDMenuPopup(Sender: TObject; AMenu: HMenu;
   DataObj: IDataObject; AMinCustCmd: Integer; grfKeyState: Longint; pt: TPoint);
 begin
-  if Assigned(OnDDMenuPopup) then
-  begin
-    OnDDMenuPopup(Self, AMenu, DataObj, AMinCustCmd, grfKeyState, pt);
-  end;
 end;
 
 procedure TCustomDirView.DDMenuDone(Sender: TObject; AMenu: HMenu);

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

@@ -51,7 +51,6 @@ type
     FOnDDChooseEffect: TDDOnChooseEffect;
     FOnDDGiveFeedback: TDDOnGiveFeedback;
     FOnDDDragDetect: TDDOnDragDetect;
-    FOnDDMenuPopup: TOnMenuPopup;
     FOnDDProcessDropped: TOnProcessDropped;
     FOnDDError: TDDErrorEvent;
     FOnDDExecuted: TDDExecutedEvent;
@@ -114,9 +113,6 @@ type
     procedure DDDropHandlerSucceeded(Sender: TObject; KeyState: Longint;
       Point: TPoint; Effect: Longint);
     procedure DDGiveFeedback(Effect: Longint; var Result: HResult);
-    procedure DDMenuPopup(Sender: TObject; AMenu: HMenu; DataObj: IDataObject;
-      AMinCustCmd: Integer; grfKeyState: Longint; Point: TPoint);
-    procedure DDMenuDone(Sender: TObject; AMenu: HMenu);
     procedure DDProcessDropped(Sender: TObject; KeyState: Longint;
       Point: TPoint; Effect: Longint);
     procedure DDError(Error: TDDError); virtual;
@@ -212,7 +208,6 @@ type
       read FOnDDEnd write FOnDDEnd;
     property OnDDCreateDataObject: TDDOnCreateDataObject
       read FOnDDCreateDataObject write FOnDDCreateDataObject;
-    property OnDDMenuPopup: TOnMenuPopup read FOnDDMenuPopup write FOnDDMenuPopup;
 
     property OnBusy: TDirViewBusy read FOnBusy write FOnBusy;
 
@@ -271,8 +266,6 @@ begin
     OnDrop := DDDrop;
     OnQueryContinueDrag := DDQueryContinueDrag;
     OnSpecifyDropTarget := DDSpecifyDropTarget;
-    OnMenuPopup := DDMenuPopup;
-    OnMenuDestroy := DDMenuDone;
     OnDropHandlerSucceeded := DDDropHandlerSucceeded;
     OnGiveFeedback := DDGiveFeedback;
     OnProcessDropped := DDProcessDropped;
@@ -593,19 +586,6 @@ begin
   end;
 end; {DDQueryContinueDrag}
 
-procedure TCustomDriveView.DDMenuPopup(Sender: TObject; AMenu: HMenu;
-  DataObj: IDataObject; AMinCustCmd: Integer; grfKeyState: Longint; Point: TPoint);
-begin
-  if Assigned(OnDDMenuPopup) then
-  begin
-    OnDDMenuPopup(Self, AMenu, DataObj, AMinCustCmd, grfKeyState, Point);
-  end;
-end;
-
-procedure TCustomDriveView.DDMenuDone(Sender: TObject; AMenu: HMenu);
-begin
-end;
-
 procedure TCustomDriveView.DDDropHandlerSucceeded(Sender: TObject;
   KeyState: Integer; Point: TPoint; Effect: Integer);
 begin

+ 0 - 1
source/packages/filemng/DirView.pas

@@ -342,7 +342,6 @@ type
     property OnDDExecuted;
     property OnDDFileOperation;
     property OnDDFileOperationExecuted;
-    property OnDDMenuPopup;
 
     property OnExecFile;
     property OnMatchMask;

+ 0 - 1
source/packages/filemng/DriveView.pas

@@ -335,7 +335,6 @@ type
     property OnDDExecuted;
     property OnDDFileOperation;
     property OnDDFileOperationExecuted;
-    property OnDDMenuPopup;
 
     property Align;
     property Anchors;

+ 1 - 2
source/resource/HelpWin.h

@@ -19,8 +19,7 @@
 #define HELP_SYNCHRONIZE_SAVE_MODE   "ui_synchronize"
 #define HELP_PROGRESS_CANCEL         "ui_progress#controlling"
 #define HELP_KEEPUPTODATE_SYNCHRONIZE "task_keep_up_to_date"
-#define HELP_DND_DOWNLOAD_MOVE_WARNING "ui_pref_dragdrop#temporary"
-#define HELP_DD_WARN_LACK_OF_TEMP_SPACE HELP_DND_DOWNLOAD_MOVE_WARNING
+#define HELP_DD_WARN_LACK_OF_TEMP_SPACE "ui_pref_dragdrop#temporary"
 #define HELP_EDITOR_EARLY_CLOSED     "task_edit#mdi"
 #define HELP_APP_EARLY_CLOSED        HELP_EDITOR_EARLY_CLOSED
 #define HELP_OPEN_FILE_NO_PROCESS    HELP_EDITOR_EARLY_CLOSED

+ 0 - 2
source/resource/TextsWin.h

@@ -1,8 +1,6 @@
 #ifndef TextsWinH
 #define TextsWinH
 
-#define DND_DOWNLOAD_MOVE_WARNING 1050
-
 #define WIN_ERROR_STRINGS       1100
 #define WARN_FATAL_ERROR        1102
 #define CREATE_SHORTCUT_ERROR   1107

+ 0 - 0
source/resource/TextsWin1.rc → source/resource/TextsWin.rc


+ 0 - 16
source/resource/TextsWin2.rc

@@ -1,16 +0,0 @@
-#include "TextsWin.h"
-
-STRINGTABLE
-BEGIN
-  DND_DOWNLOAD_MOVE_WARNING,
-"You are trying to move remote file(s) to destination to which WinSCP cannot "
-"transfer files directly. Files will be downloaded to temporary directory "
-"instead. Transfer to final destination will be left to responsibility "
-"of target application (e.g. Windows Explorer), which WinSCP cannot control. "
-"Source files will be deleted just after download to temporary directory "
-"finishes. If target application fails to deliver temporary files, they may "
-"be lost. Please, consider copying files instead of moving.\n"
-"Hint: To copy files hold down Ctrl key while dragging.\n"
-"\n"
-"Do you still want to move the files?"
-END

+ 0 - 14
source/windows/WinConfiguration.cpp

@@ -489,8 +489,6 @@ void __fastcall TWinConfiguration::Default()
   int WorkAreaHeightScaled = DimensionToDefaultPixelsPerInch(Screen->WorkAreaHeight);
   UnicodeString PixelsPerInchToolbarValue = "PixelsPerInch=" + SaveDefaultPixelsPerInch();
 
-  FDDAllowMove = false;
-  FDDAllowMoveInit = false;
   FDDTransferConfirmation = asAuto;
   FDDTemporaryDirectory = L"";
   FDDWarnLackOfTempSpace = true;
@@ -897,8 +895,6 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
   BLOCK(L"Interface", CANCREATE, \
     KEYEX(Integer,DoubleClickAction, L"CopyOnDoubleClick"); \
     KEY(Bool,     CopyOnDoubleClickConfirmation); \
-    KEY(Bool,     DDAllowMove); \
-    KEY(Bool,     DDAllowMoveInit); \
     KEYEX(Integer, DDTransferConfirmation, L"DDTransferConfirmation2"); \
     KEY(String,   DDTemporaryDirectory); \
     KEY(Bool,     DDWarnLackOfTempSpace); \
@@ -1822,16 +1818,6 @@ void __fastcall TWinConfiguration::EndMasterPasswordSession()
   FMasterPasswordSessionAsked = false;
 }
 //---------------------------------------------------------------------------
-void __fastcall TWinConfiguration::SetDDAllowMove(bool value)
-{
-  SET_CONFIG_PROPERTY(DDAllowMove);
-}
-//---------------------------------------------------------------------------
-void __fastcall TWinConfiguration::SetDDAllowMoveInit(bool value)
-{
-  SET_CONFIG_PROPERTY(DDAllowMoveInit);
-}
-//---------------------------------------------------------------------------
 void __fastcall TWinConfiguration::SetDDTransferConfirmation(TAutoSwitch value)
 {
   SET_CONFIG_PROPERTY(DDTransferConfirmation);

+ 0 - 6
source/windows/WinConfiguration.h

@@ -336,8 +336,6 @@ private:
   UnicodeString FAutoStartSession;
   TDoubleClickAction FDoubleClickAction;
   bool FCopyOnDoubleClickConfirmation;
-  bool FDDAllowMove;
-  bool FDDAllowMoveInit;
   TAutoSwitch FDDTransferConfirmation;
   bool FDeleteToRecycleBin;
   bool FDimmHiddenFiles;
@@ -447,8 +445,6 @@ private:
 
   void __fastcall SetDoubleClickAction(TDoubleClickAction value);
   void __fastcall SetCopyOnDoubleClickConfirmation(bool value);
-  void __fastcall SetDDAllowMove(bool value);
-  void __fastcall SetDDAllowMoveInit(bool value);
   void __fastcall SetDDTransferConfirmation(TAutoSwitch value);
   void __fastcall SetDeleteToRecycleBin(bool value);
   void __fastcall SetDimmHiddenFiles(bool value);
@@ -639,8 +635,6 @@ public:
   __property UnicodeString AutoStartSession = { read = FAutoStartSession, write = SetAutoStartSession };
   __property TDoubleClickAction DoubleClickAction = { read = FDoubleClickAction, write = SetDoubleClickAction };
   __property bool CopyOnDoubleClickConfirmation = { read = FCopyOnDoubleClickConfirmation, write = SetCopyOnDoubleClickConfirmation };
-  __property bool DDAllowMove = { read = FDDAllowMove, write = SetDDAllowMove };
-  __property bool DDAllowMoveInit = { read = FDDAllowMoveInit, write = SetDDAllowMoveInit };
   __property TAutoSwitch DDTransferConfirmation = { read = FDDTransferConfirmation, write = SetDDTransferConfirmation };
   __property bool DeleteToRecycleBin = { read = FDeleteToRecycleBin, write = SetDeleteToRecycleBin };
   __property bool DimmHiddenFiles = { read = FDimmHiddenFiles, write = SetDimmHiddenFiles };

+ 1 - 2
source/windows/Windows.rc

@@ -1,8 +1,7 @@
 #include "..\\resource\\TextsFileZilla.rc"
 #include "..\\resource\\TextsCore1.rc"
 #include "..\\resource\\TextsCore2.rc"
-#include "..\\resource\\TextsWin1.rc"
-#include "..\\resource\\TextsWin2.rc"
+#include "..\\resource\\TextsWin.rc"
 
 Z_1_SITE ICON "..\\resource\\Site.ico"
 Z_2_SITE_FOLDER ICON "..\\resource\\SiteFolder.ico"