Преглед на файлове

SCP fallback option is disabled when a custom SFTP server is specified as it does not work then

Source commit: 3895ba091a75c90256de4d9d81a555bf9f5f2634
Martin Prikryl преди 5 години
родител
ревизия
dc67850c87
променени са 3 файла, в които са добавени 11 реда и са изтрити 3 реда
  1. 9 3
      source/forms/SiteAdvanced.cpp
  2. 1 0
      source/forms/SiteAdvanced.dfm
  3. 1 0
      source/forms/SiteAdvanced.h

+ 9 - 3
source/forms/SiteAdvanced.cpp

@@ -428,6 +428,13 @@ TSshProt __fastcall TSiteAdvancedDialog::GetSshProt()
   return (SshProtCombo2->ItemIndex == 0) ? ssh1only : ssh2only;
 }
 //---------------------------------------------------------------------
+bool TSiteAdvancedDialog::IsDefaultSftpServer()
+{
+  return
+    SftpServerEdit->Text.IsEmpty() ||
+    (SftpServerEdit->Text == SftpServerEdit->Items->Strings[0]);
+}
+//---------------------------------------------------------------------
 void __fastcall TSiteAdvancedDialog::SaveSession(TSessionData * SessionData)
 {
   // Last resort validation,
@@ -580,9 +587,7 @@ void __fastcall TSiteAdvancedDialog::SaveSession(TSessionData * SessionData)
   SessionData->SCPLsFullTime = SCPLsFullTimeAutoCheck->Checked ? asAuto : asOff;
 
   // SFTP page
-  SessionData->SftpServer =
-    ((SftpServerEdit->Text == SftpServerEdit->Items->Strings[0]) ?
-      UnicodeString() : SftpServerEdit->Text);
+  SessionData->SftpServer = (IsDefaultSftpServer() ? UnicodeString() : SftpServerEdit->Text);
   SessionData->SFTPMaxVersion = SFTPMaxVersionCombo->ItemIndex;
   if (AllowScpFallbackCheck->Checked != (SessionData->FSProtocol == fsSFTP))
   {
@@ -1009,6 +1014,7 @@ void __fastcall TSiteAdvancedDialog::UpdateControls()
 
     // environment/sftp sheet
     SftpSheet->Enabled = SftpProtocol;
+    EnableControl(AllowScpFallbackCheck, IsDefaultSftpServer());
 
     // environment/scp/shell
     ScpSheet->Enabled = SshProtocol;

+ 1 - 0
source/forms/SiteAdvanced.dfm

@@ -654,6 +654,7 @@ object SiteAdvancedDialog: TSiteAdvancedDialog
             MaxLength = 255
             TabOrder = 0
             Text = 'SftpServerEdit'
+            OnChange = DataChange
             Items.Strings = (
               'Default'
               '/bin/sftp-server'

+ 1 - 0
source/forms/SiteAdvanced.h

@@ -334,6 +334,7 @@ protected:
   bool __fastcall AllowAlgDrag(TListBox * AlgListBox, int X, int Y);
   void __fastcall AlgMove(TListBox * AlgListBox, int Source, int Dest);
   void __fastcall InitControls();
+  bool IsDefaultSftpServer();
 
 private:
   int NoUpdate;