SiteAdvanced.cpp 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. //---------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <StrUtils.hpp>
  5. #include <CoreMain.h>
  6. #include <Common.h>
  7. #include <TextsWin.h>
  8. #include <TextsCore.h>
  9. #include <HelpWin.h>
  10. #include <VCLCommon.h>
  11. #include "WinInterface.h"
  12. #include "SiteAdvanced.h"
  13. #include "GUITools.h"
  14. #include "Tools.h"
  15. #include "WinConfiguration.h"
  16. #include "PuttyTools.h"
  17. //---------------------------------------------------------------------
  18. #pragma link "ComboEdit"
  19. #pragma link "PasswordEdit"
  20. #pragma link "UpDownEdit"
  21. #ifndef NO_RESOURCES
  22. #pragma resource "*.dfm"
  23. #endif
  24. //---------------------------------------------------------------------------
  25. // Sheet tag:
  26. // 01 top, 02 indented
  27. //---------------------------------------------------------------------------
  28. bool __fastcall DoSiteAdvancedDialog(TSessionData * SessionData)
  29. {
  30. TSiteAdvancedDialog * SiteAdvancedDialog = new TSiteAdvancedDialog(Application);
  31. bool Result;
  32. try
  33. {
  34. Result = SiteAdvancedDialog->Execute(SessionData);
  35. }
  36. __finally
  37. {
  38. delete SiteAdvancedDialog;
  39. }
  40. return Result;
  41. }
  42. //---------------------------------------------------------------------
  43. static const UnicodeString DefaultRecycleBinPath = L"/tmp";
  44. //---------------------------------------------------------------------
  45. __fastcall TSiteAdvancedDialog::TSiteAdvancedDialog(TComponent * AOwner) :
  46. TForm(AOwner)
  47. {
  48. NoUpdate = 0;
  49. // we need to make sure that window procedure is set asap
  50. // (so that CM_SHOWINGCHANGED handling is applied)
  51. UseSystemSettings(this);
  52. InitControls();
  53. PageControl->ActivePage = EnvironmentSheet;
  54. }
  55. //---------------------------------------------------------------------
  56. void __fastcall TSiteAdvancedDialog::InitControls()
  57. {
  58. ComboAutoSwitchInitialize(UtfCombo);
  59. ComboAutoSwitchInitialize(BugIgnore1Combo);
  60. ComboAutoSwitchInitialize(BugPlainPW1Combo);
  61. ComboAutoSwitchInitialize(BugRSA1Combo);
  62. ComboAutoSwitchInitialize(BugHMAC2Combo);
  63. ComboAutoSwitchInitialize(BugDeriveKey2Combo);
  64. ComboAutoSwitchInitialize(BugRSAPad2Combo);
  65. ComboAutoSwitchInitialize(BugPKSessID2Combo);
  66. ComboAutoSwitchInitialize(BugRekey2Combo);
  67. ComboAutoSwitchInitialize(BugMaxPkt2Combo);
  68. ComboAutoSwitchInitialize(BugIgnore2Combo);
  69. ComboAutoSwitchInitialize(BugWinAdjCombo);
  70. ComboAutoSwitchInitialize(SFTPBugSymlinkCombo);
  71. ComboAutoSwitchInitialize(SFTPBugSignedTSCombo);
  72. ComboAutoSwitchInitialize(FtpListAllCombo);
  73. ComboAutoSwitchInitialize(FtpUseMlsdCombo);
  74. ComboAutoSwitchInitialize(FtpForcePasvIpCombo);
  75. ComboAutoSwitchInitialize(FtpHostCombo);
  76. TunnelLocalPortNumberEdit->Items->BeginUpdate();
  77. try
  78. {
  79. UnicodeString TunnelLocalPortNumberAutoassign = TunnelLocalPortNumberEdit->Items->Strings[0];
  80. TunnelLocalPortNumberEdit->Items->Clear();
  81. TunnelLocalPortNumberEdit->Items->Add(TunnelLocalPortNumberAutoassign);
  82. for (int Index = Configuration->TunnelLocalPortNumberLow;
  83. Index <= Configuration->TunnelLocalPortNumberHigh; Index++)
  84. {
  85. TunnelLocalPortNumberEdit->Items->Add(IntToStr(Index));
  86. }
  87. }
  88. __finally
  89. {
  90. TunnelLocalPortNumberEdit->Items->EndUpdate();
  91. }
  92. HintLabel(ProxyTelnetCommandHintText, LoadStr(LOGIN_PROXY_COMMAND_PATTERNS_HINT));
  93. HintLabel(ProxyLocalCommandHintText, LoadStr(LOGIN_PROXY_COMMAND_PATTERNS_HINT));
  94. UpdateNavigationTree();
  95. SelectScaledImageList(ColorImageList);
  96. SetSessionColor((TColor)0);
  97. }
  98. //---------------------------------------------------------------------
  99. void __fastcall TSiteAdvancedDialog::LoadSession()
  100. {
  101. {
  102. TAutoNestingCounter NoUpdateCounter(NoUpdate);
  103. // Directories page
  104. SynchronizeBrowsingCheck->Checked = FSessionData->SynchronizeBrowsing;
  105. LocalDirectoryEdit->Text = FSessionData->LocalDirectory;
  106. RemoteDirectoryEdit->Text = FSessionData->RemoteDirectory;
  107. UpdateDirectoriesCheck->Checked = FSessionData->UpdateDirectories;
  108. CacheDirectoriesCheck->Checked = FSessionData->CacheDirectories;
  109. CacheDirectoryChangesCheck->Checked = FSessionData->CacheDirectoryChanges;
  110. PreserveDirectoryChangesCheck->Checked = FSessionData->PreserveDirectoryChanges;
  111. ResolveSymlinksCheck->Checked = FSessionData->ResolveSymlinks;
  112. FollowDirectorySymlinksCheck->Checked = FSessionData->FollowDirectorySymlinks;
  113. // Environment page
  114. switch (FSessionData->DSTMode)
  115. {
  116. case dstmWin:
  117. DSTModeWinCheck->Checked = true;
  118. break;
  119. case dstmKeep:
  120. DSTModeKeepCheck->Checked = true;
  121. break;
  122. default:
  123. case dstmUnix:
  124. DSTModeUnixCheck->Checked = true;
  125. break;
  126. }
  127. if (FSessionData->EOLType == eolLF)
  128. {
  129. EOLTypeCombo->ItemIndex = 0;
  130. }
  131. else
  132. {
  133. EOLTypeCombo->ItemIndex = 1;
  134. }
  135. switch (FSessionData->NotUtf)
  136. {
  137. case asOn:
  138. UtfCombo->ItemIndex = 1;
  139. break;
  140. case asOff:
  141. UtfCombo->ItemIndex = 2;
  142. break;
  143. default:
  144. UtfCombo->ItemIndex = 0;
  145. break;
  146. }
  147. int TimeDifferenceMin = TimeToMinutes(FSessionData->TimeDifference);
  148. TimeDifferenceEdit->AsInteger = TimeDifferenceMin / MinsPerHour;
  149. TimeDifferenceMinutesEdit->AsInteger = TimeDifferenceMin % MinsPerHour;
  150. TimeDifferenceAutoCheck->Checked = FSessionData->TimeDifferenceAuto;
  151. TrimVMSVersionsCheck->Checked = FSessionData->TrimVMSVersions;
  152. // Environment/Recycle bin page
  153. DeleteToRecycleBinCheck->Checked = FSessionData->DeleteToRecycleBin;
  154. OverwrittenToRecycleBinCheck->Checked = FSessionData->OverwrittenToRecycleBin;
  155. RecycleBinPathEdit->Text =
  156. !FSessionData->RecycleBinPath.IsEmpty() ?
  157. FSessionData->RecycleBinPath : DefaultRecycleBinPath;
  158. // SFTP page
  159. if (FSessionData->SftpServer.IsEmpty())
  160. {
  161. SftpServerEdit->Text = SftpServerEdit->Items->Strings[0];
  162. }
  163. else
  164. {
  165. SftpServerEdit->Text = FSessionData->SftpServer;
  166. }
  167. // hide selection, which is wrongly shown initially even when the box has not focus
  168. SftpServerEdit->SelLength = 0;
  169. AllowScpFallbackCheck->Checked = (FSessionData->FSProtocol == fsSFTP);
  170. SFTPMaxVersionCombo->ItemIndex = FSessionData->SFTPMaxVersion;
  171. #define LOAD_SFTP_BUG_COMBO(BUG) \
  172. ComboAutoSwitchLoad(SFTPBug ## BUG ## Combo, FSessionData->SFTPBug[sb ## BUG])
  173. LOAD_SFTP_BUG_COMBO(Symlink);
  174. LOAD_SFTP_BUG_COMBO(SignedTS);
  175. #undef LOAD_SFTP_BUG_COMBO
  176. // FTP page
  177. FtpAccountEdit->Text = FSessionData->FtpAccount;
  178. PostLoginCommandsMemo->Lines->Text = FSessionData->PostLoginCommands;
  179. ComboAutoSwitchLoad(FtpListAllCombo, FSessionData->FtpListAll);
  180. ComboAutoSwitchLoad(FtpUseMlsdCombo, FSessionData->FtpUseMlsd);
  181. ComboAutoSwitchLoad(FtpForcePasvIpCombo, FSessionData->FtpForcePasvIp);
  182. ComboAutoSwitchLoad(FtpHostCombo, FSessionData->FtpHost);
  183. // Authentication page
  184. SshNoUserAuthCheck->Checked = FSessionData->SshNoUserAuth;
  185. TryAgentCheck->Checked = FSessionData->TryAgent;
  186. AuthTISCheck->Checked = FSessionData->AuthTIS;
  187. AuthKICheck->Checked = FSessionData->AuthKI;
  188. AuthKIPasswordCheck->Checked = FSessionData->AuthKIPassword;
  189. AuthGSSAPICheck3->Checked = FSessionData->AuthGSSAPI;
  190. GSSAPIFwdTGTCheck->Checked = FSessionData->GSSAPIFwdTGT;
  191. AgentFwdCheck->Checked = FSessionData->AgentFwd;
  192. PrivateKeyEdit3->Text = FSessionData->PublicKeyFile;
  193. // SSH page
  194. Ssh2LegacyDESCheck->Checked = FSessionData->Ssh2DES;
  195. CompressionCheck->Checked = FSessionData->Compression;
  196. if (FSessionData->SshProt == ssh1only)
  197. {
  198. SshProtCombo2->ItemIndex = 0;
  199. }
  200. else
  201. {
  202. SshProtCombo2->ItemIndex = 1;
  203. }
  204. CipherListBox->Items->Clear();
  205. DebugAssert(CIPHER_NAME_WARN+CIPHER_COUNT-1 == CIPHER_NAME_CHACHA20);
  206. for (int Index = 0; Index < CIPHER_COUNT; Index++)
  207. {
  208. CipherListBox->Items->AddObject(
  209. LoadStr(CIPHER_NAME_WARN+FSessionData->Cipher[Index]),
  210. (TObject*)FSessionData->Cipher[Index]);
  211. }
  212. // KEX page
  213. KexListBox->Items->Clear();
  214. DebugAssert(KEX_NAME_WARN+KEX_COUNT-1 == KEX_NAME_ECDH);
  215. for (int Index = 0; Index < KEX_COUNT; Index++)
  216. {
  217. KexListBox->Items->AddObject(
  218. LoadStr(KEX_NAME_WARN+FSessionData->Kex[Index]),
  219. (TObject*)FSessionData->Kex[Index]);
  220. }
  221. RekeyTimeEdit->AsInteger = FSessionData->RekeyTime;
  222. RekeyDataEdit->Text = FSessionData->RekeyData;
  223. // Connection page
  224. FtpPasvModeCheck->Checked = FSessionData->FtpPasvMode;
  225. BufferSizeCheck->Checked = (FSessionData->SendBuf > 0) && FSessionData->SshSimple;
  226. switch (FSessionData->PingType)
  227. {
  228. case ptNullPacket:
  229. PingNullPacketButton->Checked = true;
  230. break;
  231. case ptDummyCommand:
  232. PingDummyCommandButton->Checked = true;
  233. break;
  234. default:
  235. PingOffButton->Checked = true;
  236. break;
  237. }
  238. PingIntervalSecEdit->AsInteger = FSessionData->PingInterval;
  239. switch (FSessionData->FtpPingType)
  240. {
  241. case ptDummyCommand:
  242. FtpPingDummyCommandButton->Checked = true;
  243. break;
  244. default:
  245. FtpPingOffButton->Checked = true;
  246. break;
  247. }
  248. FtpPingIntervalSecEdit->AsInteger = FSessionData->FtpPingInterval;
  249. TimeoutEdit->AsInteger = FSessionData->Timeout;
  250. switch (FSessionData->AddressFamily)
  251. {
  252. case afIPv4:
  253. IPv4Button->Checked = true;
  254. break;
  255. case afIPv6:
  256. IPv6Button->Checked = true;
  257. break;
  258. case afAuto:
  259. default:
  260. IPAutoButton->Checked = true;
  261. break;
  262. }
  263. // Shell page
  264. if (FSessionData->DefaultShell)
  265. {
  266. ShellEdit->Text = ShellEdit->Items->Strings[0];
  267. }
  268. else
  269. {
  270. ShellEdit->Text = FSessionData->Shell;
  271. }
  272. // hide selection, which is wrongly shown initially even when the box has not focus
  273. ShellEdit->SelLength = 0;
  274. if (FSessionData->DetectReturnVar)
  275. {
  276. ReturnVarEdit->Text = ReturnVarEdit->Items->Strings[0];
  277. }
  278. else
  279. {
  280. ReturnVarEdit->Text = FSessionData->ReturnVar;
  281. }
  282. ReturnVarEdit->SelLength = 0;
  283. ListingCommandEdit->Text = FSessionData->ListingCommand;
  284. ListingCommandEdit->SelLength = 0;
  285. CheckBoxAutoSwitchLoad(LookupUserGroupsCheck, FSessionData->LookupUserGroups);
  286. ClearAliasesCheck->Checked = FSessionData->ClearAliases;
  287. IgnoreLsWarningsCheck->Checked = FSessionData->IgnoreLsWarnings;
  288. Scp1CompatibilityCheck->Checked = FSessionData->Scp1Compatibility;
  289. UnsetNationalVarsCheck->Checked = FSessionData->UnsetNationalVars;
  290. SCPLsFullTimeAutoCheck->Checked = (FSessionData->SCPLsFullTime != asOff);
  291. // Proxy page
  292. SshProxyMethodCombo->ItemIndex = FSessionData->ProxyMethod;
  293. FtpProxyMethodCombo->ItemIndex = GetSupportedFtpProxyMethod(FSessionData->ProxyMethod);
  294. if (FSessionData->FtpProxyLogonType != 0)
  295. {
  296. FtpProxyMethodCombo->ItemIndex = LastSupportedFtpProxyMethod() + FSessionData->FtpProxyLogonType;
  297. }
  298. NeonProxyMethodCombo->ItemIndex = GetSupportedNeonProxyMethod(FSessionData->ProxyMethod);
  299. ProxyHostEdit->Text = FSessionData->ProxyHost;
  300. ProxyPortEdit->AsInteger = FSessionData->ProxyPort;
  301. ProxyUsernameEdit->Text = FSessionData->ProxyUsername;
  302. ProxyPasswordEdit->Text = FSessionData->ProxyPassword;
  303. ProxyTelnetCommandEdit->Text = FSessionData->ProxyTelnetCommand;
  304. ProxyLocalCommandEdit->Text = FSessionData->ProxyLocalCommand;
  305. ProxyLocalhostCheck->Checked = FSessionData->ProxyLocalhost;
  306. ProxyDNSCombo->ItemIndex = 2 - FSessionData->ProxyDNS;
  307. // Bugs page
  308. #define LOAD_BUG_COMBO(BUG) \
  309. ComboAutoSwitchLoad(Bug ## BUG ## Combo, FSessionData->Bug[sb ## BUG])
  310. LOAD_BUG_COMBO(Ignore1);
  311. LOAD_BUG_COMBO(PlainPW1);
  312. LOAD_BUG_COMBO(RSA1);
  313. LOAD_BUG_COMBO(HMAC2);
  314. LOAD_BUG_COMBO(DeriveKey2);
  315. LOAD_BUG_COMBO(RSAPad2);
  316. LOAD_BUG_COMBO(PKSessID2);
  317. LOAD_BUG_COMBO(Rekey2);
  318. LOAD_BUG_COMBO(MaxPkt2);
  319. LOAD_BUG_COMBO(Ignore2);
  320. LOAD_BUG_COMBO(WinAdj);
  321. #undef LOAD_BUG_COMBO
  322. // Tunnel page
  323. TunnelCheck->Checked = FSessionData->Tunnel;
  324. TunnelUserNameEdit->Text = FSessionData->TunnelUserName;
  325. TunnelPortNumberEdit->AsInteger = FSessionData->TunnelPortNumber;
  326. TunnelHostNameEdit->Text = FSessionData->TunnelHostName;
  327. TunnelPasswordEdit->Text = FSessionData->TunnelPassword;
  328. TunnelPrivateKeyEdit3->Text = FSessionData->TunnelPublicKeyFile;
  329. if (FSessionData->TunnelAutoassignLocalPortNumber)
  330. {
  331. TunnelLocalPortNumberEdit->Text = TunnelLocalPortNumberEdit->Items->Strings[0];
  332. }
  333. else
  334. {
  335. TunnelLocalPortNumberEdit->Text = IntToStr(FSessionData->TunnelLocalPortNumber);
  336. }
  337. // hide selection, which is wrongly shown initially even when the box has not focus
  338. TunnelLocalPortNumberEdit->SelLength = 0;
  339. // connection/tls/ssl page
  340. MinTlsVersionCombo->ItemIndex = TlsVersionToIndex(FSessionData->MinTlsVersion);
  341. MaxTlsVersionCombo->ItemIndex = TlsVersionToIndex(FSessionData->MaxTlsVersion);
  342. SslSessionReuseCheck->Checked = FSessionData->SslSessionReuse;
  343. TlsCertificateFileEdit->Text = FSessionData->TlsCertificateFile;
  344. // Note page
  345. NoteMemo->Lines->Text = FSessionData->Note;
  346. // color
  347. SetSessionColor((TColor)FSessionData->Color);
  348. }
  349. UpdateControls();
  350. }
  351. //---------------------------------------------------------------------
  352. TSshProt __fastcall TSiteAdvancedDialog::GetSshProt()
  353. {
  354. return (SshProtCombo2->ItemIndex == 0) ? ssh1only : ssh2only;
  355. }
  356. //---------------------------------------------------------------------
  357. void __fastcall TSiteAdvancedDialog::SaveSession()
  358. {
  359. // SSH page
  360. FSessionData->Compression = CompressionCheck->Checked;
  361. FSessionData->Ssh2DES = Ssh2LegacyDESCheck->Checked;
  362. FSessionData->SshProt = GetSshProt();
  363. for (int Index = 0; Index < CIPHER_COUNT; Index++)
  364. {
  365. FSessionData->Cipher[Index] = (TCipher)CipherListBox->Items->Objects[Index];
  366. }
  367. // Kex page
  368. for (int Index = 0; Index < KEX_COUNT; Index++)
  369. {
  370. FSessionData->Kex[Index] = (TKex)KexListBox->Items->Objects[Index];
  371. }
  372. FSessionData->RekeyTime = RekeyTimeEdit->AsInteger;
  373. FSessionData->RekeyData = RekeyDataEdit->Text;
  374. // Authentication page
  375. FSessionData->SshNoUserAuth = SshNoUserAuthCheck->Checked;
  376. FSessionData->TryAgent = TryAgentCheck->Checked;
  377. FSessionData->AuthTIS = AuthTISCheck->Checked;
  378. FSessionData->AuthKI = AuthKICheck->Checked;
  379. FSessionData->AuthKIPassword = AuthKIPasswordCheck->Checked;
  380. FSessionData->AuthGSSAPI = AuthGSSAPICheck3->Checked;
  381. FSessionData->GSSAPIFwdTGT = GSSAPIFwdTGTCheck->Checked;
  382. FSessionData->AgentFwd = AgentFwdCheck->Checked;
  383. FSessionData->PublicKeyFile = PrivateKeyEdit3->Text;
  384. // Connection page
  385. FSessionData->FtpPasvMode = FtpPasvModeCheck->Checked;
  386. FSessionData->SendBuf = BufferSizeCheck->Checked ? DefaultSendBuf : 0;
  387. FSessionData->SshSimple = BufferSizeCheck->Checked;
  388. if (PingNullPacketButton->Checked)
  389. {
  390. FSessionData->PingType = ptNullPacket;
  391. }
  392. else if (PingDummyCommandButton->Checked)
  393. {
  394. FSessionData->PingType = ptDummyCommand;
  395. }
  396. else
  397. {
  398. FSessionData->PingType = ptOff;
  399. }
  400. FSessionData->PingInterval = PingIntervalSecEdit->AsInteger;
  401. FSessionData->FtpPingType = (FtpPingDummyCommandButton->Checked ? ptDummyCommand : ptOff);
  402. FSessionData->FtpPingInterval = FtpPingIntervalSecEdit->AsInteger;
  403. FSessionData->Timeout = TimeoutEdit->AsInteger;
  404. if (IPv4Button->Checked)
  405. {
  406. FSessionData->AddressFamily = afIPv4;
  407. }
  408. else if (IPv6Button->Checked)
  409. {
  410. FSessionData->AddressFamily = afIPv6;
  411. }
  412. else
  413. {
  414. FSessionData->AddressFamily = afAuto;
  415. }
  416. // Directories page
  417. FSessionData->SynchronizeBrowsing = SynchronizeBrowsingCheck->Checked;
  418. FSessionData->LocalDirectory = LocalDirectoryEdit->Text;
  419. FSessionData->RemoteDirectory = RemoteDirectoryEdit->Text;
  420. FSessionData->UpdateDirectories = UpdateDirectoriesCheck->Checked;
  421. FSessionData->CacheDirectories = CacheDirectoriesCheck->Checked;
  422. FSessionData->CacheDirectoryChanges = CacheDirectoryChangesCheck->Checked;
  423. FSessionData->PreserveDirectoryChanges = PreserveDirectoryChangesCheck->Checked;
  424. FSessionData->ResolveSymlinks = ResolveSymlinksCheck->Checked;
  425. FSessionData->FollowDirectorySymlinks = FollowDirectorySymlinksCheck->Checked;
  426. // Environment page
  427. if (DSTModeUnixCheck->Checked)
  428. {
  429. FSessionData->DSTMode = dstmUnix;
  430. }
  431. else if (DSTModeKeepCheck->Checked)
  432. {
  433. FSessionData->DSTMode = dstmKeep;
  434. }
  435. else
  436. {
  437. FSessionData->DSTMode = dstmWin;
  438. }
  439. if (EOLTypeCombo->ItemIndex == 0)
  440. {
  441. FSessionData->EOLType = eolLF;
  442. }
  443. else
  444. {
  445. FSessionData->EOLType = eolCRLF;
  446. }
  447. switch (UtfCombo->ItemIndex)
  448. {
  449. case 1:
  450. FSessionData->NotUtf = asOn;
  451. break;
  452. case 2:
  453. FSessionData->NotUtf = asOff;
  454. break;
  455. default:
  456. FSessionData->NotUtf = asAuto;
  457. break;
  458. }
  459. FSessionData->TimeDifference =
  460. (double(TimeDifferenceEdit->AsInteger) / HoursPerDay) +
  461. (double(TimeDifferenceMinutesEdit->AsInteger) / MinsPerDay);
  462. FSessionData->TimeDifferenceAuto = TimeDifferenceAutoCheck->Checked;
  463. FSessionData->TrimVMSVersions = TrimVMSVersionsCheck->Checked;
  464. // Environment/Recycle bin page
  465. FSessionData->DeleteToRecycleBin = DeleteToRecycleBinCheck->Checked;
  466. FSessionData->OverwrittenToRecycleBin = OverwrittenToRecycleBinCheck->Checked;
  467. FSessionData->RecycleBinPath =
  468. FSessionData->DeleteToRecycleBin || FSessionData->OverwrittenToRecycleBin ||
  469. (RecycleBinPathEdit->Text != DefaultRecycleBinPath) ?
  470. RecycleBinPathEdit->Text : UnicodeString();
  471. // SCP page
  472. FSessionData->DefaultShell = (ShellEdit->Text == ShellEdit->Items->Strings[0]);
  473. FSessionData->Shell = (FSessionData->DefaultShell ? UnicodeString() : ShellEdit->Text);
  474. FSessionData->DetectReturnVar = (ReturnVarEdit->Text == ReturnVarEdit->Items->Strings[0]);
  475. FSessionData->ReturnVar = (FSessionData->DetectReturnVar ? UnicodeString() : ReturnVarEdit->Text);
  476. FSessionData->ListingCommand = ListingCommandEdit->Text;
  477. FSessionData->LookupUserGroups = CheckBoxAutoSwitchSave(LookupUserGroupsCheck);
  478. FSessionData->ClearAliases = ClearAliasesCheck->Checked;
  479. FSessionData->IgnoreLsWarnings = IgnoreLsWarningsCheck->Checked;
  480. FSessionData->Scp1Compatibility = Scp1CompatibilityCheck->Checked;
  481. FSessionData->UnsetNationalVars = UnsetNationalVarsCheck->Checked;
  482. FSessionData->SCPLsFullTime = SCPLsFullTimeAutoCheck->Checked ? asAuto : asOff;
  483. // SFTP page
  484. FSessionData->SftpServer =
  485. ((SftpServerEdit->Text == SftpServerEdit->Items->Strings[0]) ?
  486. UnicodeString() : SftpServerEdit->Text);
  487. FSessionData->SFTPMaxVersion = SFTPMaxVersionCombo->ItemIndex;
  488. if (AllowScpFallbackCheck->Checked != (FSessionData->FSProtocol == fsSFTP))
  489. {
  490. if (AllowScpFallbackCheck->Checked)
  491. {
  492. DebugAssert(FSessionData->FSProtocol == fsSFTPonly);
  493. FSessionData->FSProtocol = fsSFTP;
  494. }
  495. else
  496. {
  497. DebugAssert(FSessionData->FSProtocol == fsSFTP);
  498. FSessionData->FSProtocol = fsSFTPonly;
  499. }
  500. }
  501. #define SAVE_SFTP_BUG_COMBO(BUG) FSessionData->SFTPBug[sb ## BUG] = ComboAutoSwitchSave(SFTPBug ## BUG ## Combo);
  502. SAVE_SFTP_BUG_COMBO(Symlink);
  503. SAVE_SFTP_BUG_COMBO(SignedTS);
  504. #undef SAVE_SFTP_BUG_COMBO
  505. // FTP page
  506. FSessionData->FtpAccount = FtpAccountEdit->Text;
  507. FSessionData->PostLoginCommands = PostLoginCommandsMemo->Lines->Text;
  508. FSessionData->FtpListAll = ComboAutoSwitchSave(FtpListAllCombo);
  509. FSessionData->FtpUseMlsd = ComboAutoSwitchSave(FtpUseMlsdCombo);
  510. FSessionData->FtpForcePasvIp = ComboAutoSwitchSave(FtpForcePasvIpCombo);
  511. FSessionData->FtpHost = ComboAutoSwitchSave(FtpHostCombo);
  512. // Proxy page
  513. FSessionData->ProxyMethod = GetProxyMethod();
  514. FSessionData->FtpProxyLogonType = GetFtpProxyLogonType();
  515. FSessionData->ProxyHost = ProxyHostEdit->Text;
  516. FSessionData->ProxyPort = ProxyPortEdit->AsInteger;
  517. FSessionData->ProxyUsername = ProxyUsernameEdit->Text;
  518. FSessionData->ProxyPassword = ProxyPasswordEdit->Text;
  519. FSessionData->ProxyTelnetCommand = ProxyTelnetCommandEdit->Text;
  520. FSessionData->ProxyLocalCommand = ProxyLocalCommandEdit->Text;
  521. FSessionData->ProxyLocalhost = ProxyLocalhostCheck->Checked;
  522. FSessionData->ProxyDNS = (TAutoSwitch)(2 - ProxyDNSCombo->ItemIndex);
  523. // Bugs page
  524. #define SAVE_BUG_COMBO(BUG) FSessionData->Bug[sb ## BUG] = ComboAutoSwitchSave(Bug ## BUG ## Combo)
  525. SAVE_BUG_COMBO(Ignore1);
  526. SAVE_BUG_COMBO(PlainPW1);
  527. SAVE_BUG_COMBO(RSA1);
  528. SAVE_BUG_COMBO(HMAC2);
  529. SAVE_BUG_COMBO(DeriveKey2);
  530. SAVE_BUG_COMBO(RSAPad2);
  531. SAVE_BUG_COMBO(PKSessID2);
  532. SAVE_BUG_COMBO(Rekey2);
  533. SAVE_BUG_COMBO(MaxPkt2);
  534. SAVE_BUG_COMBO(Ignore2);
  535. SAVE_BUG_COMBO(WinAdj);
  536. #undef SAVE_BUG_COMBO
  537. // Tunnel page
  538. FSessionData->Tunnel = TunnelCheck->Checked;
  539. FSessionData->TunnelUserName = TunnelUserNameEdit->Text;
  540. FSessionData->TunnelPortNumber = TunnelPortNumberEdit->AsInteger;
  541. FSessionData->TunnelHostName = TunnelHostNameEdit->Text;
  542. FSessionData->TunnelPassword = TunnelPasswordEdit->Text;
  543. FSessionData->TunnelPublicKeyFile = TunnelPrivateKeyEdit3->Text;
  544. if (TunnelLocalPortNumberEdit->Text == TunnelLocalPortNumberEdit->Items->Strings[0])
  545. {
  546. FSessionData->TunnelLocalPortNumber = 0;
  547. }
  548. else
  549. {
  550. FSessionData->TunnelLocalPortNumber = StrToIntDef(TunnelLocalPortNumberEdit->Text, 0);
  551. }
  552. // connection/tls/ssl page
  553. FSessionData->MinTlsVersion = IndexToTlsVersion(MinTlsVersionCombo->ItemIndex);
  554. FSessionData->MaxTlsVersion = IndexToTlsVersion(MaxTlsVersionCombo->ItemIndex);
  555. FSessionData->SslSessionReuse = SslSessionReuseCheck->Checked;
  556. FSessionData->TlsCertificateFile = TlsCertificateFileEdit->Text;
  557. // Note page
  558. FSessionData->Note = NoteMemo->Lines->Text;
  559. // color
  560. FSessionData->Color = FColor;
  561. }
  562. //---------------------------------------------------------------------
  563. void __fastcall TSiteAdvancedDialog::UpdateNavigationTree()
  564. {
  565. TTreeNode * ActiveNode = NULL;
  566. {
  567. TAutoNestingCounter NoUpdateCounter(NoUpdate);
  568. int Index = 0;
  569. TTreeNode * PrevNode = NULL;
  570. while (Index < PageControl->PageCount)
  571. {
  572. TTabSheet * Tab = PageControl->Pages[Index];
  573. if (Tab->Enabled)
  574. {
  575. bool Indented = ((Tab->Tag % 100) == 2);
  576. UnicodeString Label = Tab->Caption;
  577. TTreeNode * Node;
  578. if (PrevNode == NULL)
  579. {
  580. DebugAssert(!Indented);
  581. Node = NavigationTree->Items->GetFirstNode();
  582. }
  583. else
  584. {
  585. if (Indented)
  586. {
  587. if (PrevNode->Level == 0)
  588. {
  589. Node = PrevNode->getFirstChild();
  590. if (Node == NULL)
  591. {
  592. Node = NavigationTree->Items->AddChild(PrevNode, Label);
  593. }
  594. }
  595. else
  596. {
  597. Node = PrevNode->getNextSibling();
  598. if (Node == NULL)
  599. {
  600. Node = NavigationTree->Items->Add(PrevNode, Label);
  601. }
  602. }
  603. }
  604. else
  605. {
  606. if (PrevNode->Level == 0)
  607. {
  608. // delete all excess children of previous top level node
  609. while ((Node = PrevNode->GetNext()) != PrevNode->getNextSibling())
  610. {
  611. Node->Delete();
  612. }
  613. Node = PrevNode->getNextSibling();
  614. if (Node == NULL)
  615. {
  616. Node = NavigationTree->Items->Add(PrevNode, Label);
  617. }
  618. }
  619. else
  620. {
  621. // delete all excess children of previous top level node
  622. while ((Node = PrevNode->getNextSibling()) != NULL)
  623. {
  624. Node->Delete();
  625. }
  626. Node = PrevNode->GetNext();
  627. if (Node == NULL)
  628. {
  629. Node = NavigationTree->Items->Add(NULL, Label);
  630. }
  631. }
  632. }
  633. }
  634. Node->Text = Label;
  635. Node->SelectedIndex = reinterpret_cast<int>(Tab);
  636. PrevNode = Node;
  637. if (PageControl->ActivePage == Tab)
  638. {
  639. Node->Selected = true;
  640. ActiveNode = Node;
  641. }
  642. }
  643. Index++;
  644. }
  645. TTreeNode * Node;
  646. while ((Node = PrevNode->GetNext()) != NULL)
  647. {
  648. Node->Delete();
  649. }
  650. NavigationTree->FullExpand();
  651. }
  652. // node of active page was hidden
  653. if (ActiveNode == NULL)
  654. {
  655. ChangePage(EnvironmentSheet);
  656. }
  657. }
  658. //---------------------------------------------------------------------
  659. void __fastcall TSiteAdvancedDialog::UpdateControls()
  660. {
  661. if (Visible)
  662. {
  663. TAutoNestingCounter NoUpdateCounter(NoUpdate);
  664. bool SshProtocol = FSessionData->UsesSsh;
  665. bool SftpProtocol =
  666. (FSessionData->FSProtocol == fsSFTPonly) || (FSessionData->FSProtocol == fsSFTP);
  667. bool ScpProtocol = (FSessionData->FSProtocol == fsSCPonly);
  668. bool FtpProtocol = (FSessionData->FSProtocol == fsFTP);
  669. bool WebDavProtocol = (FSessionData->FSProtocol == fsWebDAV);
  670. bool S3Protocol = (FSessionData->FSProtocol == fsS3);
  671. bool Neon = IsNeon(FSessionData->FSProtocol);
  672. bool Ssl = (FtpProtocol || WebDavProtocol || S3Protocol) && (FSessionData->Ftps != ftpsNone);
  673. // connection sheet
  674. EnableControl(FtpPasvModeCheck, FtpProtocol);
  675. if (FtpProtocol &&
  676. (FtpProxyMethodCombo->ItemIndex != ::pmNone) &&
  677. SupportedFtpProxyMethod(FtpProxyMethodCombo->ItemIndex) &&
  678. !FtpPasvModeCheck->Checked)
  679. {
  680. FtpPasvModeCheck->Checked = true;
  681. MessageDialog(MainInstructions(LoadStr(FTP_PASV_MODE_REQUIRED)), qtInformation, qaOK);
  682. }
  683. EnableControl(BufferSizeCheck, SshProtocol);
  684. PingGroup->Visible = !FtpProtocol;
  685. EnableControl(PingGroup, SshProtocol);
  686. EnableControl(PingIntervalSecEdit, PingGroup->Enabled && !PingOffButton->Checked);
  687. EnableControl(PingIntervalLabel, PingGroup->Enabled && PingIntervalSecEdit->Enabled);
  688. FtpPingGroup->Visible = FtpProtocol;
  689. EnableControl(FtpPingIntervalSecEdit, !FtpPingOffButton->Checked);
  690. EnableControl(FtpPingIntervalLabel, FtpPingIntervalSecEdit->Enabled);
  691. EnableControl(IPvGroup, SshProtocol || FtpProtocol);
  692. EnableControl(IPAutoButton, IPvGroup->Enabled && SshProtocol);
  693. // ssh/authentication sheet
  694. AuthSheet->Enabled = SshProtocol;
  695. EnableControl(SshNoUserAuthCheck, (GetSshProt() == ssh2only));
  696. EnableControl(AuthenticationGroup,
  697. !SshNoUserAuthCheck->Enabled || !SshNoUserAuthCheck->Checked);
  698. EnableControl(AuthTISCheck, AuthenticationGroup->Enabled && (GetSshProt() == ssh1only));
  699. EnableControl(AuthKICheck, AuthenticationGroup->Enabled && (GetSshProt() == ssh2only));
  700. EnableControl(AuthKIPasswordCheck,
  701. AuthenticationGroup->Enabled &&
  702. ((AuthTISCheck->Enabled && AuthTISCheck->Checked) ||
  703. (AuthKICheck->Enabled && AuthKICheck->Checked)));
  704. EnableControl(AuthenticationParamsGroup, AuthenticationGroup->Enabled);
  705. EnableControl(AuthGSSAPICheck3,
  706. AuthenticationGroup->Enabled && (GetSshProt() == ssh2only));
  707. EnableControl(GSSAPIFwdTGTCheck,
  708. AuthGSSAPICheck3->Enabled && AuthGSSAPICheck3->Checked);
  709. // ssh sheet
  710. AdvancedSheet->Enabled = SshProtocol;
  711. EnableControl(CipherUpButton, CipherListBox->ItemIndex > 0);
  712. EnableControl(CipherDownButton, CipherListBox->ItemIndex >= 0 &&
  713. CipherListBox->ItemIndex < CipherListBox->Items->Count-1);
  714. EnableControl(Ssh2LegacyDESCheck, (GetSshProt() == ssh2only));
  715. // ssh/kex sheet
  716. KexSheet->Enabled = SshProtocol && (GetSshProt() == ssh2only) &&
  717. (BugRekey2Combo->ItemIndex != 2);
  718. EnableControl(KexUpButton, KexListBox->ItemIndex > 0);
  719. EnableControl(KexDownButton, KexListBox->ItemIndex >= 0 &&
  720. KexListBox->ItemIndex < KexListBox->Items->Count-1);
  721. // ssh/bugs sheet
  722. BugsSheet->Enabled = SshProtocol;
  723. EnableControl(BugIgnore1Combo, (GetSshProt() == ssh1only));
  724. EnableControl(BugIgnore1Label, BugIgnore1Combo->Enabled);
  725. EnableControl(BugPlainPW1Combo, (GetSshProt() == ssh1only));
  726. EnableControl(BugPlainPW1Label, BugPlainPW1Combo->Enabled);
  727. EnableControl(BugRSA1Combo, (GetSshProt() == ssh1only));
  728. EnableControl(BugRSA1Label, BugRSA1Combo->Enabled);
  729. EnableControl(BugHMAC2Combo, (GetSshProt() == ssh2only));
  730. EnableControl(BugHMAC2Label, BugHMAC2Combo->Enabled);
  731. EnableControl(BugDeriveKey2Combo, (GetSshProt() == ssh2only));
  732. EnableControl(BugDeriveKey2Label, BugDeriveKey2Combo->Enabled);
  733. EnableControl(BugRSAPad2Combo, (GetSshProt() == ssh2only));
  734. EnableControl(BugRSAPad2Label, BugRSAPad2Combo->Enabled);
  735. EnableControl(BugPKSessID2Combo, (GetSshProt() == ssh2only));
  736. EnableControl(BugPKSessID2Label, BugPKSessID2Combo->Enabled);
  737. EnableControl(BugRekey2Combo, (GetSshProt() == ssh2only));
  738. EnableControl(BugRekey2Label, BugRekey2Combo->Enabled);
  739. EnableControl(BugMaxPkt2Combo, (GetSshProt() == ssh2only));
  740. EnableControl(BugMaxPkt2Label, BugMaxPkt2Combo->Enabled);
  741. EnableControl(BugIgnore2Combo, (GetSshProt() == ssh2only));
  742. EnableControl(BugIgnore2Label, BugIgnore2Combo->Enabled);
  743. EnableControl(BugWinAdjCombo, (GetSshProt() == ssh2only));
  744. EnableControl(BugWinAdjLabel, BugWinAdjCombo->Enabled);
  745. // connection/proxy sheet
  746. // this is probaqbly overkill, now we do not allow changing protocol on
  747. // the same window as changing proxy
  748. TComboBox * ProxyMethodCombo =
  749. (SshProtocol ? SshProxyMethodCombo : (FtpProtocol ? FtpProxyMethodCombo : NeonProxyMethodCombo));
  750. TProxyMethod ProxyMethod = GetProxyMethod();
  751. ProxyMethodCombo->Visible = true;
  752. ProxyMethodLabel->FocusControl = ProxyMethodCombo;
  753. if (!SshProtocol)
  754. {
  755. SshProxyMethodCombo->Visible = false;
  756. SshProxyMethodCombo->ItemIndex = ProxyMethod;
  757. }
  758. if (!FtpProtocol)
  759. {
  760. FtpProxyMethodCombo->Visible = false;
  761. FtpProxyMethodCombo->ItemIndex = GetSupportedFtpProxyMethod(ProxyMethod);
  762. }
  763. if (!Neon)
  764. {
  765. NeonProxyMethodCombo->Visible = false;
  766. NeonProxyMethodCombo->ItemIndex = GetSupportedNeonProxyMethod(ProxyMethod);
  767. }
  768. int FtpProxyLogonType = GetFtpProxyLogonType();
  769. UnicodeString ProxyCommand =
  770. ((ProxyMethod == pmCmd) ?
  771. ProxyLocalCommandEdit->Text : ProxyTelnetCommandEdit->Text);
  772. EnableControl(ProxyHostEdit,
  773. (ProxyMethod == pmSocks4) ||
  774. (ProxyMethod == pmSocks5) ||
  775. (ProxyMethod == pmHTTP) ||
  776. (ProxyMethod == pmTelnet) ||
  777. ((ProxyMethod == pmCmd) && AnsiContainsText(ProxyCommand, L"%proxyhost")) ||
  778. (FtpProxyLogonType > 0));
  779. EnableControl(ProxyHostLabel, ProxyHostEdit->Enabled);
  780. EnableControl(ProxyPortEdit,
  781. (ProxyMethod == pmSocks4) ||
  782. (ProxyMethod == pmSocks5) ||
  783. (ProxyMethod == pmHTTP) ||
  784. (ProxyMethod == pmTelnet) ||
  785. ((ProxyMethod == pmCmd) && AnsiContainsText(ProxyCommand, L"%proxyport")) ||
  786. (FtpProxyLogonType > 0));
  787. EnableControl(ProxyPortLabel, ProxyPortEdit->Enabled);
  788. EnableControl(ProxyUsernameEdit,
  789. // FZAPI does not support username for SOCKS4
  790. ((ProxyMethod == pmSocks4) && (SshProtocol || Neon)) ||
  791. (ProxyMethod == pmSocks5) ||
  792. (ProxyMethod == pmHTTP) ||
  793. (((ProxyMethod == pmTelnet) ||
  794. (ProxyMethod == pmCmd)) &&
  795. AnsiContainsText(ProxyCommand, L"%user")) ||
  796. ((FtpProxyLogonType > 0) && (FtpProxyLogonType != 3) && (FtpProxyLogonType != 5)));
  797. EnableControl(ProxyUsernameLabel, ProxyUsernameEdit->Enabled);
  798. EnableControl(ProxyPasswordEdit,
  799. (ProxyMethod == pmSocks5) ||
  800. (ProxyMethod == pmHTTP) ||
  801. (((ProxyMethod == pmTelnet) ||
  802. (ProxyMethod == pmCmd)) &&
  803. AnsiContainsText(ProxyCommand, L"%pass")) ||
  804. ((FtpProxyLogonType > 0) && (FtpProxyLogonType != 3) && (FtpProxyLogonType != 5)));
  805. EnableControl(ProxyPasswordLabel, ProxyPasswordEdit->Enabled);
  806. bool ProxySettings = (ProxyMethod != ::pmNone) && SshProtocol;
  807. ProxySettingsGroup->Visible = SshProtocol;
  808. EnableControl(ProxySettingsGroup, ProxySettings);
  809. EnableControl(ProxyTelnetCommandEdit,
  810. ProxySettings && (ProxyMethod == pmTelnet));
  811. EnableControl(ProxyTelnetCommandLabel, ProxyTelnetCommandEdit->Enabled);
  812. EnableControl(ProxyTelnetCommandHintText, ProxyTelnetCommandEdit->Enabled);
  813. ProxyLocalCommandEdit->Visible = (ProxyMethod == pmCmd);
  814. ProxyLocalCommandLabel->Visible = ProxyLocalCommandEdit->Visible;
  815. ProxyLocalCommandBrowseButton->Visible = ProxyLocalCommandEdit->Visible;
  816. ProxyLocalCommandHintText->Visible = ProxyLocalCommandEdit->Visible;
  817. ProxyTelnetCommandEdit->Visible = !ProxyLocalCommandEdit->Visible;
  818. ProxyTelnetCommandLabel->Visible = ProxyTelnetCommandEdit->Visible;
  819. ProxyTelnetCommandHintText->Visible = ProxyTelnetCommandEdit->Visible;
  820. // environment/directories sheet
  821. EnableControl(SynchronizeBrowsingCheck,
  822. (CustomWinConfiguration->Interface == ifCommander) &&
  823. WinConfiguration->PreservePanelState &&
  824. !WinConfiguration->ScpCommander.PreserveLocalDirectory);
  825. EnableControl(CacheDirectoryChangesCheck,
  826. (!ScpProtocol || CacheDirectoriesCheck->Checked) && DirectoriesSheet->Enabled);
  827. EnableControl(PreserveDirectoryChangesCheck,
  828. CacheDirectoryChangesCheck->Enabled && CacheDirectoryChangesCheck->Checked &&
  829. DirectoriesSheet->Enabled);
  830. EnableControl(ResolveSymlinksCheck, (SftpProtocol || ScpProtocol) && DirectoriesSheet->Enabled);
  831. EnableControl(FollowDirectorySymlinksCheck, (SftpProtocol || ScpProtocol || FtpProtocol));
  832. // environment sheet
  833. EnableControl(EOLTypeCombo, (SftpProtocol || ScpProtocol) && EnvironmentSheet->Enabled);
  834. EnableControl(EOLTypeLabel, EOLTypeCombo->Enabled);
  835. EnableControl(DSTModeGroup, (SftpProtocol || ScpProtocol) && EnvironmentSheet->Enabled);
  836. EnableControl(DSTModeKeepCheck, UsesDaylightHack() && DSTModeGroup->Enabled);
  837. EnableControl(UtfCombo, (SftpProtocol || FtpProtocol || ScpProtocol) && EnvironmentSheet->Enabled);
  838. EnableControl(UtfLabel, UtfCombo->Enabled);
  839. // should be enabled for fsSFTP (SCP fallback) too, but it would cause confusion
  840. bool FtpProtocolWithMlsdOff = FtpProtocol && (ComboAutoSwitchSave(FtpUseMlsdCombo) == asOff);
  841. EnableControl(TimeDifferenceAutoCheck, FtpProtocolWithMlsdOff);
  842. EnableControl(TimeDifferenceEdit,
  843. ((FtpProtocolWithMlsdOff && !TimeDifferenceAutoCheck->Checked) ||
  844. ScpProtocol) &&
  845. EnvironmentSheet->Enabled);
  846. EnableControl(TimeDifferenceLabel,
  847. TimeDifferenceEdit->Enabled || TimeDifferenceAutoCheck->Enabled);
  848. EnableControl(TimeDifferenceHoursLabel, TimeDifferenceEdit->Enabled);
  849. EnableControl(TimeDifferenceMinutesEdit, TimeDifferenceEdit->Enabled);
  850. EnableControl(TimeDifferenceMinutesLabel, TimeDifferenceEdit->Enabled);
  851. EnableControl(TrimVMSVersionsCheck, !S3Protocol);
  852. // environment/recycle bin sheet
  853. EnableControl(OverwrittenToRecycleBinCheck, SftpProtocol && RecycleBinSheet->Enabled);
  854. EnableControl(RecycleBinPathEdit,
  855. (DeleteToRecycleBinCheck->Enabled && DeleteToRecycleBinCheck->Checked) ||
  856. (OverwrittenToRecycleBinCheck->Enabled && OverwrittenToRecycleBinCheck->Checked) &&
  857. RecycleBinSheet->Enabled);
  858. EnableControl(RecycleBinPathLabel, RecycleBinPathEdit->Enabled &&
  859. RecycleBinSheet->Enabled);
  860. // environment/sftp sheet
  861. SftpSheet->Enabled = SftpProtocol;
  862. // environment/scp/shell
  863. ScpSheet->Enabled = SshProtocol;
  864. ScpSheet->Caption = LoadStr(ScpProtocol ? LOGIN_SCP_SHELL_PAGE : LOGIN_SHELL_PAGE);
  865. // hide also for SFTP with SCP fallback, as if someone wants to configure
  866. // these he/she probably intends to use SCP and should explicitly select it.
  867. // (note that these are not used for separate shell session)
  868. ScpLsOptionsGroup->Visible = ScpProtocol;
  869. OtherShellOptionsGroup->Visible = ScpProtocol;
  870. // environment/ftp
  871. FtpSheet->Enabled = FtpProtocol;
  872. EnableControl(FtpListAllCombo,
  873. (ComboAutoSwitchSave(FtpUseMlsdCombo) == asOff));
  874. EnableControl(FtpListAllLabel, FtpListAllCombo->Enabled);
  875. EnableControl(FtpForcePasvIpCombo,
  876. FtpPasvModeCheck->Checked &&
  877. (IPAutoButton->Checked || IPv4Button->Checked));
  878. EnableControl(FtpForcePasvIpLabel, FtpForcePasvIpCombo->Enabled);
  879. // tunnel sheet
  880. TunnelSheet->Enabled = SshProtocol;
  881. // probably needless
  882. EnableControl(TunnelSessionGroup, TunnelCheck->Enabled && TunnelCheck->Checked);
  883. EnableControl(TunnelOptionsGroup, TunnelSessionGroup->Enabled);
  884. EnableControl(TunnelAuthenticationParamsGroup, TunnelSessionGroup->Enabled);
  885. // connection/ssl/tls
  886. SslSheet->Enabled = Ssl;
  887. // TLS/SSL session reuse is not configurable for WebDAV/S3 yet
  888. SslSessionReuseCheck->Enabled = SslSheet->Enabled && FtpProtocol;
  889. UpdateNavigationTree();
  890. // color
  891. if (FColor == 0)
  892. {
  893. MenuButton(ColorButton);
  894. }
  895. else
  896. {
  897. ColorButton->Images = ColorImageList;
  898. ColorButton->ImageIndex = 1;
  899. ColorButton->ImageAlignment = iaRight;
  900. }
  901. }
  902. }
  903. //---------------------------------------------------------------------------
  904. void __fastcall TSiteAdvancedDialog::DataChange(TObject * /*Sender*/)
  905. {
  906. if (NoUpdate == 0)
  907. {
  908. UpdateControls();
  909. }
  910. }
  911. //---------------------------------------------------------------------------
  912. void __fastcall TSiteAdvancedDialog::FormShow(TObject * /*Sender*/)
  913. {
  914. InstallPathWordBreakProc(PrivateKeyEdit3);
  915. InstallPathWordBreakProc(TunnelPrivateKeyEdit3);
  916. InstallPathWordBreakProc(RemoteDirectoryEdit);
  917. InstallPathWordBreakProc(LocalDirectoryEdit);
  918. InstallPathWordBreakProc(RecycleBinPathEdit);
  919. InstallPathWordBreakProc(TlsCertificateFileEdit);
  920. InstallPathWordBreakProc(SftpServerEdit);
  921. InstallPathWordBreakProc(ShellEdit);
  922. ChangePage(EnvironmentSheet);
  923. UpdateControls();
  924. }
  925. //---------------------------------------------------------------------------
  926. bool __fastcall TSiteAdvancedDialog::Execute(TSessionData * SessionData)
  927. {
  928. FSessionData = SessionData;
  929. LoadSession();
  930. bool Result = (ShowModal() == DefaultResult(this));
  931. if (Result)
  932. {
  933. SaveSession();
  934. }
  935. return Result;
  936. }
  937. //---------------------------------------------------------------------------
  938. void __fastcall TSiteAdvancedDialog::NavigationTreeChange(TObject * /*Sender*/,
  939. TTreeNode * Node)
  940. {
  941. if (NoUpdate == 0)
  942. {
  943. TAutoNestingCounter Guard(NoUpdate);
  944. TTabSheet * Tab = reinterpret_cast<TTabSheet *>(Node->SelectedIndex);
  945. // should happen only while loading language
  946. // (UpdateNavigationTree may not be called yet)
  947. if (Tab != NULL)
  948. {
  949. PageControl->ActivePage = Tab;
  950. // reshow the accelerators, etc
  951. ResetSystemSettings(this);
  952. }
  953. UpdateControls();
  954. }
  955. }
  956. //---------------------------------------------------------------------------
  957. void __fastcall TSiteAdvancedDialog::ChangePage(TTabSheet * Tab)
  958. {
  959. PageControl->ActivePage = Tab;
  960. PageControlChange(PageControl);
  961. }
  962. //---------------------------------------------------------------------------
  963. void __fastcall TSiteAdvancedDialog::PageControlChange(TObject *Sender)
  964. {
  965. bool Found = false;
  966. if (PageControl->ActivePage)
  967. {
  968. for (int Index = 0; Index < NavigationTree->Items->Count; Index++)
  969. {
  970. if (NavigationTree->Items->Item[Index]->SelectedIndex ==
  971. reinterpret_cast<int>(PageControl->ActivePage))
  972. {
  973. NavigationTree->Items->Item[Index]->Selected = true;
  974. Found = true;
  975. }
  976. }
  977. }
  978. if (DebugAlwaysTrue(Found))
  979. {
  980. DataChange(Sender);
  981. }
  982. }
  983. //---------------------------------------------------------------------------
  984. void __fastcall TSiteAdvancedDialog::CMDialogKey(TWMKeyDown & Message)
  985. {
  986. if (Message.CharCode == VK_TAB)
  987. {
  988. TShiftState Shift = KeyDataToShiftState(Message.KeyData);
  989. if (Shift.Contains(ssCtrl))
  990. {
  991. TTreeNode * Node = NavigationTree->Selected;
  992. if (!Shift.Contains(ssShift))
  993. {
  994. Node = Node->GetNext();
  995. if (Node == NULL)
  996. {
  997. Node = NavigationTree->Items->GetFirstNode();
  998. }
  999. }
  1000. else
  1001. {
  1002. if (Node->GetPrev() != NULL)
  1003. {
  1004. Node = Node->GetPrev();
  1005. }
  1006. else
  1007. {
  1008. while (Node->GetNext() != NULL)
  1009. {
  1010. Node = Node->GetNext();
  1011. }
  1012. }
  1013. }
  1014. Node->Selected = True;
  1015. Message.Result = 1;
  1016. return;
  1017. }
  1018. }
  1019. TForm::Dispatch(&Message);
  1020. }
  1021. //---------------------------------------------------------------------------
  1022. void __fastcall TSiteAdvancedDialog::WMHelp(TWMHelp & Message)
  1023. {
  1024. DebugAssert(Message.HelpInfo != NULL);
  1025. if (Message.HelpInfo->iContextType == HELPINFO_WINDOW)
  1026. {
  1027. // invoke help for active page (not for whole form), regardless of focus
  1028. // (e.g. even if focus is on control outside pagecontrol)
  1029. Message.HelpInfo->hItemHandle = PageControl->ActivePage->Handle;
  1030. }
  1031. TForm::Dispatch(&Message);
  1032. }
  1033. //---------------------------------------------------------------------------
  1034. void __fastcall TSiteAdvancedDialog::Dispatch(void * Message)
  1035. {
  1036. TMessage * M = reinterpret_cast<TMessage*>(Message);
  1037. DebugAssert(M);
  1038. if (M->Msg == CM_DIALOGKEY)
  1039. {
  1040. CMDialogKey(*((TWMKeyDown *)Message));
  1041. }
  1042. else if (M->Msg == WM_HELP)
  1043. {
  1044. WMHelp(*((TWMHelp *)Message));
  1045. }
  1046. else
  1047. {
  1048. TForm::Dispatch(Message);
  1049. }
  1050. }
  1051. //---------------------------------------------------------------------------
  1052. void __fastcall TSiteAdvancedDialog::AlgListBoxStartDrag(TObject * Sender,
  1053. TDragObject *& /*DragObject*/)
  1054. {
  1055. FAlgDragSource = dynamic_cast<TListBox*>(Sender)->ItemIndex;
  1056. FAlgDragDest = -1;
  1057. }
  1058. //---------------------------------------------------------------------------
  1059. void __fastcall TSiteAdvancedDialog::AlgListBoxDragOver(TObject * Sender,
  1060. TObject * Source, int X, int Y, TDragState /*State*/, bool & Accept)
  1061. {
  1062. if (Source == Sender)
  1063. {
  1064. Accept = AllowAlgDrag(dynamic_cast<TListBox*>(Sender), X, Y);
  1065. }
  1066. else
  1067. {
  1068. Accept = false;
  1069. }
  1070. }
  1071. //---------------------------------------------------------------------------
  1072. void __fastcall TSiteAdvancedDialog::AlgListBoxDragDrop(TObject * Sender,
  1073. TObject * Source, int X, int Y)
  1074. {
  1075. if (Source == Sender)
  1076. {
  1077. TListBox * AlgListBox = dynamic_cast<TListBox*>(Sender);
  1078. if (AllowAlgDrag(AlgListBox, X, Y))
  1079. {
  1080. AlgMove(AlgListBox, FAlgDragSource, FAlgDragDest);
  1081. }
  1082. }
  1083. }
  1084. //---------------------------------------------------------------------------
  1085. void __fastcall TSiteAdvancedDialog::CipherButtonClick(TObject *Sender)
  1086. {
  1087. AlgMove(CipherListBox, CipherListBox->ItemIndex,
  1088. CipherListBox->ItemIndex + (Sender == CipherUpButton ? -1 : 1));
  1089. }
  1090. //---------------------------------------------------------------------------
  1091. void __fastcall TSiteAdvancedDialog::KexButtonClick(TObject *Sender)
  1092. {
  1093. AlgMove(KexListBox, KexListBox->ItemIndex,
  1094. KexListBox->ItemIndex + (Sender == KexUpButton ? -1 : 1));
  1095. }
  1096. //---------------------------------------------------------------------------
  1097. bool __fastcall TSiteAdvancedDialog::AllowAlgDrag(TListBox * AlgListBox, int X, int Y)
  1098. {
  1099. FAlgDragDest = AlgListBox->ItemAtPos(TPoint(X, Y), true);
  1100. return (FAlgDragDest >= 0) && (FAlgDragDest != FAlgDragSource);
  1101. }
  1102. //---------------------------------------------------------------------------
  1103. void __fastcall TSiteAdvancedDialog::AlgMove(TListBox * AlgListBox, int Source, int Dest)
  1104. {
  1105. if ((Source >= 0) && (Source < AlgListBox->Items->Count) &&
  1106. (Dest >= 0) && (Dest < AlgListBox->Items->Count))
  1107. {
  1108. AlgListBox->Items->Move(Source, Dest);
  1109. AlgListBox->ItemIndex = Dest;
  1110. AlgListBox->SetFocus();
  1111. }
  1112. UpdateControls();
  1113. }
  1114. //---------------------------------------------------------------------------
  1115. void __fastcall TSiteAdvancedDialog::AuthGSSAPICheck3Click(TObject * /*Sender*/)
  1116. {
  1117. if (NoUpdate == 0)
  1118. {
  1119. UpdateControls();
  1120. if (AuthGSSAPICheck3->Checked && !HasGSSAPI(L""))
  1121. {
  1122. throw Exception(LoadStr(GSSAPI_NOT_INSTALLED2));
  1123. }
  1124. }
  1125. }
  1126. //---------------------------------------------------------------------------
  1127. void __fastcall TSiteAdvancedDialog::HelpButtonClick(TObject * /*Sender*/)
  1128. {
  1129. FormHelp(this);
  1130. }
  1131. //---------------------------------------------------------------------------
  1132. void __fastcall TSiteAdvancedDialog::PrivateKeyEdit3AfterDialog(TObject * Sender,
  1133. UnicodeString & Name, bool & Action)
  1134. {
  1135. PathEditAfterDialog(Sender, Name, Action);
  1136. TFilenameEdit * Edit = dynamic_cast<TFilenameEdit *>(Sender);
  1137. if (Name != Edit->Text)
  1138. {
  1139. VerifyAndConvertKey(Name, GetSshProt());
  1140. }
  1141. }
  1142. //---------------------------------------------------------------------------
  1143. void __fastcall TSiteAdvancedDialog::FormCloseQuery(TObject * /*Sender*/,
  1144. bool & /*CanClose*/)
  1145. {
  1146. if (ModalResult == DefaultResult(this))
  1147. {
  1148. // StripPathQuotes should not be needed as we do not feed quotes anymore
  1149. VerifyKey(StripPathQuotes(PrivateKeyEdit3->Text), GetSshProt());
  1150. // for tunnel SSH version is not configurable
  1151. VerifyKey(StripPathQuotes(TunnelPrivateKeyEdit3->Text), ssh2only);
  1152. VerifyCertificate(StripPathQuotes(TlsCertificateFileEdit->Text));
  1153. }
  1154. }
  1155. //---------------------------------------------------------------------------
  1156. void __fastcall TSiteAdvancedDialog::PathEditBeforeDialog(TObject * /*Sender*/,
  1157. UnicodeString & Name, bool & /*Action*/)
  1158. {
  1159. FBeforeDialogPath = Name;
  1160. Name = ExpandEnvironmentVariables(Name);
  1161. }
  1162. //---------------------------------------------------------------------------
  1163. void __fastcall TSiteAdvancedDialog::PathEditAfterDialog(TObject * /*Sender*/,
  1164. UnicodeString & Name, bool & /*Action*/)
  1165. {
  1166. if (IsPathToSameFile(Name, ExpandEnvironmentVariables(FBeforeDialogPath)))
  1167. {
  1168. Name = FBeforeDialogPath;
  1169. }
  1170. }
  1171. //---------------------------------------------------------------------------
  1172. int __fastcall TSiteAdvancedDialog::LastSupportedFtpProxyMethod()
  1173. {
  1174. return pmHTTP;
  1175. }
  1176. //---------------------------------------------------------------------------
  1177. bool __fastcall TSiteAdvancedDialog::SupportedFtpProxyMethod(int Method)
  1178. {
  1179. return (Method >= 0) && (Method <= LastSupportedFtpProxyMethod());
  1180. }
  1181. //---------------------------------------------------------------------------
  1182. int __fastcall TSiteAdvancedDialog::GetSupportedFtpProxyMethod(int Method)
  1183. {
  1184. if (SupportedFtpProxyMethod(Method))
  1185. {
  1186. return Method;
  1187. }
  1188. else
  1189. {
  1190. return ::pmNone;
  1191. }
  1192. }
  1193. //---------------------------------------------------------------------------
  1194. int __fastcall TSiteAdvancedDialog::GetSupportedNeonProxyMethod(int Method)
  1195. {
  1196. if ((Method >= 0) && (Method <= pmHTTP))
  1197. {
  1198. return Method;
  1199. }
  1200. else
  1201. {
  1202. return ::pmNone;
  1203. }
  1204. }
  1205. //---------------------------------------------------------------------------
  1206. bool __fastcall TSiteAdvancedDialog::IsNeon(TFSProtocol FSProtocol)
  1207. {
  1208. return (FSProtocol == fsWebDAV) || (FSProtocol == fsS3);
  1209. }
  1210. //---------------------------------------------------------------------------
  1211. TProxyMethod __fastcall TSiteAdvancedDialog::GetProxyMethod()
  1212. {
  1213. TProxyMethod Result;
  1214. TFSProtocol FSProtocol = FSessionData->FSProtocol;
  1215. if (FSessionData->UsesSsh)
  1216. {
  1217. Result = (TProxyMethod)SshProxyMethodCombo->ItemIndex;
  1218. }
  1219. else if (FSProtocol == fsFTP)
  1220. {
  1221. if (SupportedFtpProxyMethod(FtpProxyMethodCombo->ItemIndex))
  1222. {
  1223. Result = (TProxyMethod)FtpProxyMethodCombo->ItemIndex;
  1224. }
  1225. else
  1226. {
  1227. Result = ::pmNone;
  1228. }
  1229. }
  1230. else if (IsNeon(FSProtocol))
  1231. {
  1232. Result = (TProxyMethod)NeonProxyMethodCombo->ItemIndex;
  1233. }
  1234. else
  1235. {
  1236. DebugFail();
  1237. Result = ::pmNone;
  1238. }
  1239. return Result;
  1240. }
  1241. //---------------------------------------------------------------------------
  1242. int __fastcall TSiteAdvancedDialog::GetFtpProxyLogonType()
  1243. {
  1244. int Result;
  1245. if (FSessionData->FSProtocol != fsFTP)
  1246. {
  1247. Result = 0;
  1248. }
  1249. else
  1250. {
  1251. if (SupportedFtpProxyMethod(FtpProxyMethodCombo->ItemIndex))
  1252. {
  1253. Result = 0;
  1254. }
  1255. else
  1256. {
  1257. Result = FtpProxyMethodCombo->ItemIndex - LastSupportedFtpProxyMethod();
  1258. }
  1259. }
  1260. return Result;
  1261. }
  1262. //---------------------------------------------------------------------------
  1263. void __fastcall TSiteAdvancedDialog::NavigationTreeCollapsing(
  1264. TObject * /*Sender*/, TTreeNode * /*Node*/, bool & AllowCollapse)
  1265. {
  1266. AllowCollapse = false;
  1267. }
  1268. //---------------------------------------------------------------------------
  1269. void __fastcall TSiteAdvancedDialog::ProxyLocalCommandBrowseButtonClick(
  1270. TObject * /*Sender*/)
  1271. {
  1272. BrowseForExecutable(ProxyLocalCommandEdit,
  1273. LoadStr(LOGIN_SELECT_LOCAL_PROXY),
  1274. LoadStr(EXECUTABLE_FILTER), false, true);
  1275. }
  1276. //---------------------------------------------------------------------------
  1277. void __fastcall TSiteAdvancedDialog::ColorButtonClick(TObject * /*Sender*/)
  1278. {
  1279. // WORKAROUND: Compiler keeps crashing randomly (but frequently) with
  1280. // "internal error" when passing menu directly to unique_ptr.
  1281. // Splitting it to two statements seems to help.
  1282. // The same hack exists in TPreferencesDialog::EditorFontColorButtonClick
  1283. TPopupMenu * Menu = CreateSessionColorPopupMenu(FColor, SessionColorChange);
  1284. // Popup menu has to survive the popup as TBX calls click handler asynchronously (post).
  1285. FColorPopupMenu.reset(Menu);
  1286. MenuPopup(Menu, ColorButton);
  1287. }
  1288. //---------------------------------------------------------------------------
  1289. void __fastcall TSiteAdvancedDialog::SessionColorChange(TColor Color)
  1290. {
  1291. SetSessionColor(Color);
  1292. UpdateControls();
  1293. }
  1294. //---------------------------------------------------------------------------
  1295. void __fastcall TSiteAdvancedDialog::SetSessionColor(TColor Color)
  1296. {
  1297. FColor = Color;
  1298. while (ColorImageList->Count > 1)
  1299. {
  1300. ColorImageList->Delete(1);
  1301. }
  1302. if (Color != 0)
  1303. {
  1304. AddSessionColorImage(ColorImageList, Color, 0);
  1305. }
  1306. }
  1307. //---------------------------------------------------------------------------
  1308. TTlsVersion __fastcall TSiteAdvancedDialog::IndexToTlsVersion(int Index)
  1309. {
  1310. switch (Index)
  1311. {
  1312. default:
  1313. DebugFail();
  1314. case 0:
  1315. return ssl3;
  1316. case 1:
  1317. return tls10;
  1318. case 2:
  1319. return tls11;
  1320. case 3:
  1321. return tls12;
  1322. }
  1323. }
  1324. //---------------------------------------------------------------------------
  1325. int __fastcall TSiteAdvancedDialog::TlsVersionToIndex(TTlsVersion TlsVersion)
  1326. {
  1327. switch (TlsVersion)
  1328. {
  1329. default:
  1330. DebugFail();
  1331. case ssl2:
  1332. case ssl3:
  1333. return 0;
  1334. case tls10:
  1335. return 1;
  1336. case tls11:
  1337. return 2;
  1338. case tls12:
  1339. return 3;
  1340. }
  1341. }
  1342. //---------------------------------------------------------------------------
  1343. void __fastcall TSiteAdvancedDialog::MinTlsVersionComboChange(TObject */*Sender*/)
  1344. {
  1345. TTlsVersion MinTlsVersion = IndexToTlsVersion(MinTlsVersionCombo->ItemIndex);
  1346. TTlsVersion MaxTlsVersion = IndexToTlsVersion(MaxTlsVersionCombo->ItemIndex);
  1347. if (MaxTlsVersion < MinTlsVersion)
  1348. {
  1349. MaxTlsVersionCombo->ItemIndex = MinTlsVersionCombo->ItemIndex;
  1350. }
  1351. }
  1352. //---------------------------------------------------------------------------
  1353. void __fastcall TSiteAdvancedDialog::MaxTlsVersionComboChange(TObject * /*Sender*/)
  1354. {
  1355. TTlsVersion MinTlsVersion = IndexToTlsVersion(MinTlsVersionCombo->ItemIndex);
  1356. TTlsVersion MaxTlsVersion = IndexToTlsVersion(MaxTlsVersionCombo->ItemIndex);
  1357. if (MinTlsVersion > MaxTlsVersion)
  1358. {
  1359. MinTlsVersionCombo->ItemIndex = MaxTlsVersionCombo->ItemIndex;
  1360. }
  1361. }
  1362. //---------------------------------------------------------------------------
  1363. void __fastcall TSiteAdvancedDialog::ProxyAutodetectButtonClick(TObject * /*Sender*/)
  1364. {
  1365. TInstantOperationVisualizer Visualizer;
  1366. UnicodeString ProxyHost;
  1367. int ProxyPort;
  1368. if (AutodetectProxy(ProxyHost, ProxyPort))
  1369. {
  1370. ProxyHostEdit->Text = ProxyHost;
  1371. ProxyPortEdit->AsInteger = ProxyPort;
  1372. SshProxyMethodCombo->ItemIndex = pmHTTP;
  1373. FtpProxyMethodCombo->ItemIndex = pmHTTP;
  1374. NeonProxyMethodCombo->ItemIndex = pmHTTP;
  1375. UpdateControls();
  1376. }
  1377. }
  1378. //---------------------------------------------------------------------------
  1379. void __fastcall TSiteAdvancedDialog::NoteMemoKeyDown(
  1380. TObject * Sender, WORD & Key, TShiftState Shift)
  1381. {
  1382. MemoKeyDown(Sender, Key, Shift);
  1383. }
  1384. //---------------------------------------------------------------------------
  1385. void __fastcall TSiteAdvancedDialog::TlsCertificateFileEditAfterDialog(TObject *Sender,
  1386. UnicodeString &Name, bool &Action)
  1387. {
  1388. PathEditAfterDialog(Sender, Name, Action);
  1389. TFilenameEdit * Edit = dynamic_cast<TFilenameEdit *>(Sender);
  1390. if (Name != Edit->Text)
  1391. {
  1392. VerifyCertificate(Name);
  1393. }
  1394. }
  1395. //---------------------------------------------------------------------------