|
@@ -20,13 +20,13 @@
|
|
|
//---------------------------------------------------------------------------
|
|
|
bool __fastcall DoRemoteCopyDialog(TStrings * Sessions, TStrings * Directories,
|
|
|
TDirectRemoteCopy AllowDirectCopy, bool Multi, void *& Session, UnicodeString & Target, UnicodeString & FileMask,
|
|
|
- bool & DirectCopy)
|
|
|
+ bool & DirectCopy, void * CurrentSession)
|
|
|
{
|
|
|
bool Result;
|
|
|
TRemoteTransferDialog * Dialog = SafeFormCreate<TRemoteTransferDialog>();
|
|
|
try
|
|
|
{
|
|
|
- Dialog->Init(Multi, Sessions, Directories, AllowDirectCopy);
|
|
|
+ Dialog->Init(Multi, Sessions, Directories, AllowDirectCopy, CurrentSession);
|
|
|
Result = Dialog->Execute(Session, Target, FileMask, DirectCopy);
|
|
|
}
|
|
|
__finally
|
|
@@ -45,7 +45,7 @@ __fastcall TRemoteTransferDialog::TRemoteTransferDialog(TComponent * Owner)
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
void __fastcall TRemoteTransferDialog::Init(bool Multi, TStrings * Sessions,
|
|
|
- TStrings * Directories, TDirectRemoteCopy AllowDirectCopy)
|
|
|
+ TStrings * Directories, TDirectRemoteCopy AllowDirectCopy, void * CurrentSession)
|
|
|
{
|
|
|
FMulti = Multi;
|
|
|
SessionCombo->Items = Sessions;
|
|
@@ -53,27 +53,25 @@ void __fastcall TRemoteTransferDialog::Init(bool Multi, TStrings * Sessions,
|
|
|
DebugAssert(SessionCombo->Items->Count > 0);
|
|
|
DebugAssert(SessionCombo->Items->Count == FDirectories->Count);
|
|
|
FAllowDirectCopy = AllowDirectCopy;
|
|
|
+ FCurrentSession = CurrentSession;
|
|
|
LoadDialogImage(Image, L"Duplicate");
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
bool __fastcall TRemoteTransferDialog::Execute(void *& Session, UnicodeString & Target,
|
|
|
UnicodeString & FileMask, bool & DirectCopy)
|
|
|
{
|
|
|
- FCurrentSession = -1;
|
|
|
for (int Index = 0; Index < SessionCombo->Items->Count; Index++)
|
|
|
{
|
|
|
if (SessionCombo->Items->Objects[Index] == Session)
|
|
|
{
|
|
|
- FCurrentSession = Index;
|
|
|
SessionCombo->ItemIndex = Index;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- DebugAssert(FCurrentSession >= 0);
|
|
|
DirectoryEdit->Items = CustomWinConfiguration->History[L"RemoteTarget"];
|
|
|
DirectoryEdit->Text = UnixIncludeTrailingBackslash(Target) + FileMask;
|
|
|
FDirectCopy = DirectCopy;
|
|
|
- NotDirectCopyCheck->Checked = !DirectCopy;
|
|
|
+ UpdateNotDirectCopyCheck();
|
|
|
bool Result = (ShowModal() == DefaultResult(this));
|
|
|
if (Result)
|
|
|
{
|
|
@@ -94,7 +92,7 @@ UnicodeString __fastcall TRemoteTransferDialog::GetFileMask()
|
|
|
void __fastcall TRemoteTransferDialog::UpdateControls()
|
|
|
{
|
|
|
EnableControl(NotDirectCopyCheck,
|
|
|
- (SessionCombo->ItemIndex == FCurrentSession) &&
|
|
|
+ IsCurrentSessionSelected() &&
|
|
|
(FAllowDirectCopy != drcDisallow));
|
|
|
EnableControl(OkButton, !DirectoryEdit->Text.IsEmpty());
|
|
|
}
|
|
@@ -122,7 +120,13 @@ void __fastcall TRemoteTransferDialog::SessionComboChange(TObject * /*Sender*/)
|
|
|
DirectoryEdit->Text =
|
|
|
UnixIncludeTrailingBackslash(FDirectories->Strings[SessionCombo->ItemIndex]) +
|
|
|
UnixExtractFileName(DirectoryEdit->Text);
|
|
|
- if (SessionCombo->ItemIndex == FCurrentSession)
|
|
|
+ UpdateNotDirectCopyCheck();
|
|
|
+ UpdateControls();
|
|
|
+}
|
|
|
+//---------------------------------------------------------------------------
|
|
|
+void __fastcall TRemoteTransferDialog::UpdateNotDirectCopyCheck()
|
|
|
+{
|
|
|
+ if (IsCurrentSessionSelected())
|
|
|
{
|
|
|
NotDirectCopyCheck->Checked = !FDirectCopy;
|
|
|
}
|
|
@@ -130,7 +134,6 @@ void __fastcall TRemoteTransferDialog::SessionComboChange(TObject * /*Sender*/)
|
|
|
{
|
|
|
NotDirectCopyCheck->Checked = true;
|
|
|
}
|
|
|
- UpdateControls();
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
void __fastcall TRemoteTransferDialog::FormCloseQuery(TObject * /*Sender*/,
|
|
@@ -148,7 +151,7 @@ void __fastcall TRemoteTransferDialog::FormCloseQuery(TObject * /*Sender*/,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ((SessionCombo->ItemIndex == FCurrentSession) &&
|
|
|
+ if (IsCurrentSessionSelected() &&
|
|
|
(FAllowDirectCopy == drcConfirmCommandSession) &&
|
|
|
!NotDirectCopyCheck->Checked &&
|
|
|
GUIConfiguration->ConfirmCommandSession)
|
|
@@ -171,9 +174,14 @@ void __fastcall TRemoteTransferDialog::FormCloseQuery(TObject * /*Sender*/,
|
|
|
void __fastcall TRemoteTransferDialog::NotDirectCopyCheckClick(
|
|
|
TObject * /*Sender*/)
|
|
|
{
|
|
|
- if (SessionCombo->ItemIndex == FCurrentSession)
|
|
|
+ if (IsCurrentSessionSelected())
|
|
|
{
|
|
|
FDirectCopy = !NotDirectCopyCheck->Checked;
|
|
|
}
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
+bool __fastcall TRemoteTransferDialog::IsCurrentSessionSelected()
|
|
|
+{
|
|
|
+ return (SessionCombo->Items->Objects[SessionCombo->ItemIndex] == FCurrentSession);
|
|
|
+}
|
|
|
+//---------------------------------------------------------------------------
|