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