Copy.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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. CopyParamListButton(TransferSettingsButton);
  124. HotTrackLabel(ShortCutHintLabel);
  125. if (FLAGSET(FOptions, coBrowse))
  126. {
  127. DebugAssert(!FToRemote);
  128. OkButton->Style = TCustomButton::bsSplitButton;
  129. }
  130. AutoSizeCheckBox(NeverShowAgainCheck);
  131. UseSystemSettings(this);
  132. }
  133. //---------------------------------------------------------------------------
  134. __fastcall TCopyDialog::~TCopyDialog()
  135. {
  136. delete FPresetsMenu;
  137. }
  138. //---------------------------------------------------------------------------
  139. void __fastcall TCopyDialog::AdjustTransferControls()
  140. {
  141. if (FFileList && FFileList->Count)
  142. {
  143. if (!FToRemote && !FMove && FLAGSET(FOutputOptions, cooRemoteTransfer))
  144. {
  145. UnicodeString Label;
  146. if (FFileList->Count == 1)
  147. {
  148. UnicodeString FileName;
  149. if (!FToRemote) FileName = UnixExtractFileName(FFileList->Strings[0]);
  150. else FileName = ExtractFileName(FFileList->Strings[0]);
  151. Label = FMTLOAD(REMOTE_COPY_FILE, (FileName));
  152. }
  153. else
  154. {
  155. Label = FMTLOAD(REMOTE_COPY_FILES, (FFileList->Count));
  156. }
  157. DirectoryLabel->Caption = Label;
  158. }
  159. else
  160. {
  161. UnicodeString TransferStr =
  162. LoadStr(RemotePaths() ? COPY_COPY_TOREMOTE : COPY_COPY_TOLOCAL);
  163. // currently the copy dialog is shown when downloading to temp folder
  164. // only for drag&drop downloads, so we dare to display d&d specific prompt
  165. UnicodeString DirectionStr =
  166. LoadStr(((FOptions & coTemp) != 0) ? COPY_TODROP :
  167. (RemotePaths() ? COPY_TOREMOTE : COPY_TOLOCAL));
  168. if (FFileList->Count == 1)
  169. {
  170. UnicodeString FileName;
  171. if (!FToRemote) FileName = UnixExtractFileName(FFileList->Strings[0]);
  172. else FileName = ExtractFileName(FFileList->Strings[0]);
  173. DirectoryLabel->Caption = FMTLOAD((FMove ? MOVE_FILE : COPY_FILE),
  174. (TransferStr, FileName, DirectionStr));
  175. }
  176. else
  177. {
  178. DirectoryLabel->Caption = FMTLOAD((FMove ? MOVE_FILES : COPY_FILES),
  179. (TransferStr, FFileList->Count, DirectionStr));
  180. }
  181. }
  182. }
  183. UnicodeString ImageName;
  184. UnicodeString ACaption;
  185. if (!FMove)
  186. {
  187. if (!FToRemote && FLAGSET(FOutputOptions, cooRemoteTransfer))
  188. {
  189. ACaption = LoadStr(REMOTE_COPY_TITLE);
  190. ImageName = L"Duplicate L to R";
  191. }
  192. else
  193. {
  194. if (RemotePaths())
  195. {
  196. ACaption = LoadStr(COPY_COPY_TOREMOTE_CAPTION);
  197. ImageName = L"Upload File";
  198. }
  199. else
  200. {
  201. ACaption = LoadStr(COPY_COPY_TOLOCAL_CAPTION);
  202. ImageName = L"Download File";
  203. }
  204. }
  205. }
  206. else
  207. {
  208. if (!FToRemote && FLAGSET(FOutputOptions, cooRemoteTransfer))
  209. {
  210. ACaption = LoadStr(COPY_MOVE_CAPTION);
  211. ImageName = L"Move L to R";
  212. }
  213. else
  214. {
  215. if (RemotePaths())
  216. {
  217. ACaption = LoadStr(COPY_MOVE_TOREMOTE_CAPTION);
  218. ImageName = L"Upload File Remove Original";
  219. }
  220. else
  221. {
  222. ACaption = LoadStr(COPY_MOVE_TOLOCAL_CAPTION);
  223. ImageName = L"Download File Remove Original";
  224. }
  225. }
  226. }
  227. Caption = FormatFormCaption(this, ACaption);
  228. LoadDialogImage(Image, ImageName);
  229. bool RemoteTransfer = FLAGSET(FOutputOptions, cooRemoteTransfer);
  230. DebugAssert(FLAGSET(FOptions, coAllowRemoteTransfer) || !RemoteTransfer);
  231. EnableControl(TransferSettingsButton, !RemoteTransfer);
  232. EnableControl(CopyParamGroup, !RemoteTransfer);
  233. }
  234. //---------------------------------------------------------------------------
  235. void __fastcall TCopyDialog::AdjustControls()
  236. {
  237. RemoteDirectoryEdit->Visible = false;
  238. LocalDirectoryEdit->Visible = false;
  239. DirectoryEdit->Visible = FLAGCLEAR(FOptions, coTemp);
  240. EnableControl(DirectoryEdit, FLAGCLEAR(FOptions, coDisableDirectory));
  241. EnableControl(DirectoryLabel, DirectoryEdit->Enabled);
  242. EnableControl(LocalDirectoryBrowseButton, DirectoryEdit->Enabled);
  243. DirectoryLabel->FocusControl = DirectoryEdit;
  244. UnicodeString QueueLabel = LoadStr(COPY_BACKGROUND);
  245. if (FLAGCLEAR(FOptions, coNoQueue))
  246. {
  247. QueueLabel = FMTLOAD(COPY_QUEUE, (QueueLabel));
  248. }
  249. QueueCheck2->Caption = QueueLabel;
  250. AdjustTransferControls();
  251. LocalDirectoryBrowseButton->Visible = !FToRemote &&
  252. FLAGCLEAR(FOptions, coTemp);
  253. if (FLAGCLEAR(FOptions, coDoNotShowAgain))
  254. {
  255. // Command-line transfers
  256. NeverShowAgainCheck->Visible = false;
  257. ClientHeight = ClientHeight -
  258. (ShortCutHintPanel->Top - NeverShowAgainCheck->Top);
  259. }
  260. if (FLAGCLEAR(FOptions, coShortCutHint) || CustomWinConfiguration->CopyShortCutHintShown)
  261. {
  262. ShortCutHintPanel->Visible = false;
  263. ClientHeight = ClientHeight - ShortCutHintPanel->Height;
  264. }
  265. UpdateControls();
  266. }
  267. //---------------------------------------------------------------------------
  268. void __fastcall TCopyDialog::SetOutputOptions(int value)
  269. {
  270. if (OutputOptions != value)
  271. {
  272. FSaveSettings = FLAGSET(value, cooSaveSettings);
  273. NeverShowAgainCheck->Checked = FLAGSET(value, cooDoNotShowAgain);
  274. FOutputOptions = (value & ~(cooDoNotShowAgain | cooSaveSettings));
  275. }
  276. }
  277. //---------------------------------------------------------------------------
  278. int __fastcall TCopyDialog::GetOutputOptions()
  279. {
  280. return FOutputOptions |
  281. FLAGMASK(FSaveSettings, cooSaveSettings) |
  282. FLAGMASK(NeverShowAgainCheck->Checked, cooDoNotShowAgain) |
  283. FLAGMASK(FBrowse, cooBrowse);
  284. }
  285. //---------------------------------------------------------------------------
  286. THistoryComboBox * __fastcall TCopyDialog::GetDirectoryEdit()
  287. {
  288. return FToRemote ? RemoteDirectoryEdit : LocalDirectoryEdit;
  289. }
  290. //---------------------------------------------------------------------------
  291. bool __fastcall TCopyDialog::RemotePaths()
  292. {
  293. return (FToRemote || FLAGSET(FOutputOptions, cooRemoteTransfer));
  294. }
  295. //---------------------------------------------------------------------------
  296. UnicodeString __fastcall TCopyDialog::GetFileMask()
  297. {
  298. return ExtractFileName(DirectoryEdit->Text, RemotePaths());
  299. }
  300. //---------------------------------------------------------------------------
  301. void __fastcall TCopyDialog::SetParams(const TGUICopyParamType & value)
  302. {
  303. FParams = value;
  304. FCopyParams = value;
  305. DirectoryEdit->Text = Directory + FParams.FileMask;
  306. QueueCheck2->Checked = FParams.Queue;
  307. UpdateControls();
  308. }
  309. //---------------------------------------------------------------------------
  310. TGUICopyParamType __fastcall TCopyDialog::GetParams()
  311. {
  312. // overwrites TCopyParamType fields only
  313. FParams = FCopyParams;
  314. FParams.FileMask = GetFileMask();
  315. FParams.Queue = QueueCheck2->Checked;
  316. return FParams;
  317. }
  318. //---------------------------------------------------------------------------
  319. void __fastcall TCopyDialog::SetDirectory(UnicodeString value)
  320. {
  321. if (!value.IsEmpty())
  322. {
  323. value = RemotePaths() ?
  324. UnicodeString(UnixIncludeTrailingBackslash(value)) : IncludeTrailingBackslash(value);
  325. }
  326. DirectoryEdit->Text = value + GetFileMask();
  327. }
  328. //---------------------------------------------------------------------------
  329. UnicodeString __fastcall TCopyDialog::GetDirectory()
  330. {
  331. DebugAssert(DirectoryEdit);
  332. UnicodeString Result = DirectoryEdit->Text;
  333. if (RemotePaths())
  334. {
  335. Result = UnixExtractFilePath(Result);
  336. if (!Result.IsEmpty())
  337. {
  338. Result = UnixIncludeTrailingBackslash(Result);
  339. }
  340. }
  341. else
  342. {
  343. Result = ExtractFilePath(Result);
  344. if (!Result.IsEmpty())
  345. {
  346. Result = IncludeTrailingBackslash(Result);
  347. }
  348. }
  349. return Result;
  350. }
  351. //---------------------------------------------------------------------------
  352. int __fastcall TCopyDialog::ActualCopyParamAttrs()
  353. {
  354. return FCopyParamAttrs | FLAGMASK(QueueCheck2->Checked && WinConfiguration->DefaultCopyParam.QueueParallel, cpaNoCalculateSize);
  355. }
  356. //---------------------------------------------------------------------------
  357. void __fastcall TCopyDialog::UpdateControls()
  358. {
  359. if (!FToRemote && FLAGSET(FOptions, coAllowRemoteTransfer))
  360. {
  361. UnicodeString Directory = DirectoryEdit->Text;
  362. bool RemoteTransfer = (Directory.Pos(L"\\") == 0) && (Directory.Pos(L"/") > 0);
  363. if (RemoteTransfer != FLAGSET(FOutputOptions, cooRemoteTransfer))
  364. {
  365. FOutputOptions =
  366. (FOutputOptions & ~cooRemoteTransfer) |
  367. FLAGMASK(RemoteTransfer, cooRemoteTransfer);
  368. AdjustTransferControls();
  369. }
  370. }
  371. UnicodeString InfoStr = FCopyParams.GetInfoStr(L"; ", ActualCopyParamAttrs());
  372. SetLabelHintPopup(CopyParamLabel, InfoStr);
  373. bool RemoteTransfer = FLAGSET(FOutputOptions, cooRemoteTransfer);
  374. EnableControl(QueueCheck2,
  375. ((FOptions & (coDisableQueue | coTemp)) == 0) && !RemoteTransfer);
  376. }
  377. //---------------------------------------------------------------------------
  378. void __fastcall TCopyDialog::FormShow(TObject * /*Sender*/)
  379. {
  380. DebugAssert(FFileList && (FFileList->Count > 0));
  381. if (DirectoryEdit->Enabled && DirectoryEdit->Visible)
  382. {
  383. ActiveControl = DirectoryEdit;
  384. }
  385. else
  386. {
  387. ActiveControl = OkButton;
  388. }
  389. UpdateControls();
  390. InstallPathWordBreakProc(RemoteDirectoryEdit);
  391. InstallPathWordBreakProc(LocalDirectoryEdit);
  392. // Does not work when set from a constructor
  393. ShortCutHintPanel->Color = Application->HintColor;
  394. }
  395. //---------------------------------------------------------------------------
  396. bool __fastcall TCopyDialog::Execute()
  397. {
  398. // at start assume that copy param is current preset
  399. FPreset = GUIConfiguration->CopyParamCurrent;
  400. DirectoryEdit->Items = CustomWinConfiguration->History[
  401. FToRemote ? L"RemoteTarget" : L"LocalTarget"];
  402. FBrowse = false;
  403. bool Result = (ShowModal() == DefaultResult(this));
  404. if (Result)
  405. {
  406. Configuration->BeginUpdate();
  407. try
  408. {
  409. if (FLAGSET(OutputOptions, cooSaveSettings) &&
  410. FLAGCLEAR(FOptions, coDisableSaveSettings))
  411. {
  412. GUIConfiguration->DefaultCopyParam = Params;
  413. }
  414. DirectoryEdit->SaveToHistory();
  415. CustomWinConfiguration->History[FToRemote ?
  416. L"RemoteTarget" : L"LocalTarget"] = DirectoryEdit->Items;
  417. if (FLAGSET(FOptions, coShortCutHint))
  418. {
  419. CustomWinConfiguration->CopyShortCutHintShown = true;
  420. }
  421. }
  422. __finally
  423. {
  424. Configuration->EndUpdate();
  425. }
  426. }
  427. return Result;
  428. }
  429. //---------------------------------------------------------------------------
  430. void __fastcall TCopyDialog::FormCloseQuery(TObject * /*Sender*/,
  431. bool &CanClose)
  432. {
  433. if ((ModalResult == DefaultResult(this)) && !FBrowse)
  434. {
  435. ExitActiveControl(this);
  436. if (!RemotePaths() && ((FOptions & coTemp) == 0))
  437. {
  438. CanClose = CopyDialogValidateLocalDirectory(Directory, DirectoryEdit);
  439. }
  440. if (CanClose)
  441. {
  442. CanClose = CopyDialogValidateFileMask(GetFileMask(), DirectoryEdit, (FFileList->Count > 1), RemotePaths());
  443. }
  444. }
  445. }
  446. //---------------------------------------------------------------------------
  447. void __fastcall TCopyDialog::LocalDirectoryBrowseButtonClick(
  448. TObject * /*Sender*/)
  449. {
  450. DebugAssert(!FToRemote);
  451. UnicodeString ADirectory;
  452. // if we are duplicating, we have remote path there
  453. if (!RemotePaths())
  454. {
  455. ADirectory = Directory;
  456. }
  457. if (SelectDirectory(ADirectory, LoadStr(SELECT_LOCAL_DIRECTORY), true))
  458. {
  459. Directory = ADirectory;
  460. UpdateControls();
  461. }
  462. }
  463. //---------------------------------------------------------------------------
  464. void __fastcall TCopyDialog::ControlChange(TObject * /*Sender*/)
  465. {
  466. UpdateControls();
  467. ResetSystemSettings(this);
  468. }
  469. //---------------------------------------------------------------------------
  470. void __fastcall TCopyDialog::TransferSettingsButtonClick(TObject * /*Sender*/)
  471. {
  472. if (!SupportsSplitButton())
  473. {
  474. CopyParamListPopup(CalculatePopupRect(TransferSettingsButton), 0);
  475. }
  476. else
  477. {
  478. CopyParamGroupClick(NULL);
  479. }
  480. }
  481. //---------------------------------------------------------------------------
  482. void __fastcall TCopyDialog::GenerateCode()
  483. {
  484. TFilesSelected FilesSelected = FLAGSET(FOptions, coAllFiles) ? fsAll : fsList;
  485. DoGenerateTransferCodeDialog(FToRemote, FMove, ActualCopyParamAttrs(), FSessionData, FilesSelected, FFileList, Directory, Params);
  486. }
  487. //---------------------------------------------------------------------------
  488. void __fastcall TCopyDialog::CopyParamClick(TObject * Sender)
  489. {
  490. // Save including the preset-unspecific queue properties,
  491. // so that they are preserved when assigning back later
  492. TGUICopyParamType Param = Params;
  493. bool PrevSaveSettings = FSaveSettings;
  494. int Result = CopyParamListPopupClick(Sender, Param, FPreset, ActualCopyParamAttrs(), &FSaveSettings);
  495. if (Result < 0)
  496. {
  497. if (DebugAlwaysTrue(Result == -cplGenerateCode))
  498. {
  499. GenerateCode();
  500. }
  501. }
  502. else
  503. {
  504. if (Result > 0)
  505. {
  506. Params = Param;
  507. }
  508. else
  509. {
  510. UpdateControls();
  511. }
  512. if (PrevSaveSettings && !FSaveSettings)
  513. {
  514. NeverShowAgainCheck->Checked = false;
  515. }
  516. }
  517. }
  518. //---------------------------------------------------------------------------
  519. void __fastcall TCopyDialog::HelpButtonClick(TObject * /*Sender*/)
  520. {
  521. FormHelp(this);
  522. }
  523. //---------------------------------------------------------------------------
  524. void __fastcall TCopyDialog::CopyParamGroupClick(TObject * /*Sender*/)
  525. {
  526. if (CopyParamGroup->Enabled)
  527. {
  528. if (DoCopyParamCustomDialog(FCopyParams, ActualCopyParamAttrs()))
  529. {
  530. UpdateControls();
  531. }
  532. }
  533. }
  534. //---------------------------------------------------------------------------
  535. void __fastcall TCopyDialog::CopyParamGroupContextPopup(TObject * /*Sender*/,
  536. TPoint & MousePos, bool & Handled)
  537. {
  538. CopyParamListPopup(CalculatePopupRect(CopyParamGroup, MousePos), cplCustomizeDefault);
  539. Handled = true;
  540. }
  541. //---------------------------------------------------------------------------
  542. void __fastcall TCopyDialog::CopyParamListPopup(TRect R, int AdditionalOptions)
  543. {
  544. bool RemoteTransfer = FLAGSET(FOutputOptions, cooRemoteTransfer);
  545. ::CopyParamListPopup(R, FPresetsMenu,
  546. FCopyParams, FPreset, CopyParamClick,
  547. AdditionalOptions |
  548. FLAGMASK(
  549. FLAGCLEAR(FOptions, coDisableSaveSettings) && !RemoteTransfer,
  550. cplSaveSettings) |
  551. FLAGMASK(FLAGCLEAR(FOutputOptions, cooRemoteTransfer) && FLAGCLEAR(FOptions, coTemp), cplGenerateCode),
  552. ActualCopyParamAttrs(),
  553. FSaveSettings);
  554. }
  555. //---------------------------------------------------------------------------
  556. void __fastcall TCopyDialog::TransferSettingsButtonDropDownClick(TObject * /*Sender*/)
  557. {
  558. CopyParamListPopup(CalculatePopupRect(TransferSettingsButton), cplCustomizeDefault);
  559. }
  560. //---------------------------------------------------------------------------
  561. void __fastcall TCopyDialog::NeverShowAgainCheckClick(TObject * /*Sender*/)
  562. {
  563. FSaveSettings = NeverShowAgainCheck->Checked;
  564. UpdateControls();
  565. }
  566. //---------------------------------------------------------------------------
  567. void __fastcall TCopyDialog::ShortCutHintLabelClick(TObject * /*Sender*/)
  568. {
  569. DoPreferencesDialog(pmCommander);
  570. }
  571. //---------------------------------------------------------------------------
  572. void __fastcall TCopyDialog::LocalDirectoryEditExit(TObject *)
  573. {
  574. if (!RemotePaths())
  575. {
  576. if (DirectoryExistsFix(LocalDirectoryEdit->Text))
  577. {
  578. LocalDirectoryEdit->Text = IncludeTrailingBackslash(LocalDirectoryEdit->Text) + AnyMask;
  579. }
  580. }
  581. }
  582. //---------------------------------------------------------------------------
  583. void __fastcall TCopyDialog::DownloadItemClick(TObject *)
  584. {
  585. OkButton->Click();
  586. }
  587. //---------------------------------------------------------------------------
  588. void __fastcall TCopyDialog::BrowseItemClick(TObject *)
  589. {
  590. FBrowse = true;
  591. OkButton->Click();
  592. }
  593. //---------------------------------------------------------------------------
  594. void __fastcall TCopyDialog::OkButtonDropDownClick(TObject *)
  595. {
  596. MenuPopup(OkMenu, OkButton);
  597. }
  598. //---------------------------------------------------------------------------
  599. void __fastcall TCopyDialog::Dispatch(void * Message)
  600. {
  601. TMessage * M = reinterpret_cast<TMessage*>(Message);
  602. if (M->Msg == CM_DPICHANGED)
  603. {
  604. AutoSizeCheckBox(NeverShowAgainCheck);
  605. }
  606. TForm::Dispatch(Message);
  607. }
  608. //---------------------------------------------------------------------------