mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
Local to local file transfers from menus, toolbars and keyboard shortcuts (part of Bug 1893)
Source commit: 446a9a54a89c4f3ab16ad3bc6b942f55cb115b49
This commit is contained in:
@@ -106,24 +106,16 @@ private:
|
||||
TCustomScpExplorerForm * FForm;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
class TAutoBatch
|
||||
TAutoBatch::TAutoBatch(TCustomScpExplorerForm * Form) :
|
||||
FForm(Form)
|
||||
{
|
||||
public:
|
||||
TAutoBatch(TCustomScpExplorerForm * Form) :
|
||||
FForm(Form)
|
||||
{
|
||||
FForm->BatchStart(FBatchStorage);
|
||||
}
|
||||
|
||||
~TAutoBatch()
|
||||
{
|
||||
FForm->BatchEnd(FBatchStorage);
|
||||
}
|
||||
|
||||
private:
|
||||
TCustomScpExplorerForm * FForm;
|
||||
void * FBatchStorage;
|
||||
};
|
||||
FForm->BatchStart(FBatchStorage);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
TAutoBatch::~TAutoBatch()
|
||||
{
|
||||
FForm->BatchEnd(FBatchStorage);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
struct TTransferOperationParam
|
||||
{
|
||||
@@ -10162,14 +10154,27 @@ bool __fastcall TCustomScpExplorerForm::IsBusy()
|
||||
return (FLockLevel > 0) || DirView(osCurrent)->IsEditing();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
Boolean __fastcall TCustomScpExplorerForm::AllowedAction(TAction * /*Action*/, TActionAllowed Allowed)
|
||||
Boolean __fastcall TCustomScpExplorerForm::AllowedAction(TAction * Action, TActionAllowed Allowed)
|
||||
{
|
||||
// While the window is disabled, we still seem to process menu shortcuts at least,
|
||||
// so stop it at least here.
|
||||
// See also TCustomScpExplorerForm::RemoteDirViewBusy
|
||||
return
|
||||
(Allowed == aaUpdate) ||
|
||||
!NonVisualDataModule->Busy;
|
||||
bool Result;
|
||||
if (Allowed == aaUpdate)
|
||||
{
|
||||
Result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Result = !NonVisualDataModule->Busy;
|
||||
if (Result && (Allowed == aaShortCut))
|
||||
{
|
||||
// Otherwise F5 for local-local will be swallowed by disabled local<>remote actions in TCustomScpExplorerForm::KeyDown
|
||||
Action->Update();
|
||||
Result = Action->Enabled;
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCustomScpExplorerForm::EditMenuItemPopup(TTBCustomItem * Sender, bool FromLink)
|
||||
@@ -10992,3 +10997,8 @@ bool __fastcall TCustomScpExplorerForm::HasActiveTerminal()
|
||||
{
|
||||
return IsActiveTerminal(Terminal);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void TCustomScpExplorerForm::LocalLocalCopy(TFileOperation, TOperationSide, bool DebugUsedArg(OnFocused))
|
||||
{
|
||||
DebugFail();
|
||||
}
|
||||
|
||||
@@ -398,7 +398,6 @@ protected:
|
||||
bool __fastcall GetComponentVisible(Byte Component);
|
||||
virtual Boolean __fastcall GetHasDirView(TOperationSide Side);
|
||||
virtual TCustomDriveView * __fastcall DriveView(TOperationSide Side);
|
||||
virtual bool IsLocalBrowserMode();
|
||||
virtual TCustomDirView * GetCurrentLocalBrowser();
|
||||
DYNAMIC void __fastcall KeyDown(Word & Key, Classes::TShiftState Shift);
|
||||
virtual void __fastcall RestoreFormParams();
|
||||
@@ -730,6 +729,7 @@ public:
|
||||
bool OnFocused, bool NoConfirmation = false, void * Param = NULL);
|
||||
void __fastcall ExecuteCopyOperationCommand(
|
||||
TOperationSide Side, bool OnFocused, unsigned int Flags);
|
||||
virtual void LocalLocalCopy(TFileOperation Operation, TOperationSide Side, bool OnFocused);
|
||||
void __fastcall AdHocCustomCommand(bool OnFocused);
|
||||
virtual TCustomDirView * __fastcall DirView(TOperationSide Side);
|
||||
virtual bool __fastcall DirViewEnabled(TOperationSide Side);
|
||||
@@ -745,6 +745,7 @@ public:
|
||||
void __fastcall SuspendWindowLock();
|
||||
void __fastcall ResumeWindowLock();
|
||||
bool __fastcall HasActiveTerminal();
|
||||
virtual bool IsLocalBrowserMode();
|
||||
|
||||
void __fastcall NewSession(bool FromSite, const UnicodeString & SessionUrl = L"");
|
||||
void __fastcall DuplicateSession();
|
||||
@@ -861,4 +862,15 @@ public:
|
||||
__property TColor SessionColor = { read = FSessionColor, write = SetSessionColor };
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
class TAutoBatch
|
||||
{
|
||||
public:
|
||||
TAutoBatch(TCustomScpExplorerForm * Form);
|
||||
~TAutoBatch();
|
||||
|
||||
private:
|
||||
TCustomScpExplorerForm * FForm;
|
||||
void * FBatchStorage;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -147,6 +147,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
|
||||
#define EnabledRemoteSelectedOperation (ScpExplorer->EnableSelectedOperation[osRemote] && HasTerminal)
|
||||
#define EnabledRemoteFocusedOperation (ScpExplorer->EnableFocusedOperation[osRemote] && HasTerminal)
|
||||
#define EnabledRemoteSelectedFileOperation (ScpExplorer->EnableSelectedFileOperation[osRemote] && HasTerminal)
|
||||
#define EnabledOtherSelectedOperation ScpExplorer->IsLocalBrowserMode() && ScpExplorer->EnableSelectedOperation[osOther]
|
||||
// focused operation
|
||||
UPD(CurrentDeleteFocusedAction, EnabledFocusedOperation)
|
||||
UPD(CurrentPropertiesFocusedAction, EnabledFocusedOperation)
|
||||
@@ -196,8 +197,10 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
|
||||
ScpExplorer->Terminal->IsCapable[fcLocking])
|
||||
// local selected operation
|
||||
UPD(LocalCopyAction, HasTerminal && EnabledLocalSelectedOperation)
|
||||
UPD(LocalCopyQueueAction, HasTerminal && EnabledLocalSelectedOperation && ScpExplorer->Terminal->IsCapable[fcBackgroundTransfers])
|
||||
UPD(LocalCopyNonQueueAction, HasTerminal && EnabledLocalSelectedOperation)
|
||||
UPDEX1(LocalCopyQueueAction,
|
||||
HasTerminal && EnabledLocalSelectedOperation && ScpExplorer->Terminal->IsCapable[fcBackgroundTransfers],
|
||||
Action->Visible = !ScpExplorer->IsLocalBrowserMode())
|
||||
UPDEX1(LocalCopyNonQueueAction, HasTerminal && EnabledLocalSelectedOperation, Action->Visible = !ScpExplorer->IsLocalBrowserMode())
|
||||
UPD(LocalRenameAction2, EnabledLocalSelectedOperation)
|
||||
UPD(LocalEditAction2, EnabledLocalSelectedFileOperation && !WinConfiguration->DisableOpenEdit)
|
||||
UPD(LocalMoveAction, HasTerminal && EnabledLocalSelectedOperation)
|
||||
@@ -206,15 +209,23 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
|
||||
UPD(LocalPropertiesAction2, EnabledLocalSelectedOperation)
|
||||
UPD(LocalAddEditLinkAction3, ScpExplorer->CanAddEditLink(osLocal))
|
||||
UPD(LocalNewFileAction, !WinConfiguration->DisableOpenEdit)
|
||||
UPD(LocalLocalCopyAction, ScpExplorer->IsLocalBrowserMode() && EnabledLocalSelectedOperation)
|
||||
UPD(LocalLocalMoveAction, ScpExplorer->IsLocalBrowserMode() && EnabledLocalSelectedOperation)
|
||||
UPD(LocalOtherCopyAction, EnabledOtherSelectedOperation)
|
||||
UPD(LocalOtherMoveAction, EnabledOtherSelectedOperation)
|
||||
// local focused operation
|
||||
UPD(LocalCopyFocusedAction, HasTerminal && EnabledLocalFocusedOperation)
|
||||
UPDEX1(LocalCopyFocusedAction, HasTerminal && EnabledLocalFocusedOperation, Action->Visible = !ScpExplorer->IsLocalBrowserMode())
|
||||
UPD(LocalCopyFocusedQueueAction, HasTerminal && EnabledLocalFocusedOperation && ScpExplorer->Terminal->IsCapable[fcBackgroundTransfers])
|
||||
UPD(LocalCopyFocusedNonQueueAction, HasTerminal && EnabledLocalFocusedOperation)
|
||||
UPD(LocalMoveFocusedAction, HasTerminal && EnabledLocalFocusedOperation)
|
||||
UPDEX1(LocalLocalCopyFocusedAction, ScpExplorer->IsLocalBrowserMode() && EnabledFocusedOperation, Action->Visible = ScpExplorer->IsLocalBrowserMode())
|
||||
UPDEX1(LocalLocalMoveFocusedAction, ScpExplorer->IsLocalBrowserMode() && EnabledFocusedOperation, Action->Visible = ScpExplorer->IsLocalBrowserMode())
|
||||
// remote selected operation
|
||||
UPD(RemoteCopyAction, EnabledRemoteSelectedOperation)
|
||||
UPD(RemoteCopyQueueAction, EnabledRemoteSelectedOperation && ScpExplorer->Terminal->IsCapable[fcBackgroundTransfers])
|
||||
UPD(RemoteCopyNonQueueAction, EnabledRemoteSelectedOperation)
|
||||
UPDEX1(RemoteCopyQueueAction,
|
||||
EnabledRemoteSelectedOperation && ScpExplorer->Terminal->IsCapable[fcBackgroundTransfers],
|
||||
Action->Visible = !ScpExplorer->IsLocalBrowserMode())
|
||||
UPDEX1(RemoteCopyNonQueueAction, EnabledRemoteSelectedOperation, Action->Visible = !ScpExplorer->IsLocalBrowserMode())
|
||||
UPD(RemoteRenameAction2, EnabledRemoteSelectedOperation &&
|
||||
ScpExplorer->Terminal->IsCapable[fcRename])
|
||||
UPD(RemoteEditAction2, EnabledRemoteSelectedFileOperation && !WinConfiguration->DisableOpenEdit)
|
||||
@@ -551,11 +562,17 @@ void __fastcall TNonVisualDataModule::ExplorerActionsExecute(
|
||||
EXE(LocalPropertiesAction2, ScpExplorer->ExecuteFileOperationCommand(foSetProperties, osLocal, false))
|
||||
EXE(LocalAddEditLinkAction3, ScpExplorer->AddEditLink(osLocal, false))
|
||||
EXE(LocalNewFileAction, ScpExplorer->EditNew(osLocal))
|
||||
EXE(LocalLocalCopyAction, ScpExplorer->LocalLocalCopy(foCopy, osLocal, false))
|
||||
EXE(LocalLocalMoveAction, ScpExplorer->LocalLocalCopy(foMove, osLocal, false))
|
||||
EXE(LocalOtherCopyAction, ScpExplorer->LocalLocalCopy(foCopy, osOther, false))
|
||||
EXE(LocalOtherMoveAction, ScpExplorer->LocalLocalCopy(foMove, osOther, false))
|
||||
// local focused operation
|
||||
EXE(LocalCopyFocusedAction, ScpExplorer->ExecuteCopyOperationCommand(osLocal, true, ShortCutFlag))
|
||||
EXE(LocalCopyFocusedQueueAction, ScpExplorer->ExecuteCopyOperationCommand(osLocal, true, cocQueue))
|
||||
EXE(LocalCopyFocusedNonQueueAction, ScpExplorer->ExecuteCopyOperationCommand(osLocal, true, cocNonQueue))
|
||||
EXE(LocalMoveFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foMove, osLocal, true))
|
||||
EXE(LocalLocalCopyFocusedAction, ScpExplorer->LocalLocalCopy(foCopy, osCurrent, true))
|
||||
EXE(LocalLocalMoveFocusedAction, ScpExplorer->LocalLocalCopy(foMove, osCurrent, true))
|
||||
// remote selected operation
|
||||
EXE(RemoteCopyAction, ScpExplorer->ExecuteCopyOperationCommand(osRemote, false, ShortCutFlag))
|
||||
EXE(RemoteCopyQueueAction, ScpExplorer->ExecuteCopyOperationCommand(osRemote, false, cocQueue))
|
||||
@@ -962,15 +979,21 @@ void __fastcall TNonVisualDataModule::CloneShortcuts()
|
||||
CurrentPropertiesAction->ShortCut = CurrentPropertiesFocusedAction->ShortCut;
|
||||
// local selected operation
|
||||
LocalCopyAction->ShortCut = RemoteCopyAction->ShortCut;
|
||||
LocalLocalCopyAction->ShortCut = RemoteCopyAction->ShortCut;
|
||||
LocalOtherCopyAction->ShortCut = RemoteCopyAction->ShortCut;
|
||||
LocalRenameAction2->ShortCut = CurrentRenameAction->ShortCut;
|
||||
LocalEditAction2->ShortCut = CurrentEditAction->ShortCut;
|
||||
LocalMoveAction->ShortCut = RemoteMoveAction->ShortCut;
|
||||
LocalLocalMoveAction->ShortCut = LocalMoveAction->ShortCut;
|
||||
LocalOtherMoveAction->ShortCut = LocalMoveAction->ShortCut;
|
||||
LocalCreateDirAction3->ShortCut = CurrentCreateDirAction->ShortCut;
|
||||
LocalDeleteAction2->ShortCut = CurrentDeleteAction->ShortCut;
|
||||
LocalPropertiesAction2->ShortCut = CurrentPropertiesAction->ShortCut;
|
||||
// local focused operation
|
||||
LocalCopyFocusedAction->ShortCut = LocalCopyAction->ShortCut;
|
||||
LocalMoveFocusedAction->ShortCut = LocalMoveAction->ShortCut;
|
||||
LocalLocalCopyFocusedAction->ShortCut = LocalCopyAction->ShortCut;
|
||||
LocalLocalMoveFocusedAction->ShortCut = LocalMoveAction->ShortCut;
|
||||
// remote selected operation
|
||||
RemoteRenameAction2->ShortCut = CurrentRenameAction->ShortCut;
|
||||
RemoteEditAction2->ShortCut = CurrentEditAction->ShortCut;
|
||||
|
||||
@@ -2309,6 +2309,48 @@ object NonVisualDataModule: TNonVisualDataModule
|
||||
ImageIndex = 56
|
||||
ShortCut = 49221
|
||||
end
|
||||
object LocalLocalCopyAction: TAction
|
||||
Tag = 9
|
||||
Category = 'Local Selected Operation'
|
||||
Caption = '&Copy'
|
||||
Hint = 'Copy the selected file(s) to another directory or another name'
|
||||
ImageIndex = 78
|
||||
end
|
||||
object LocalLocalMoveAction: TAction
|
||||
Tag = 9
|
||||
Category = 'Local Selected Operation'
|
||||
Caption = '&Move'
|
||||
Hint = 'Move the selected file(s) to another directory or rename them'
|
||||
ImageIndex = 100
|
||||
end
|
||||
object LocalOtherCopyAction: TAction
|
||||
Tag = 14
|
||||
Category = 'Local Selected Operation'
|
||||
Caption = '&Copy'
|
||||
Hint = 'Copy the selected file(s) to another directory or another name'
|
||||
ImageIndex = 78
|
||||
end
|
||||
object LocalOtherMoveAction: TAction
|
||||
Tag = 14
|
||||
Category = 'Local Selected Operation'
|
||||
Caption = '&Move'
|
||||
Hint = 'Move the selected file(s) to another directory or rename them'
|
||||
ImageIndex = 100
|
||||
end
|
||||
object LocalLocalCopyFocusedAction: TAction
|
||||
Tag = 8
|
||||
Category = 'Local Focused Operation'
|
||||
Caption = '&Copy'
|
||||
Hint = 'Copy the selected file(s) to another directory or another name'
|
||||
ImageIndex = 78
|
||||
end
|
||||
object LocalLocalMoveFocusedAction: TAction
|
||||
Tag = 8
|
||||
Category = 'Local Focused Operation'
|
||||
Caption = '&Move'
|
||||
Hint = 'Move the selected file(s) to another directory or rename them'
|
||||
ImageIndex = 100
|
||||
end
|
||||
end
|
||||
object ExplorerBarPopup: TTBXPopupMenu
|
||||
Images = GlyphsModule.ExplorerImages
|
||||
@@ -3194,6 +3236,12 @@ object NonVisualDataModule: TNonVisualDataModule
|
||||
Action = LocalMoveFocusedAction
|
||||
end
|
||||
end
|
||||
object TBXItem102: TTBXItem
|
||||
Action = LocalLocalCopyFocusedAction
|
||||
end
|
||||
object TBXItem101: TTBXItem
|
||||
Action = LocalLocalMoveFocusedAction
|
||||
end
|
||||
object TBXItem57: TTBXItem
|
||||
Action = CurrentDeleteFocusedAction
|
||||
end
|
||||
|
||||
@@ -654,6 +654,14 @@ __published: // IDE-managed Components
|
||||
TAction *RemoteExploreDirectoryAction;
|
||||
TTBXItem *TBXItem99;
|
||||
TTBXItem *TBXItem100;
|
||||
TAction *LocalLocalCopyAction;
|
||||
TAction *LocalLocalMoveAction;
|
||||
TAction *LocalOtherCopyAction;
|
||||
TAction *LocalOtherMoveAction;
|
||||
TAction *LocalLocalCopyFocusedAction;
|
||||
TAction *LocalLocalMoveFocusedAction;
|
||||
TTBXItem *TBXItem101;
|
||||
TTBXItem *TBXItem102;
|
||||
void __fastcall ExplorerActionsUpdate(TBasicAction *Action, bool &Handled);
|
||||
void __fastcall ExplorerActionsExecute(TBasicAction *Action, bool &Handled);
|
||||
void __fastcall SessionIdleTimerTimer(TObject *Sender);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <GUITools.h>
|
||||
#include <DragDrop.hpp>
|
||||
#include <StrUtils.hpp>
|
||||
#include <IOUtils.hpp>
|
||||
|
||||
#include "Glyphs.h"
|
||||
#include "NonVisual.h"
|
||||
@@ -908,6 +909,15 @@ void __fastcall TScpCommanderForm::PanelSplitterDblClick(TObject * Sender)
|
||||
FixControlsPlacement();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TScpCommanderForm::SetToolbar2ItemAction(TTBXItem * Item, TBasicAction * Action)
|
||||
{
|
||||
if (Item->Action != Action)
|
||||
{
|
||||
Item->Action = Action;
|
||||
UpdateToolbar2ItemCaption(Item);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TScpCommanderForm::UpdateControls()
|
||||
{
|
||||
// Before TCustomScpExplorerForm disables them (when disconnecting)
|
||||
@@ -946,21 +956,51 @@ void __fastcall TScpCommanderForm::UpdateControls()
|
||||
OtherLocalDriveView->Font->Color = LocalDirView->Font->Color;
|
||||
|
||||
// TODO_OTHER_LOCAL
|
||||
bool LocalSide = (FCurrentSide == osLocal);
|
||||
TAction * CurrentCopyAction = LocalSide ? NonVisualDataModule->LocalCopyAction : NonVisualDataModule->RemoteCopyAction;
|
||||
if (CurrentCopyItem->Action != CurrentCopyAction)
|
||||
if (IsLocalBrowserMode())
|
||||
{
|
||||
CurrentCopyItem->Action = CurrentCopyAction;
|
||||
CurrentCopyToolbar2Item->Action = CurrentCopyAction;
|
||||
UpdateToolbar2ItemCaption(CurrentCopyToolbar2Item);
|
||||
|
||||
CurrentCopyNonQueueItem->Action = LocalSide ? NonVisualDataModule->LocalCopyNonQueueAction : NonVisualDataModule->RemoteCopyNonQueueAction;
|
||||
CurrentCopyQueueItem->Action = LocalSide ? NonVisualDataModule->LocalCopyQueueAction : NonVisualDataModule->RemoteCopyQueueAction;
|
||||
|
||||
TAction * CurrentMoveAction = LocalSide ? NonVisualDataModule->LocalMoveAction : NonVisualDataModule->RemoteMoveAction;
|
||||
CurrentMoveItem->Action = CurrentMoveAction;
|
||||
CurrentMoveToolbar2Item->Action = CurrentMoveAction;
|
||||
UpdateToolbar2ItemCaption(CurrentMoveToolbar2Item);
|
||||
CurrentCopyItem->Visible = false;
|
||||
if (FCurrentSide == osLocal)
|
||||
{
|
||||
CurrentCopyToItem->Action = NonVisualDataModule->LocalLocalCopyAction;
|
||||
CurrentMoveToItem->Action = NonVisualDataModule->LocalLocalMoveAction;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentCopyToItem->Action = NonVisualDataModule->LocalOtherCopyAction;
|
||||
CurrentMoveToItem->Action = NonVisualDataModule->LocalOtherMoveAction;
|
||||
}
|
||||
LocalCopyItem->Action = NonVisualDataModule->LocalLocalCopyAction;
|
||||
LocalMoveItem->Action = NonVisualDataModule->LocalLocalMoveAction;
|
||||
RemoteCopyItem->Action = NonVisualDataModule->LocalOtherCopyAction;
|
||||
RemoteMoveItem->Action = NonVisualDataModule->LocalOtherMoveAction;
|
||||
SetToolbar2ItemAction(CurrentCopyToolbar2Item, CurrentCopyToItem->Action);
|
||||
SetToolbar2ItemAction(CurrentMoveToolbar2Item, CurrentMoveToItem->Action);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentCopyItem->Visible = true;
|
||||
CurrentCopyToItem->Action = NonVisualDataModule->RemoteCopyToAction;
|
||||
CurrentMoveToItem->Action = NonVisualDataModule->RemoteMoveToAction;
|
||||
if (IsSideLocalBrowser(FCurrentSide))
|
||||
{
|
||||
CurrentCopyItem->Action = NonVisualDataModule->LocalCopyAction;
|
||||
CurrentMoveItem->Action = NonVisualDataModule->LocalMoveAction;
|
||||
CurrentCopyNonQueueItem->Action = NonVisualDataModule->LocalCopyNonQueueAction;
|
||||
CurrentCopyQueueItem->Action = NonVisualDataModule->LocalCopyQueueAction;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentCopyItem->Action = NonVisualDataModule->RemoteCopyAction;
|
||||
CurrentMoveItem->Action = NonVisualDataModule->RemoteMoveAction;
|
||||
CurrentCopyNonQueueItem->Action = NonVisualDataModule->RemoteCopyNonQueueAction;
|
||||
CurrentCopyQueueItem->Action = NonVisualDataModule->RemoteCopyQueueAction;
|
||||
}
|
||||
LocalCopyItem->Action = NonVisualDataModule->LocalCopyAction;
|
||||
LocalMoveItem->Action = NonVisualDataModule->LocalMoveAction;
|
||||
RemoteCopyItem->Action = NonVisualDataModule->RemoteCopyAction;
|
||||
RemoteMoveItem->Action = NonVisualDataModule->RemoteMoveAction;
|
||||
SetToolbar2ItemAction(CurrentCopyToolbar2Item, CurrentCopyItem->Action);
|
||||
SetToolbar2ItemAction(CurrentMoveToolbar2Item, CurrentMoveItem->Action);
|
||||
}
|
||||
|
||||
CommandLineCombo->Enabled = IsSideLocalBrowser(FCurrentSide) || CanConsole();
|
||||
@@ -2562,3 +2602,63 @@ void __fastcall TScpCommanderForm::LocalDriveViewNeedHiddenDirectories(TObject *
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void TScpCommanderForm::LocalLocalCopy(::TFileOperation Operation, TOperationSide Side, bool OnFocused)
|
||||
{
|
||||
std::unique_ptr<TFileOperator> FileOperator(new TFileOperator(NULL));
|
||||
switch (Operation)
|
||||
{
|
||||
case ::foCopy:
|
||||
FileOperator->Operation = Fileoperator::foCopy;
|
||||
break;
|
||||
case ::foMove:
|
||||
FileOperator->Operation = Fileoperator::foMove;
|
||||
break;
|
||||
default:
|
||||
DebugFail();
|
||||
Abort();
|
||||
}
|
||||
|
||||
TOperationSide OtherSide;
|
||||
switch (GetSide(Side))
|
||||
{
|
||||
case osLocal:
|
||||
OtherSide = osOther;
|
||||
break;
|
||||
case osOther:
|
||||
OtherSide = osLocal;
|
||||
break;
|
||||
default:
|
||||
DebugFail();
|
||||
Abort();
|
||||
}
|
||||
|
||||
TCustomDirView * SourceDirView = DirView(Side);
|
||||
UnicodeString DestinationDir = DirView(OtherSide)->PathName;
|
||||
FileOperator->Flags = FileOperator->Flags << foMultiDestFiles;
|
||||
FileOperator->OperandFrom->Clear();
|
||||
SourceDirView->CreateFileList(OnFocused, true, FileOperator->OperandFrom);
|
||||
FileOperator->OperandTo->Clear();
|
||||
for (int Index = 0; Index < FileOperator->OperandFrom->Count; Index++)
|
||||
{
|
||||
UnicodeString SourcePath = FileOperator->OperandFrom->Strings[Index];
|
||||
UnicodeString DestinationPath = TPath::Combine(DestinationDir, TPath::GetFileName(SourcePath));
|
||||
FileOperator->OperandTo->Add(DestinationPath);
|
||||
}
|
||||
|
||||
SourceDirView->ClearSelection();
|
||||
|
||||
{
|
||||
TAutoBatch AutoBatch(this);
|
||||
FileOperator->Execute();
|
||||
}
|
||||
|
||||
ReloadLocalDirectory(DestinationDir);
|
||||
if (Operation == ::foMove)
|
||||
{
|
||||
UnicodeString SourceDir = SourceDirView->PathName;
|
||||
if (!SamePaths(SourceDir, DestinationDir))
|
||||
{
|
||||
ReloadLocalDirectory(SourceDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,10 +238,10 @@ inherited ScpCommanderForm: TScpCommanderForm
|
||||
Action = NonVisualDataModule.RemoteMoveAction
|
||||
end
|
||||
end
|
||||
object TBXItem31: TTBXItem
|
||||
object CurrentCopyToItem: TTBXItem
|
||||
Action = NonVisualDataModule.RemoteCopyToAction
|
||||
end
|
||||
object TBXItem33: TTBXItem
|
||||
object CurrentMoveToItem: TTBXItem
|
||||
Action = NonVisualDataModule.RemoteMoveToAction
|
||||
end
|
||||
object TBXItem34: TTBXItem
|
||||
@@ -1321,7 +1321,7 @@ inherited ScpCommanderForm: TScpCommanderForm
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 3
|
||||
object TBXItem238: TTBXSubmenuItem
|
||||
object RemoteCopyItem: TTBXSubmenuItem
|
||||
Action = NonVisualDataModule.RemoteCopyAction
|
||||
DisplayMode = nbdmImageAndText
|
||||
DropdownCombo = True
|
||||
@@ -1333,7 +1333,7 @@ inherited ScpCommanderForm: TScpCommanderForm
|
||||
end
|
||||
object TBXSeparatorItem59: TTBXSeparatorItem
|
||||
end
|
||||
object TBXItem239: TTBXItem
|
||||
object RemoteMoveItem: TTBXItem
|
||||
Action = NonVisualDataModule.RemoteMoveAction
|
||||
end
|
||||
end
|
||||
@@ -1670,7 +1670,7 @@ inherited ScpCommanderForm: TScpCommanderForm
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 3
|
||||
object TBXItem231: TTBXSubmenuItem
|
||||
object LocalCopyItem: TTBXSubmenuItem
|
||||
Action = NonVisualDataModule.LocalCopyAction
|
||||
DisplayMode = nbdmImageAndText
|
||||
DropdownCombo = True
|
||||
@@ -1682,7 +1682,7 @@ inherited ScpCommanderForm: TScpCommanderForm
|
||||
end
|
||||
object TBXSeparatorItem58: TTBXSeparatorItem
|
||||
end
|
||||
object TBXItem232: TTBXItem
|
||||
object LocalMoveItem: TTBXItem
|
||||
Action = NonVisualDataModule.LocalMoveAction
|
||||
end
|
||||
end
|
||||
|
||||
@@ -129,9 +129,9 @@ __published:
|
||||
TTBXItem *TBXItem29;
|
||||
TTBXSeparatorItem *TBXSeparatorItem7;
|
||||
TTBXSubmenuItem *CurrentCopyItem;
|
||||
TTBXItem *TBXItem31;
|
||||
TTBXItem *CurrentCopyToItem;
|
||||
TTBXItem *CurrentMoveItem;
|
||||
TTBXItem *TBXItem33;
|
||||
TTBXItem *CurrentMoveToItem;
|
||||
TTBXItem *TBXItem34;
|
||||
TTBXItem *TBXItem35;
|
||||
TTBXItem *TBXItem36;
|
||||
@@ -354,8 +354,8 @@ __published:
|
||||
TTBXItem *TBXItem230;
|
||||
TTBXSubmenuItem *TBXSubmenuItem231;
|
||||
TTBXToolbar *LocalFileToolbar;
|
||||
TTBXSubmenuItem *TBXItem231;
|
||||
TTBXItem *TBXItem232;
|
||||
TTBXSubmenuItem *LocalCopyItem;
|
||||
TTBXItem *LocalMoveItem;
|
||||
TTBXItem *TBXItem233;
|
||||
TTBXItem *TBXItem234;
|
||||
TTBXSubmenuItem *TBXItem235;
|
||||
@@ -363,8 +363,8 @@ __published:
|
||||
TTBXItem *TBXItem236;
|
||||
TTBXSeparatorItem *TBXSeparatorItem54;
|
||||
TTBXToolbar *RemoteFileToolbar;
|
||||
TTBXSubmenuItem *TBXItem238;
|
||||
TTBXItem *TBXItem239;
|
||||
TTBXSubmenuItem *RemoteCopyItem;
|
||||
TTBXItem *RemoteMoveItem;
|
||||
TTBXSeparatorItem *TBXSeparatorItem55;
|
||||
TTBXItem *TBXItem240;
|
||||
TTBXItem *TBXItem241;
|
||||
@@ -612,7 +612,6 @@ protected:
|
||||
virtual void __fastcall UpdateImages();
|
||||
virtual void __fastcall FileColorsChanged();
|
||||
virtual void __fastcall ThemeChanged();
|
||||
virtual bool IsLocalBrowserMode();
|
||||
void __fastcall DoPathLabelPathClick(TOperationSide Side, const UnicodeString & Path);
|
||||
virtual void __fastcall DoRemotePathComboBoxAdjustImageIndex(
|
||||
TTBXComboBoxItem * Sender, const UnicodeString AText, int AIndex, int & ImageIndex);
|
||||
@@ -622,6 +621,7 @@ protected:
|
||||
void __fastcall DoLocalPathComboBoxItemClick(TDirView * ADirView, TTBXComboBoxItem * PathComboBox);
|
||||
virtual void __fastcall DoRemotePathComboBoxItemClick(TObject * Sender);
|
||||
virtual void __fastcall UpdateRemotePathComboBox(bool TextOnly);
|
||||
void __fastcall SetToolbar2ItemAction(TTBXItem * Item, TBasicAction * Action);
|
||||
|
||||
public:
|
||||
__fastcall TScpCommanderForm(TComponent* Owner);
|
||||
@@ -648,6 +648,8 @@ public:
|
||||
virtual void __fastcall PasteFromClipBoard();
|
||||
virtual void __fastcall BrowseFile();
|
||||
virtual bool IsSideLocalBrowser(TOperationSide Side);
|
||||
virtual bool IsLocalBrowserMode();
|
||||
virtual void LocalLocalCopy(::TFileOperation Operation, TOperationSide Side, bool OnFocused);
|
||||
|
||||
__property double LeftPanelWidth = { read = GetLeftPanelWidth, write = SetLeftPanelWidth };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user