Copy.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include <WinInterface.h>
  6. #include <CoreMain.h>
  7. #include <TextsWin.h>
  8. #include <VCLCommon.h>
  9. #include <CustomWinConfiguration.h>
  10. #include <Tools.h>
  11. #include <GUITools.h>
  12. #include "Copy.h"
  13. //---------------------------------------------------------------------------
  14. #pragma package(smart_init)
  15. #pragma link "Rights"
  16. #pragma link "CopyParams"
  17. #pragma link "HistoryComboBox"
  18. #pragma resource "*.dfm"
  19. //---------------------------------------------------------------------------
  20. bool __fastcall DoCopyDialog(
  21. bool ToRemote, bool Move, TStrings * FileList, UnicodeString & TargetDirectory,
  22. TGUICopyParamType * Params, int Options, int CopyParamAttrs, TSessionData * SessionData,
  23. int * OutputOptions, int AutoSubmit)
  24. {
  25. bool Result;
  26. TCopyDialog *CopyDialog = new TCopyDialog(Application, ToRemote, Move, FileList, Options, CopyParamAttrs, SessionData);
  27. try
  28. {
  29. if (FLAGSET(CopyParamAttrs, cpaNoTransferMode))
  30. {
  31. // If local and remote EOL types are the same, there is no need
  32. // for ASCII (or Automatic) mode
  33. Params->TransferMode = tmBinary;
  34. }
  35. if (OutputOptions != NULL)
  36. {
  37. CopyDialog->OutputOptions = *OutputOptions;
  38. }
  39. CopyDialog->Directory = TargetDirectory;
  40. CopyDialog->Params = *Params;
  41. if (AutoSubmit > 0)
  42. {
  43. InitiateDialogTimeout(CopyDialog, AutoSubmit * MSecsPerSec, CopyDialog->OkButton);
  44. }
  45. Result = CopyDialog->Execute();
  46. if (Result)
  47. {
  48. TargetDirectory = CopyDialog->Directory;
  49. *Params = CopyDialog->Params;
  50. if (OutputOptions != NULL)
  51. {
  52. *OutputOptions = CopyDialog->OutputOptions;
  53. }
  54. }
  55. }
  56. __finally
  57. {
  58. delete CopyDialog;
  59. }
  60. return Result;
  61. }
  62. //---------------------------------------------------------------------------
  63. bool CopyDialogValidateLocalDirectory(const UnicodeString & Directory, THistoryComboBox * DirectoryEdit)
  64. {
  65. bool Result = true;
  66. UnicodeString Drive = ExtractFileDrive(Directory);
  67. if (!DirectoryExistsFix(Directory))
  68. {
  69. if (MessageDialog(MainInstructions(FMTLOAD(CREATE_LOCAL_DIRECTORY, (Directory))),
  70. qtConfirmation, qaOK | qaCancel, HELP_NONE) != qaCancel)
  71. {
  72. if (!ForceDirectories(ApiPath(Directory)))
  73. {
  74. SimpleErrorDialog(FMTLOAD(CREATE_LOCAL_DIR_ERROR, (Directory)));
  75. Result = false;
  76. }
  77. }
  78. else
  79. {
  80. Result = False;
  81. }
  82. }
  83. if (!Result)
  84. {
  85. DirectoryEdit->SelectAll();
  86. DirectoryEdit->SetFocus();
  87. }
  88. return Result;
  89. }
  90. //---------------------------------------------------------------------------
  91. bool CopyDialogValidateFileMask(
  92. const UnicodeString & FileMask, THistoryComboBox * DirectoryEdit, bool MultipleFiles, bool RemotePaths)
  93. {
  94. bool Result = true;
  95. if (!IsFileNameMask(FileMask) && MultipleFiles)
  96. {
  97. UnicodeString Message =
  98. FormatMultiFilesToOneConfirmation(DirectoryEdit->Text, RemotePaths);
  99. Result = (MessageDialog(Message, qtConfirmation, qaOK | qaCancel, HELP_NONE) != qaCancel);
  100. }
  101. if (!Result)
  102. {
  103. DirectoryEdit->SelectAll();
  104. DirectoryEdit->SetFocus();
  105. }
  106. return Result;
  107. }
  108. //---------------------------------------------------------------------------
  109. __fastcall TCopyDialog::TCopyDialog(
  110. TComponent* Owner, bool ToRemote, bool Move, TStrings * FileList, int Options,
  111. int CopyParamAttrs, TSessionData * SessionData) : TForm(Owner)
  112. {
  113. FToRemote = ToRemote;
  114. FMove = Move;
  115. FOptions = Options;
  116. FCopyParamAttrs = CopyParamAttrs;
  117. FFileList = FileList;
  118. FSessionData = SessionData;
  119. FOutputOptions = 0;
  120. AdjustControls();
  121. FPresetsMenu = new TPopupMenu(this);
  122. HotTrackLabel(CopyParamLabel);
  123. HotTrackLabel(ShortCutHintLabel);
  124. if (FLAGSET(FOptions, coBrowse))
  125. {
  126. DebugAssert(!FToRemote);
  127. OkButton->Style = TCustomButton::bsSplitButton;
  128. }
  129. AutoSizeCheckBox(NeverShowAgainCheck);
  130. UseSystemSettings(this);
  131. }
  132. //---------------------------------------------------------------------------
  133. __fastcall TCopyDialog::~TCopyDialog()
  134. {
  135. delete FPresetsMenu;
  136. }
  137. //---------------------------------------------------------------------------
  138. void __fastcall TCopyDialog::AdjustTransferControls()
  139. {
  140. if (FFileList && FFileList->Count)
  141. {
  142. if (!FToRemote && !FMove && FLAGSET(FOutputOptions, cooRemoteTransfer))
  143. {
  144. UnicodeString Label;
  145. if (FFileList->Count == 1)
  146. {
  147. UnicodeString FileName;
  148. if (!FToRemote) FileName = UnixExtractFileName(FFileList->Strings[0]);
  149. else FileName = ExtractFileName(FFileList->Strings[0]);
  150. Label = FMTLOAD(REMOTE_COPY_FILE, (FileName));
  151. }
  152. else
  153. {
  154. Label = FMTLOAD(REMOTE_COPY_FILES, (FFileList->Count));
  155. }
  156. DirectoryLabel->Caption = Label;
  157. }
  158. else
  159. {
  160. UnicodeString TransferStr =
  161. LoadStr(RemotePaths() ? COPY_COPY_TOREMOTE : COPY_COPY_TOLOCAL);
  162. // currently the copy dialog is shown when downloading to temp folder
  163. // only for drag&drop downloads, so we dare to display d&d specific prompt
  164. UnicodeString DirectionStr =
  165. LoadStr(((FOptions & coTemp) != 0) ? COPY_TODROP :
  166. (RemotePaths() ? COPY_TOREMOTE : COPY_TOLOCAL));
  167. if (FFileList->Count == 1)
  168. {
  169. UnicodeString FileName;
  170. if (!FToRemote) FileName = UnixExtractFileName(FFileList->Strings[0]);
  171. else FileName = ExtractFileName(FFileList->Strings[0]);
  172. DirectoryLabel->Caption = FMTLOAD((FMove ? MOVE_FILE : COPY_FILE),
  173. (TransferStr, FileName, DirectionStr));
  174. }
  175. else
  176. {
  177. DirectoryLabel->Caption = FMTLOAD((FMove ? MOVE_FILES : COPY_FILES),
  178. (TransferStr, FFileList->Count, DirectionStr));
  179. }
  180. }
  181. }
  182. UnicodeString ImageName;
  183. UnicodeString ACaption;
  184. if (!FMove)
  185. {
  186. if (!FToRemote && FLAGSET(FOutputOptions, cooRemoteTransfer))
  187. {
  188. ACaption = LoadStr(REMOTE_COPY_TITLE);
  189. ImageName = L"Duplicate L to R";
  190. }
  191. else
  192. {
  193. if (RemotePaths())
  194. {
  195. ACaption = LoadStr(COPY_COPY_TOREMOTE_CAPTION);
  196. ImageName = L"Upload File";
  197. }
  198. else
  199. {
  200. ACaption = LoadStr(COPY_COPY_TOLOCAL_CAPTION);
  201. ImageName = L"Download File";
  202. }
  203. }
  204. }
  205. else
  206. {
  207. if (!FToRemote && FLAGSET(FOutputOptions, cooRemoteTransfer))
  208. {
  209. ACaption = LoadStr(COPY_MOVE_CAPTION);
  210. ImageName = L"Move L to R";
  211. }
  212. else
  213. {
  214. if (RemotePaths())
  215. {
  216. ACaption = LoadStr(COPY_MOVE_TOREMOTE_CAPTION);
  217. ImageName = L"Upload File Remove Original";
  218. }
  219. else
  220. {
  221. ACaption = LoadStr(COPY_MOVE_TOLOCAL_CAPTION);
  222. ImageName = L"Download File Remove Original";
  223. }
  224. }
  225. }
  226. Caption = FormatFormCaption(this, ACaption);
  227. LoadDialogImage(Image, ImageName);
  228. bool RemoteTransfer = FLAGSET(FOutputOptions, cooRemoteTransfer);
  229. DebugAssert(FLAGSET(FOptions, coAllowRemoteTransfer) || !RemoteTransfer);
  230. EnableControl(TransferSettingsButton, !RemoteTransfer);
  231. EnableControl(CopyParamGroup, !RemoteTransfer);
  232. }
  233. //---------------------------------------------------------------------------
  234. void __fastcall TCopyDialog::AdjustControls()
  235. {
  236. RemoteDirectoryEdit->Visible = false;
  237. LocalDirectoryEdit->Visible = false;
  238. DirectoryEdit->Visible = FLAGCLEAR(FOptions, coTemp);
  239. EnableControl(DirectoryEdit, FLAGCLEAR(FOptions, coDisableDirectory));
  240. EnableControl(DirectoryLabel, DirectoryEdit->Enabled);
  241. EnableControl(LocalDirectoryBrowseButton, DirectoryEdit->Enabled);
  242. DirectoryLabel->FocusControl = DirectoryEdit;
  243. UnicodeString QueueLabel = LoadStr(COPY_BACKGROUND);
  244. if (FLAGCLEAR(FOptions, coNoQueue))
  245. {
  246. QueueLabel = FMTLOAD(COPY_QUEUE, (QueueLabel));
  247. }
  248. QueueCheck2->Caption = QueueLabel;
  249. AdjustTransferControls();
  250. LocalDirectoryBrowseButton->Visible = !FToRemote &&
  251. FLAGCLEAR(FOptions, coTemp);
  252. if (FLAGCLEAR(FOptions, coDoNotShowAgain))
  253. {
  254. // Command-line transfers
  255. NeverShowAgainCheck->Visible = false;
  256. ClientHeight = ClientHeight -
  257. (ShortCutHintPanel->Top - NeverShowAgainCheck->Top);
  258. }
  259. if (FLAGCLEAR(FOptions, coShortCutHint) || CustomWinConfiguration->CopyShortCutHintShown)
  260. {
  261. ShortCutHintPanel->Visible = false;
  262. ClientHeight = ClientHeight - ShortCutHintPanel->Height;
  263. }
  264. UpdateControls();
  265. }
  266. //---------------------------------------------------------------------------
  267. void __fastcall TCopyDialog::SetOutputOptions(int value)
  268. {
  269. if (OutputOptions != value)
  270. {
  271. FSaveSettings = FLAGSET(value, cooSaveSettings);
  272. NeverShowAgainCheck->Checked = FLAGSET(value, cooDoNotShowAgain);
  273. FOutputOptions = (value & ~(cooDoNotShowAgain | cooSaveSettings));
  274. }
  275. }
  276. //---------------------------------------------------------------------------
  277. int __fastcall TCopyDialog::GetOutputOptions()
  278. {
  279. return FOutputOptions |
  280. FLAGMASK(FSaveSettings, cooSaveSettings) |
  281. FLAGMASK(NeverShowAgainCheck->Checked, cooDoNotShowAgain) |
  282. FLAGMASK(FBrowse, cooBrowse);
  283. }
  284. //---------------------------------------------------------------------------
  285. THistoryComboBox * __fastcall TCopyDialog::GetDirectoryEdit()
  286. {
  287. return FToRemote ? RemoteDirectoryEdit : LocalDirectoryEdit;
  288. }
  289. //---------------------------------------------------------------------------
  290. bool __fastcall TCopyDialog::RemotePaths()
  291. {
  292. return (FToRemote || FLAGSET(FOutputOptions, cooRemoteTransfer));
  293. }
  294. //---------------------------------------------------------------------------
  295. UnicodeString __fastcall TCopyDialog::GetFileMask()
  296. {
  297. return ExtractFileName(DirectoryEdit->Text, RemotePaths());
  298. }
  299. //---------------------------------------------------------------------------
  300. void __fastcall TCopyDialog::SetParams(const TGUICopyParamType & value)
  301. {
  302. FParams = value;
  303. FCopyParams = value;
  304. DirectoryEdit->Text = Directory + FParams.FileMask;
  305. QueueCheck2->Checked = FParams.Queue;
  306. UpdateControls();
  307. }
  308. //---------------------------------------------------------------------------
  309. TGUICopyParamType __fastcall TCopyDialog::GetParams()
  310. {
  311. // overwrites TCopyParamType fields only
  312. FParams = FCopyParams;
  313. FParams.FileMask = GetFileMask();
  314. FParams.Queue = QueueCheck2->Checked;
  315. return FParams;
  316. }
  317. //---------------------------------------------------------------------------
  318. void __fastcall TCopyDialog::SetDirectory(UnicodeString value)
  319. {
  320. if (!value.IsEmpty())
  321. {
  322. value = RemotePaths() ?
  323. UnicodeString(UnixIncludeTrailingBackslash(value)) : IncludeTrailingBackslash(value);
  324. }
  325. DirectoryEdit->Text = value + GetFileMask();
  326. }
  327. //---------------------------------------------------------------------------
  328. UnicodeString __fastcall TCopyDialog::GetDirectory()
  329. {
  330. DebugAssert(DirectoryEdit);
  331. UnicodeString Result = DirectoryEdit->Text;
  332. if (RemotePaths())
  333. {
  334. Result = UnixExtractFilePath(Result);
  335. if (!Result.IsEmpty())
  336. {
  337. Result = UnixIncludeTrailingBackslash(Result);
  338. }
  339. }
  340. else
  341. {
  342. Result = ExtractFilePath(Result);
  343. if (!Result.IsEmpty())
  344. {
  345. Result = IncludeTrailingBackslash(Result);
  346. }
  347. }
  348. return Result;
  349. }
  350. //---------------------------------------------------------------------------
  351. int __fastcall TCopyDialog::ActualCopyParamAttrs()
  352. {
  353. return FCopyParamAttrs | FLAGMASK(QueueCheck2->Checked && WinConfiguration->DefaultCopyParam.QueueParallel, cpaNoCalculateSize);
  354. }
  355. //---------------------------------------------------------------------------
  356. void __fastcall TCopyDialog::UpdateControls()
  357. {
  358. if (!FToRemote && FLAGSET(FOptions, coAllowRemoteTransfer))
  359. {
  360. UnicodeString Directory = DirectoryEdit->Text;
  361. bool RemoteTransfer = (Directory.Pos(L"\\") == 0) && (Directory.Pos(L"/") > 0);
  362. if (RemoteTransfer != FLAGSET(FOutputOptions, cooRemoteTransfer))
  363. {
  364. FOutputOptions =
  365. (FOutputOptions & ~cooRemoteTransfer) |
  366. FLAGMASK(RemoteTransfer, cooRemoteTransfer);
  367. AdjustTransferControls();
  368. }
  369. }
  370. UnicodeString InfoStr = FCopyParams.GetInfoStr(L"; ", ActualCopyParamAttrs());
  371. SetLabelHintPopup(CopyParamLabel, InfoStr);
  372. bool RemoteTransfer = FLAGSET(FOutputOptions, cooRemoteTransfer);
  373. EnableControl(QueueCheck2,
  374. ((FOptions & (coDisableQueue | coTemp)) == 0) && !RemoteTransfer);
  375. }
  376. //---------------------------------------------------------------------------
  377. void __fastcall TCopyDialog::FormShow(TObject * /*Sender*/)
  378. {
  379. DebugAssert(FFileList && (FFileList->Count > 0));
  380. if (DirectoryEdit->Enabled && DirectoryEdit->Visible)
  381. {
  382. ActiveControl = DirectoryEdit;
  383. }
  384. else
  385. {
  386. ActiveControl = OkButton;
  387. }
  388. UpdateControls();
  389. InstallPathWordBreakProc(RemoteDirectoryEdit);
  390. InstallPathWordBreakProc(LocalDirectoryEdit);
  391. // Does not work when set from a constructor
  392. ShortCutHintPanel->Color = Application->HintColor;
  393. }
  394. //---------------------------------------------------------------------------
  395. bool __fastcall TCopyDialog::Execute()
  396. {
  397. // at start assume that copy param is current preset
  398. FPreset = GUIConfiguration->CopyParamCurrent;
  399. DirectoryEdit->Items = CustomWinConfiguration->History[
  400. FToRemote ? L"RemoteTarget" : L"LocalTarget"];
  401. FBrowse = false;
  402. bool Result = (ShowModal() == DefaultResult(this));
  403. if (Result)
  404. {
  405. Configuration->BeginUpdate();
  406. try
  407. {
  408. if (FLAGSET(OutputOptions, cooSaveSettings) &&
  409. FLAGCLEAR(FOptions, coDisableSaveSettings))
  410. {
  411. GUIConfiguration->DefaultCopyParam = Params;
  412. }
  413. DirectoryEdit->SaveToHistory();
  414. CustomWinConfiguration->History[FToRemote ?
  415. L"RemoteTarget" : L"LocalTarget"] = DirectoryEdit->Items;
  416. if (FLAGSET(FOptions, coShortCutHint))
  417. {
  418. CustomWinConfiguration->CopyShortCutHintShown = true;
  419. }
  420. }
  421. __finally
  422. {
  423. Configuration->EndUpdate();
  424. }
  425. }
  426. return Result;
  427. }
  428. //---------------------------------------------------------------------------
  429. void __fastcall TCopyDialog::FormCloseQuery(TObject * /*Sender*/,
  430. bool &CanClose)
  431. {
  432. if ((ModalResult == DefaultResult(this)) && !FBrowse)
  433. {
  434. ExitActiveControl(this);
  435. if (!RemotePaths() && ((FOptions & coTemp) == 0))
  436. {
  437. CanClose = CopyDialogValidateLocalDirectory(Directory, DirectoryEdit);
  438. }
  439. if (CanClose)
  440. {
  441. CanClose = CopyDialogValidateFileMask(GetFileMask(), DirectoryEdit, (FFileList->Count > 1), RemotePaths());
  442. }
  443. }
  444. }
  445. //---------------------------------------------------------------------------
  446. void __fastcall TCopyDialog::LocalDirectoryBrowseButtonClick(
  447. TObject * /*Sender*/)
  448. {
  449. DebugAssert(!FToRemote);
  450. UnicodeString ADirectory;
  451. // if we are duplicating, we have remote path there
  452. if (!RemotePaths())
  453. {
  454. ADirectory = Directory;
  455. }
  456. if (SelectDirectory(ADirectory, LoadStr(SELECT_LOCAL_DIRECTORY), true))
  457. {
  458. Directory = ADirectory;
  459. UpdateControls();
  460. }
  461. }
  462. //---------------------------------------------------------------------------
  463. void __fastcall TCopyDialog::ControlChange(TObject * /*Sender*/)
  464. {
  465. UpdateControls();
  466. ResetSystemSettings(this);
  467. }
  468. //---------------------------------------------------------------------------
  469. void __fastcall TCopyDialog::TransferSettingsButtonClick(TObject * /*Sender*/)
  470. {
  471. CopyParamGroupClick(NULL);
  472. }
  473. //---------------------------------------------------------------------------
  474. void __fastcall TCopyDialog::GenerateCode()
  475. {
  476. TFilesSelected FilesSelected = FLAGSET(FOptions, coAllFiles) ? fsAll : fsList;
  477. DoGenerateTransferCodeDialog(FToRemote, FMove, ActualCopyParamAttrs(), FSessionData, FilesSelected, FFileList, Directory, Params);
  478. }
  479. //---------------------------------------------------------------------------
  480. void __fastcall TCopyDialog::CopyParamClick(TObject * Sender)
  481. {
  482. // Save including the preset-unspecific queue properties,
  483. // so that they are preserved when assigning back later
  484. TGUICopyParamType Param = Params;
  485. bool PrevSaveSettings = FSaveSettings;
  486. int Result = CopyParamListPopupClick(Sender, Param, FPreset, ActualCopyParamAttrs(), &FSaveSettings);
  487. if (Result < 0)
  488. {
  489. if (DebugAlwaysTrue(Result == -cplGenerateCode))
  490. {
  491. GenerateCode();
  492. }
  493. }
  494. else
  495. {
  496. if (Result > 0)
  497. {
  498. Params = Param;
  499. }
  500. else
  501. {
  502. UpdateControls();
  503. }
  504. if (PrevSaveSettings && !FSaveSettings)
  505. {
  506. NeverShowAgainCheck->Checked = false;
  507. }
  508. }
  509. }
  510. //---------------------------------------------------------------------------
  511. void __fastcall TCopyDialog::HelpButtonClick(TObject * /*Sender*/)
  512. {
  513. FormHelp(this);
  514. }
  515. //---------------------------------------------------------------------------
  516. void __fastcall TCopyDialog::CopyParamGroupClick(TObject * /*Sender*/)
  517. {
  518. if (CopyParamGroup->Enabled)
  519. {
  520. if (DoCopyParamCustomDialog(FCopyParams, ActualCopyParamAttrs()))
  521. {
  522. UpdateControls();
  523. }
  524. }
  525. }
  526. //---------------------------------------------------------------------------
  527. void __fastcall TCopyDialog::CopyParamGroupContextPopup(TObject * /*Sender*/,
  528. TPoint & MousePos, bool & Handled)
  529. {
  530. CopyParamListPopup(CalculatePopupRect(CopyParamGroup, MousePos), cplCustomizeDefault);
  531. Handled = true;
  532. }
  533. //---------------------------------------------------------------------------
  534. void __fastcall TCopyDialog::CopyParamListPopup(TRect R, int AdditionalOptions)
  535. {
  536. bool RemoteTransfer = FLAGSET(FOutputOptions, cooRemoteTransfer);
  537. ::CopyParamListPopup(R, FPresetsMenu,
  538. FCopyParams, FPreset, CopyParamClick,
  539. AdditionalOptions |
  540. FLAGMASK(
  541. FLAGCLEAR(FOptions, coDisableSaveSettings) && !RemoteTransfer,
  542. cplSaveSettings) |
  543. FLAGMASK(FLAGCLEAR(FOutputOptions, cooRemoteTransfer) && FLAGCLEAR(FOptions, coTemp), cplGenerateCode),
  544. ActualCopyParamAttrs(),
  545. FSaveSettings);
  546. }
  547. //---------------------------------------------------------------------------
  548. void __fastcall TCopyDialog::TransferSettingsButtonDropDownClick(TObject * /*Sender*/)
  549. {
  550. CopyParamListPopup(CalculatePopupRect(TransferSettingsButton), cplCustomizeDefault);
  551. }
  552. //---------------------------------------------------------------------------
  553. void __fastcall TCopyDialog::NeverShowAgainCheckClick(TObject * /*Sender*/)
  554. {
  555. FSaveSettings = NeverShowAgainCheck->Checked;
  556. UpdateControls();
  557. }
  558. //---------------------------------------------------------------------------
  559. void __fastcall TCopyDialog::ShortCutHintLabelClick(TObject * /*Sender*/)
  560. {
  561. DoPreferencesDialog(pmCommander);
  562. }
  563. //---------------------------------------------------------------------------
  564. void __fastcall TCopyDialog::LocalDirectoryEditExit(TObject *)
  565. {
  566. if (!RemotePaths())
  567. {
  568. if (DirectoryExistsFix(LocalDirectoryEdit->Text))
  569. {
  570. LocalDirectoryEdit->Text = IncludeTrailingBackslash(LocalDirectoryEdit->Text) + AnyMask;
  571. }
  572. }
  573. }
  574. //---------------------------------------------------------------------------
  575. void __fastcall TCopyDialog::DownloadItemClick(TObject *)
  576. {
  577. OkButton->Click();
  578. }
  579. //---------------------------------------------------------------------------
  580. void __fastcall TCopyDialog::BrowseItemClick(TObject *)
  581. {
  582. FBrowse = true;
  583. OkButton->Click();
  584. }
  585. //---------------------------------------------------------------------------
  586. void __fastcall TCopyDialog::OkButtonDropDownClick(TObject *)
  587. {
  588. MenuPopup(OkMenu, OkButton);
  589. }
  590. //---------------------------------------------------------------------------
  591. void __fastcall TCopyDialog::FormAfterMonitorDpiChanged(TObject *, int OldDPI, int NewDPI)
  592. {
  593. DebugUsedParam2(OldDPI, NewDPI);
  594. AutoSizeCheckBox(NeverShowAgainCheck);
  595. }
  596. //---------------------------------------------------------------------------