SiteAdvanced.cpp 53 KB

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