SynchronizeChecklist.cpp 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  1. //---------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include "WinInterface.h"
  6. #include "SynchronizeChecklist.h"
  7. #include <Terminal.h>
  8. #include <TextsWin.h>
  9. #include <CoreMain.h>
  10. #include <VCLCommon.h>
  11. #include <Tools.h>
  12. #include <BaseUtils.hpp>
  13. #include <Math.hpp>
  14. #include <WinConfiguration.h>
  15. #include <GUITools.h>
  16. #include <TerminalManager.h>
  17. //---------------------------------------------------------------------
  18. #pragma link "IEListView"
  19. #pragma link "NortonLikeListView"
  20. #pragma link "PngImageList"
  21. #ifndef NO_RESOURCES
  22. #pragma resource "*.dfm"
  23. #endif
  24. //---------------------------------------------------------------------
  25. const int ImageColumnIndex = 4;
  26. //---------------------------------------------------------------------
  27. bool __fastcall DoSynchronizeChecklistDialog(TSynchronizeChecklist * Checklist,
  28. TSynchronizeMode Mode, int Params,
  29. const UnicodeString LocalDirectory, const UnicodeString RemoteDirectory,
  30. TCustomCommandMenuEvent OnCustomCommandMenu, TFullSynchronizeEvent OnSynchronize,
  31. TSynchronizeChecklistCalculateSize OnSynchronizeChecklistCalculateSize, void * Token)
  32. {
  33. std::unique_ptr<TSynchronizeChecklistDialog> Dialog(
  34. new TSynchronizeChecklistDialog(
  35. Application, Mode, Params, LocalDirectory, RemoteDirectory, OnCustomCommandMenu, OnSynchronize,
  36. OnSynchronizeChecklistCalculateSize, Token));
  37. return Dialog->Execute(Checklist);
  38. }
  39. //---------------------------------------------------------------------
  40. __fastcall TSynchronizeChecklistDialog::TSynchronizeChecklistDialog(
  41. TComponent * AOwner, TSynchronizeMode Mode, int Params,
  42. const UnicodeString & LocalDirectory, const UnicodeString & RemoteDirectory,
  43. TCustomCommandMenuEvent OnCustomCommandMenu, TFullSynchronizeEvent OnSynchronize,
  44. TSynchronizeChecklistCalculateSize OnSynchronizeChecklistCalculateSize, void * Token)
  45. : TForm(AOwner)
  46. {
  47. FFormRestored = false;
  48. FMode = Mode;
  49. FParams = Params;
  50. FLocalDirectory = ExcludeTrailingBackslash(LocalDirectory);
  51. FRemoteDirectory = UnixExcludeTrailingBackslash(RemoteDirectory);
  52. FOnCustomCommandMenu = OnCustomCommandMenu;
  53. FOnSynchronizeChecklistCalculateSize = OnSynchronizeChecklistCalculateSize;
  54. DebugAssert(OnSynchronize != NULL);
  55. FOnSynchronize = OnSynchronize;
  56. FToken = Token;
  57. UseSystemSettings(this);
  58. UseDesktopFont(ListView);
  59. UseDesktopFont(StatusBar);
  60. FChecklist = NULL;
  61. FChangingItem = NULL;
  62. FChangingItemIgnore = false;
  63. FChangingItemMass = false;
  64. FGeneralHint = StatusBar->Hint;
  65. FSynchronizing = false;
  66. SelectScaledImageList(ActionImages);
  67. FOrigListViewWindowProc = ListView->WindowProc;
  68. ListView->WindowProc = ListViewWindowProc;
  69. UpdateImages();
  70. CustomCommandsAction->Visible = (FOnCustomCommandMenu != NULL);
  71. // button visibility cannot be bound to action visibility
  72. CustomCommandsButton2->Visible = CustomCommandsAction->Visible;
  73. MenuButton(CustomCommandsButton2);
  74. }
  75. //---------------------------------------------------------------------
  76. __fastcall TSynchronizeChecklistDialog::~TSynchronizeChecklistDialog()
  77. {
  78. ListView->WindowProc = FOrigListViewWindowProc;
  79. }
  80. //---------------------------------------------------------------------
  81. bool __fastcall TSynchronizeChecklistDialog::Execute(TSynchronizeChecklist * Checklist)
  82. {
  83. FChecklist = Checklist;
  84. bool Result = (ShowModal() == DefaultResult(this));
  85. if (Result)
  86. {
  87. TSynchronizeChecklistConfiguration FormConfiguration =
  88. CustomWinConfiguration->SynchronizeChecklist;
  89. FormConfiguration.ListParams = ListView->ColProperties->ParamsStr;
  90. UnicodeString WindowParams = FormConfiguration.WindowParams;
  91. // if there is no main window, keep previous "custom pos" indication,
  92. bool CustomPos = (StrToIntDef(CutToChar(WindowParams, L';', true), 0) != 0);
  93. if (!IsMainFormLike(this))
  94. {
  95. CustomPos = (Application->MainForm->BoundsRect != BoundsRect);
  96. }
  97. FormConfiguration.WindowParams =
  98. FORMAT(L"%d;%s", ((CustomPos ? 1 : 0), StoreForm(this)));
  99. CustomWinConfiguration->SynchronizeChecklist = FormConfiguration;
  100. }
  101. if (FException.get() != NULL)
  102. {
  103. RethrowException(FException.get());
  104. }
  105. return Result;
  106. }
  107. //---------------------------------------------------------------------
  108. void __fastcall TSynchronizeChecklistDialog::UpdateCaption()
  109. {
  110. TTerminalManager * Manager = TTerminalManager::Instance();
  111. UnicodeString Title = Manager->GetAppProgressTitle();
  112. UnicodeString StatusTitle = LoadStr(FSynchronizing ? SYNCHRONIZE_PROGRESS_SYNCHRONIZE2 : SYNCHRONIZE_CHECKLIST_CAPTION);
  113. if (Title.Pos(StatusTitle) <= 0)
  114. {
  115. AddToList(Title, StatusTitle, L" - ");
  116. }
  117. Caption = FormatFormCaption(this, Title);
  118. }
  119. //---------------------------------------------------------------------
  120. void __fastcall TSynchronizeChecklistDialog::UpdateControls()
  121. {
  122. UpdateCaption();
  123. StatusBar->Invalidate();
  124. bool AllChecked = true;
  125. bool AllUnchecked = true;
  126. bool AnyBoth = false;
  127. bool AnyNonBoth = false;
  128. bool AnyDirectory = false;
  129. TListItem * Item = ListView->Selected;
  130. while (Item != NULL)
  131. {
  132. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  133. TSynchronizeChecklist::TAction Action = GetChecklistItemAction(ChecklistItem);
  134. if ((Action == TSynchronizeChecklist::saUploadUpdate) ||
  135. (Action == TSynchronizeChecklist::saDownloadUpdate))
  136. {
  137. AnyBoth = true;
  138. }
  139. else
  140. {
  141. AnyNonBoth = true;
  142. }
  143. if (Item->Checked)
  144. {
  145. AllUnchecked = false;
  146. }
  147. else
  148. {
  149. AllChecked = false;
  150. }
  151. if (ChecklistItem->IsDirectory)
  152. {
  153. AnyDirectory = true;
  154. }
  155. Item = ListView->GetNextItem(Item, sdAll, TItemStates() << isSelected);
  156. }
  157. EnableControl(OkButton, (FChecked[0] > 0) && !FSynchronizing);
  158. EnableControl(CancelButton, !FSynchronizing);
  159. EnableControl(HelpButton, !FSynchronizing);
  160. CheckAction->Enabled = !AllChecked && !FSynchronizing;
  161. UncheckAction->Enabled = !AllUnchecked && !FSynchronizing;
  162. CheckAllAction->Enabled = (FChecked[0] < FTotals[0]) && !FSynchronizing;
  163. UncheckAllAction->Enabled = (FChecked[0] > 0) && !FSynchronizing;
  164. CustomCommandsAction->Enabled = AnyBoth && !AnyNonBoth && DebugAlwaysTrue(!FSynchronizing);
  165. ReverseAction->Enabled = (ListView->SelCount > 0) && DebugAlwaysTrue(!FSynchronizing);
  166. CalculateSizeAction->Enabled = (ListView->SelCount > 0) && AnyDirectory && DebugAlwaysTrue(!FSynchronizing);
  167. SelectAllAction->Enabled = (ListView->SelCount < ListView->Items->Count) && !FSynchronizing;
  168. }
  169. //---------------------------------------------------------------------------
  170. bool __fastcall TSynchronizeChecklistDialog::GetWindowParams(UnicodeString & WindowParams)
  171. {
  172. WindowParams = CustomWinConfiguration->SynchronizeChecklist.WindowParams;
  173. bool CustomPos = (StrToIntDef(CutToChar(WindowParams, L';', true), 0) != 0);
  174. return CustomPos || IsMainFormLike(this);
  175. }
  176. //---------------------------------------------------------------------------
  177. void __fastcall TSynchronizeChecklistDialog::CreateParams(TCreateParams & Params)
  178. {
  179. UnicodeString WindowParams;
  180. if (GetWindowParams(WindowParams))
  181. {
  182. // This is only to set correct TForm::Position. Actual bounds are set later after DPI scaling
  183. RestoreForm(WindowParams, this, true);
  184. }
  185. TForm::CreateParams(Params);
  186. }
  187. //---------------------------------------------------------------------------
  188. void __fastcall TSynchronizeChecklistDialog::HelpButtonClick(TObject * /*Sender*/)
  189. {
  190. FormHelp(this);
  191. }
  192. //---------------------------------------------------------------------------
  193. void __fastcall TSynchronizeChecklistDialog::AddSubItem(TListItem * Item, int & Index, const UnicodeString & S)
  194. {
  195. if (Index < Item->SubItems->Count)
  196. {
  197. Item->SubItems->Strings[Index] = S;
  198. }
  199. else
  200. {
  201. DebugAssert(Index == Item->SubItems->Count);
  202. Item->SubItems->Add(S);
  203. }
  204. Index++;
  205. }
  206. //---------------------------------------------------------------------------
  207. void __fastcall TSynchronizeChecklistDialog::LoadItem(TListItem * Item)
  208. {
  209. UnicodeString S;
  210. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  211. if (ChecklistItem->ImageIndex >= 0)
  212. {
  213. Item->ImageIndex = ChecklistItem->ImageIndex;
  214. }
  215. else
  216. {
  217. Item->ImageIndex = FakeFileImageIndex(ChecklistItem->GetFileName(),
  218. FLAGMASK(ChecklistItem->IsDirectory, FILE_ATTRIBUTE_DIRECTORY));
  219. }
  220. S = ChecklistItem->GetFileName();
  221. if (ChecklistItem->IsDirectory)
  222. {
  223. S = IncludeTrailingBackslash(S);
  224. }
  225. Item->Caption = S;
  226. int Index = 0;
  227. TSynchronizeChecklist::TAction Action = GetChecklistItemAction(ChecklistItem);
  228. if (Action == TSynchronizeChecklist::saDeleteRemote)
  229. {
  230. AddSubItem(Item, Index, L"");
  231. AddSubItem(Item, Index, L"");
  232. AddSubItem(Item, Index, L"");
  233. }
  234. else
  235. {
  236. S = ChecklistItem->Local.Directory;
  237. if (AnsiSameText(FLocalDirectory, S.SubString(1, FLocalDirectory.Length())))
  238. {
  239. S[1] = L'.';
  240. S.Delete(2, FLocalDirectory.Length() - 1);
  241. }
  242. else
  243. {
  244. DebugFail();
  245. }
  246. AddSubItem(Item, Index, S);
  247. if (Action == TSynchronizeChecklist::saDownloadNew)
  248. {
  249. AddSubItem(Item, Index, L"");
  250. AddSubItem(Item, Index, L"");
  251. }
  252. else
  253. {
  254. if (!ChecklistItem->HasSize())
  255. {
  256. AddSubItem(Item, Index, L"");
  257. }
  258. else
  259. {
  260. AddSubItem(Item, Index,
  261. FormatPanelBytes(ChecklistItem->Local.Size, WinConfiguration->FormatSizeBytes));
  262. }
  263. AddSubItem(Item, Index,
  264. UserModificationStr(ChecklistItem->Local.Modification,
  265. ChecklistItem->Local.ModificationFmt));
  266. }
  267. }
  268. AddSubItem(Item, Index, L"");
  269. DebugAssert(Index == ImageColumnIndex);
  270. if (Action == TSynchronizeChecklist::saDeleteLocal)
  271. {
  272. AddSubItem(Item, Index, L"");
  273. AddSubItem(Item, Index, L"");
  274. AddSubItem(Item, Index, L"");
  275. }
  276. else
  277. {
  278. S = ChecklistItem->Remote.Directory;
  279. if (AnsiSameText(FRemoteDirectory, S.SubString(1, FRemoteDirectory.Length())))
  280. {
  281. S[1] = L'.';
  282. S.Delete(2, FRemoteDirectory.Length() - 1);
  283. }
  284. else
  285. {
  286. DebugFail();
  287. }
  288. AddSubItem(Item, Index, S);
  289. if (Action == TSynchronizeChecklist::saUploadNew)
  290. {
  291. AddSubItem(Item, Index, L"");
  292. AddSubItem(Item, Index, L"");
  293. }
  294. else
  295. {
  296. if (!ChecklistItem->HasSize())
  297. {
  298. AddSubItem(Item, Index, L"");
  299. }
  300. else
  301. {
  302. AddSubItem(Item, Index,
  303. FormatPanelBytes(ChecklistItem->Remote.Size, WinConfiguration->FormatSizeBytes));
  304. }
  305. AddSubItem(Item, Index, UserModificationStr(ChecklistItem->Remote.Modification,
  306. ChecklistItem->Remote.ModificationFmt));
  307. }
  308. }
  309. }
  310. //---------------------------------------------------------------------------
  311. void __fastcall TSynchronizeChecklistDialog::CountItemSize(const TSynchronizeChecklist::TItem * ChecklistItem, int Factor)
  312. {
  313. TSynchronizeChecklist::TAction Action = GetChecklistItemAction(ChecklistItem);
  314. int ActionIndex = int(Action);
  315. __int64 ItemSize = ChecklistItem->GetSize(Action);
  316. FCheckedSize[ActionIndex] += Factor * ItemSize;
  317. FCheckedSize[0] += Factor * ItemSize;
  318. }
  319. //---------------------------------------------------------------------------
  320. void __fastcall TSynchronizeChecklistDialog::CountItem(const TSynchronizeChecklist::TItem * ChecklistItem, int Factor)
  321. {
  322. int ActionIndex = int(GetChecklistItemAction(ChecklistItem));
  323. FChecked[ActionIndex] += Factor;
  324. FChecked[0] += Factor;
  325. CountItemSize(ChecklistItem, Factor);
  326. }
  327. //---------------------------------------------------------------------------
  328. void __fastcall TSynchronizeChecklistDialog::LoadList()
  329. {
  330. memset(&FTotals, 0, sizeof(FTotals));
  331. memset(&FChecked, 0, sizeof(FChecked));
  332. memset(&FCheckedSize, 0, sizeof(FCheckedSize));
  333. FTotals[0] = FChecklist->Count;
  334. ListView->Items->BeginUpdate();
  335. try
  336. {
  337. ListView->Items->Clear();
  338. for (int Index = 0; Index < FChecklist->Count; Index++)
  339. {
  340. const TSynchronizeChecklist::TItem * ChecklistItem =
  341. FChecklist->Item[ListView->Items->Count];
  342. FChangingItemIgnore = true;
  343. try
  344. {
  345. TListItem * Item = ListView->Items->Add();
  346. TSynchronizeChecklist::TAction Action = ChecklistItem->Action;
  347. FActions.insert(std::make_pair(ChecklistItem, Action));
  348. FChecklistToListViewMap.insert(std::make_pair(ChecklistItem, Item));
  349. Item->Data = const_cast<TSynchronizeChecklist::TItem *>(ChecklistItem);
  350. Item->Checked = ChecklistItem->Checked;
  351. LoadItem(Item);
  352. }
  353. __finally
  354. {
  355. FChangingItemIgnore = false;
  356. }
  357. int ActionIndex = int(GetChecklistItemAction(ChecklistItem));
  358. FTotals[ActionIndex]++;
  359. if (ChecklistItem->Checked)
  360. {
  361. CountItem(ChecklistItem, 1);
  362. }
  363. }
  364. }
  365. __finally
  366. {
  367. ListView->Items->EndUpdate();
  368. }
  369. ListView->AlphaSort();
  370. UpdateControls();
  371. }
  372. //---------------------------------------------------------------------------
  373. void __fastcall TSynchronizeChecklistDialog::FormShow(TObject * /*Sender*/)
  374. {
  375. // Moved here from CreateParams (see also TEditorForm::CreateParams), because there it breaks per-monitor DPI.
  376. // For example BoundsRect is matched to the main form too soon, so it gets rescaled later.
  377. // Also it happens before constructor, what causes UseDesktopFont-flagged controls to rescale twice.
  378. // But Position is already set in the CreateParams, as it cannot be set here anymore.
  379. if (!FFormRestored)
  380. {
  381. FFormRestored = True;
  382. UnicodeString WindowParams;
  383. if (GetWindowParams(WindowParams))
  384. {
  385. RestoreForm(WindowParams, this);
  386. }
  387. else
  388. {
  389. BoundsRect = Application->MainForm->BoundsRect;
  390. }
  391. }
  392. ListView->ColProperties->ParamsStr = CustomWinConfiguration->SynchronizeChecklist.ListParams;
  393. LoadList();
  394. UpdateStatusBarSize();
  395. }
  396. //---------------------------------------------------------------------------
  397. TRect __fastcall TSynchronizeChecklistDialog::GetColumnHeaderRect(int Index)
  398. {
  399. HWND HeaderHandle = ListView_GetHeader(ListView->Handle);
  400. TRect R;
  401. Header_GetItemRect(HeaderHandle, Index, &R);
  402. // Can be simplified using GetScrollPos
  403. TScrollInfo ScrollInfo;
  404. ZeroMemory(&ScrollInfo, sizeof(ScrollInfo));
  405. ScrollInfo.cbSize = sizeof(ScrollInfo);
  406. ScrollInfo.fMask = SIF_POS;
  407. GetScrollInfo(ListView->Handle, SB_HORZ, &ScrollInfo);
  408. R.Left -= ScrollInfo.nPos;
  409. R.Right -= ScrollInfo.nPos;
  410. return R;
  411. }
  412. //---------------------------------------------------------------------------
  413. void __fastcall TSynchronizeChecklistDialog::ListViewWindowProc(TMessage & Message)
  414. {
  415. if (Message.Msg == CN_NOTIFY)
  416. {
  417. TWMNotify & NotifyMessage = reinterpret_cast<TWMNotify &>(Message);
  418. if (NotifyMessage.NMHdr->code == NM_CUSTOMDRAW)
  419. {
  420. // workaround
  421. // Due to a bug in VCL, OnAdvancedCustomDrawSubItem is not called for any
  422. // other stage except for cdPrePaint. So we must call it ourselves.
  423. TNMLVCustomDraw * CustomDraw =
  424. reinterpret_cast<TNMLVCustomDraw *>(NotifyMessage.NMHdr);
  425. if (FLAGSET(CustomDraw->nmcd.dwDrawStage, CDDS_ITEM) &&
  426. FLAGSET(CustomDraw->nmcd.dwDrawStage, CDDS_SUBITEM) &&
  427. FLAGSET(CustomDraw->nmcd.dwDrawStage, CDDS_ITEMPOSTPAINT) &&
  428. (CustomDraw->iSubItem == ImageColumnIndex) &&
  429. (ActionImages->Width <= ListView->Columns->Items[CustomDraw->iSubItem]->Width))
  430. {
  431. TListItem * Item = ListView->Items->Item[CustomDraw->nmcd.dwItemSpec];
  432. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  433. TRect HeaderR = GetColumnHeaderRect(CustomDraw->iSubItem);
  434. TRect R = Item->DisplayRect(drBounds);
  435. R.Left = HeaderR.Left + (HeaderR.Width() - ActionImages->Width) / 2;
  436. R.Right = HeaderR.Right;
  437. // workaround
  438. // doing this from ListViewAdvancedCustomDraw corrupts list view on Windows 7
  439. ImageList_Draw(reinterpret_cast<HIMAGELIST>(ActionImages->Handle),
  440. int(GetChecklistItemAction(ChecklistItem)), CustomDraw->nmcd.hdc,
  441. R.Left, ((R.Top + R.Bottom - ActionImages->Height) / 2), ILD_TRANSPARENT);
  442. }
  443. }
  444. }
  445. FOrigListViewWindowProc(Message);
  446. }
  447. //---------------------------------------------------------------------------
  448. void __fastcall TSynchronizeChecklistDialog::ListViewAdvancedCustomDrawSubItem(
  449. TCustomListView * /*Sender*/, TListItem * /*Item*/, int /*SubItem*/,
  450. TCustomDrawState /*State*/, TCustomDrawStage /*Stage*/, bool & /*DefaultDraw*/)
  451. {
  452. // this is just fake handler that makes the list view request custom draw notification above
  453. }
  454. //---------------------------------------------------------------------------
  455. void __fastcall TSynchronizeChecklistDialog::StatusBarDrawPanel(
  456. TStatusBar * StatusBar, TStatusPanel * Panel, const TRect & Rect)
  457. {
  458. bool Possible;
  459. int ActionIndex = Panel->Index;
  460. TSynchronizeChecklist::TAction Action = TSynchronizeChecklist::TAction(ActionIndex);
  461. if (FTotals[ActionIndex] > 0)
  462. {
  463. // if direction is overriden to an action that is otherwise not possible
  464. // in given synchronization mode, we still want to show the stats
  465. Possible = true;
  466. }
  467. else
  468. {
  469. switch (Action)
  470. {
  471. case TSynchronizeChecklist::saNone:
  472. Possible = true;
  473. break;
  474. case TSynchronizeChecklist::saUploadNew:
  475. Possible = ((FMode == smRemote) || (FMode == smBoth)) &&
  476. FLAGCLEAR(FParams, TTerminal::spTimestamp);
  477. break;
  478. case TSynchronizeChecklist::saDownloadNew:
  479. Possible = ((FMode == smLocal) || (FMode == smBoth)) &&
  480. FLAGCLEAR(FParams, TTerminal::spTimestamp);
  481. break;
  482. case TSynchronizeChecklist::saUploadUpdate:
  483. Possible =
  484. ((FMode == smRemote) || (FMode == smBoth)) &&
  485. (FLAGCLEAR(FParams, TTerminal::spNotByTime) || FLAGSET(FParams, TTerminal::spBySize));
  486. break;
  487. case TSynchronizeChecklist::saDownloadUpdate:
  488. Possible =
  489. ((FMode == smLocal) || (FMode == smBoth)) &&
  490. (FLAGCLEAR(FParams, TTerminal::spNotByTime) || FLAGSET(FParams, TTerminal::spBySize));
  491. break;
  492. case TSynchronizeChecklist::saDeleteRemote:
  493. Possible = (FMode == smRemote) &&
  494. FLAGCLEAR(FParams, TTerminal::spTimestamp);
  495. break;
  496. case TSynchronizeChecklist::saDeleteLocal:
  497. Possible = (FMode == smLocal) &&
  498. FLAGCLEAR(FParams, TTerminal::spTimestamp);
  499. break;
  500. default:
  501. DebugFail();
  502. Possible = false;
  503. break;
  504. }
  505. }
  506. UnicodeString PanelText;
  507. if (Possible)
  508. {
  509. PanelText = FORMAT(LoadStrPart(SYNCHRONIZE_SELECTED_ACTIONS, 1),
  510. (FormatNumber(FChecked[ActionIndex]),
  511. FormatNumber(FTotals[ActionIndex])));
  512. if ((FChecked[ActionIndex] > 0) &&
  513. ((ActionIndex == 0) || !TSynchronizeChecklist::IsItemSizeIrrelevant(Action)))
  514. {
  515. PanelText += FORMAT(L" (%s)", (FormatBytes(FCheckedSize[ActionIndex])));
  516. }
  517. }
  518. else
  519. {
  520. PanelText = LoadStrPart(SYNCHRONIZE_SELECTED_ACTIONS, 2);
  521. }
  522. int TextHeight = StatusBar->Canvas->TextHeight(PanelText);
  523. int X = Rect.Left + ActionImages->Width + 4;
  524. int Y = (Rect.Top + Rect.Bottom - TextHeight) / 2;
  525. StatusBar->Canvas->TextRect(Rect, X, Y, PanelText);
  526. X = Rect.Left + 1;
  527. Y = ((Rect.Top + Rect.Bottom - ActionImages->Height) / 2);
  528. int ImageIndex = ActionIndex;
  529. ActionImages->Draw(StatusBar->Canvas, X, Y, ImageIndex, Possible);
  530. }
  531. //---------------------------------------------------------------------------
  532. int __fastcall TSynchronizeChecklistDialog::PanelCount()
  533. {
  534. // last "panel" is technical
  535. return StatusBar->Panels->Count - 1;
  536. }
  537. //---------------------------------------------------------------------------
  538. int __fastcall TSynchronizeChecklistDialog::PanelAt(int X)
  539. {
  540. int Result = 0;
  541. while ((X > StatusBar->Panels->Items[Result]->Width) &&
  542. (Result < PanelCount()))
  543. {
  544. X -= StatusBar->Panels->Items[Result]->Width;
  545. Result++;
  546. }
  547. return ((Result < StatusBar->Panels->Count - 1) ? Result : -1);
  548. }
  549. //---------------------------------------------------------------------------
  550. void __fastcall TSynchronizeChecklistDialog::StatusBarMouseMove(
  551. TObject * /*Sender*/, TShiftState /*Shift*/, int X, int /*Y*/)
  552. {
  553. UnicodeString Hint;
  554. int IPanel = PanelAt(X);
  555. if (IPanel >= 0)
  556. {
  557. Hint = StatusBar->Panels->Items[IPanel]->Text;
  558. if (IPanel > 0)
  559. {
  560. Hint = FORMAT(L"%s\n%s", (Hint, FGeneralHint));
  561. }
  562. }
  563. if (Hint != StatusBar->Hint)
  564. {
  565. Application->CancelHint();
  566. StatusBar->Hint = Hint;
  567. }
  568. }
  569. //---------------------------------------------------------------------------
  570. void __fastcall TSynchronizeChecklistDialog::ListViewChange(
  571. TObject * /*Sender*/, TListItem * Item, TItemChange Change)
  572. {
  573. if ((Change == ctState) && (FChangingItem == Item) && (FChangingItem != NULL))
  574. {
  575. if (!FChangingItemIgnore)
  576. {
  577. DebugAssert(Item->Data != NULL);
  578. if ((FChangingItemChecked != Item->Checked) && (Item->Data != NULL))
  579. {
  580. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  581. CountItem(ChecklistItem, Item->Checked ? 1 : -1);
  582. if (!FChangingItemMass)
  583. {
  584. UpdateControls();
  585. }
  586. }
  587. }
  588. FChangingItem = NULL;
  589. }
  590. }
  591. //---------------------------------------------------------------------------
  592. void __fastcall TSynchronizeChecklistDialog::ListViewChanging(
  593. TObject * /*Sender*/, TListItem * Item, TItemChange Change,
  594. bool & /*AllowChange*/)
  595. {
  596. if (Change == ctState)
  597. {
  598. FChangingItem = Item;
  599. FChangingItemChecked = Item->Checked;
  600. }
  601. else
  602. {
  603. DebugAssert(FChangingItem == NULL);
  604. FChangingItem = NULL;
  605. }
  606. }
  607. //---------------------------------------------------------------------------
  608. void __fastcall TSynchronizeChecklistDialog::CheckAll(bool Check)
  609. {
  610. FChangingItemMass = true;
  611. try
  612. {
  613. for (int Index = 0; Index < ListView->Items->Count; Index++)
  614. {
  615. ListView->Items->Item[Index]->Checked = Check;
  616. }
  617. }
  618. __finally
  619. {
  620. FChangingItemMass = false;
  621. }
  622. UpdateControls();
  623. }
  624. //---------------------------------------------------------------------------
  625. void __fastcall TSynchronizeChecklistDialog::CheckAllActionExecute(TObject * /*Sender*/)
  626. {
  627. CheckAll(true);
  628. }
  629. //---------------------------------------------------------------------------
  630. void __fastcall TSynchronizeChecklistDialog::UncheckAllActionExecute(TObject * /*Sender*/)
  631. {
  632. CheckAll(false);
  633. }
  634. //---------------------------------------------------------------------------
  635. void __fastcall TSynchronizeChecklistDialog::Check(bool Check)
  636. {
  637. FChangingItemMass = true;
  638. try
  639. {
  640. TListItem * Item = ListView->Selected;
  641. while (Item != NULL)
  642. {
  643. Item->Checked = Check;
  644. Item = ListView->GetNextItem(Item, sdAll, TItemStates() << isSelected);
  645. }
  646. }
  647. __finally
  648. {
  649. FChangingItemMass = false;
  650. }
  651. UpdateControls();
  652. }
  653. //---------------------------------------------------------------------------
  654. void __fastcall TSynchronizeChecklistDialog::CheckActionExecute(TObject * /*Sender*/)
  655. {
  656. Check(true);
  657. }
  658. //---------------------------------------------------------------------------
  659. void __fastcall TSynchronizeChecklistDialog::UncheckActionExecute(TObject * /*Sender*/)
  660. {
  661. Check(false);
  662. }
  663. //---------------------------------------------------------------------------
  664. void __fastcall TSynchronizeChecklistDialog::ListViewSelectItem(
  665. TObject * /*Sender*/, TListItem * /*Item*/, bool /*Selected*/)
  666. {
  667. // Delayed update of button status in case many items are being selected at once
  668. // Also change of selection causes buttons to flash, as for short period of time,
  669. // no item is selected
  670. UpdateTimer->Enabled = true;
  671. }
  672. //---------------------------------------------------------------------------
  673. void __fastcall TSynchronizeChecklistDialog::UpdateTimerTimer(
  674. TObject * /*Sender*/)
  675. {
  676. UpdateTimer->Enabled = false;
  677. UpdateControls();
  678. }
  679. //---------------------------------------------------------------------------
  680. TListItem * __fastcall TSynchronizeChecklistDialog::SelectAll(bool Select, int Action,
  681. bool OnlyTheAction)
  682. {
  683. TListItem * Result = NULL;
  684. for (int Index = 0; Index < ListView->Items->Count; Index++)
  685. {
  686. TListItem * Item = ListView->Items->Item[Index];
  687. if (Action == 0)
  688. {
  689. Item->Selected = Select;
  690. if (Result == NULL)
  691. {
  692. Result = Item;
  693. }
  694. }
  695. else
  696. {
  697. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  698. bool WantedAction = (int(GetChecklistItemAction(ChecklistItem)) == Action);
  699. if (WantedAction || !OnlyTheAction)
  700. {
  701. Item->Selected = Select && WantedAction;
  702. if (WantedAction && (Result == NULL))
  703. {
  704. Result = Item;
  705. }
  706. }
  707. }
  708. }
  709. return Result;
  710. }
  711. //---------------------------------------------------------------------------
  712. void __fastcall TSynchronizeChecklistDialog::SelectAllActionExecute(
  713. TObject * /*Sender*/)
  714. {
  715. SelectAll(true);
  716. }
  717. //---------------------------------------------------------------------------
  718. void __fastcall TSynchronizeChecklistDialog::StatusBarMouseDown(
  719. TObject * /*Sender*/, TMouseButton /*Button*/, TShiftState Shift, int X,
  720. int /*Y*/)
  721. {
  722. int IPanel = PanelAt(X);
  723. if (IPanel >= 0)
  724. {
  725. TListItem * Item = SelectAll(true, IPanel, Shift.Contains(ssCtrl));
  726. if (Item != NULL)
  727. {
  728. Item->MakeVisible(false);
  729. Item->Focused = true;
  730. ListView->SetFocus();
  731. }
  732. }
  733. }
  734. //---------------------------------------------------------------------------
  735. int __fastcall TSynchronizeChecklistDialog::CompareNumber(__int64 Value1,
  736. __int64 Value2)
  737. {
  738. int Result;
  739. if (Value1 < Value2)
  740. {
  741. Result = -1;
  742. }
  743. else if (Value1 == Value2)
  744. {
  745. Result = 0;
  746. }
  747. else
  748. {
  749. Result = 1;
  750. }
  751. return Result;
  752. }
  753. //---------------------------------------------------------------------------
  754. void __fastcall TSynchronizeChecklistDialog::ListViewCompare(
  755. TObject * /*Sender*/, TListItem * Item1, TListItem * Item2, int /*Data*/,
  756. int & Compare)
  757. {
  758. const TSynchronizeChecklist::TItem * ChecklistItem1 = GetChecklistItem(Item1);
  759. const TSynchronizeChecklist::TItem * ChecklistItem2 = GetChecklistItem(Item2);
  760. TIEListViewColProperties * ColProperties =
  761. dynamic_cast<TIEListViewColProperties *>(ListView->ColProperties);
  762. switch (ColProperties->SortColumn)
  763. {
  764. case 0: // name
  765. Compare = AnsiCompareText(ChecklistItem1->GetFileName(), ChecklistItem2->GetFileName());
  766. break;
  767. // sorting by local and remote dir is the same
  768. case 1: // local dir
  769. case 5: // remote dir
  770. Compare = 0; // default sorting
  771. break;
  772. case 2: // local size
  773. Compare = CompareNumber(ChecklistItem1->Local.Size, ChecklistItem2->Local.Size);
  774. break;
  775. case 3: // local changed
  776. Compare = CompareFileTime(ChecklistItem1->Local.Modification,
  777. ChecklistItem2->Local.Modification);
  778. break;
  779. case ImageColumnIndex: // action
  780. Compare = CompareNumber(GetChecklistItemAction(ChecklistItem1), GetChecklistItemAction(ChecklistItem2));
  781. break;
  782. case 6: // remote size
  783. Compare = CompareNumber(ChecklistItem1->Remote.Size, ChecklistItem2->Remote.Size);
  784. break;
  785. case 7: // remote changed
  786. Compare = CompareFileTime(ChecklistItem1->Remote.Modification,
  787. ChecklistItem2->Remote.Modification);
  788. break;
  789. }
  790. if (Compare == 0)
  791. {
  792. if (!ChecklistItem1->Local.Directory.IsEmpty())
  793. {
  794. Compare = AnsiCompareText(ChecklistItem1->Local.Directory, ChecklistItem2->Local.Directory);
  795. }
  796. else
  797. {
  798. DebugAssert(!ChecklistItem1->Remote.Directory.IsEmpty());
  799. Compare = AnsiCompareText(ChecklistItem1->Remote.Directory, ChecklistItem2->Remote.Directory);
  800. }
  801. if (Compare == 0)
  802. {
  803. Compare = AnsiCompareText(ChecklistItem1->GetFileName(), ChecklistItem2->GetFileName());
  804. }
  805. }
  806. if (!ColProperties->SortAscending)
  807. {
  808. Compare = -Compare;
  809. }
  810. }
  811. //---------------------------------------------------------------------------
  812. void __fastcall TSynchronizeChecklistDialog::ListViewSecondaryColumnHeader(
  813. TCustomIEListView * /*Sender*/, int Index, int & SecondaryColumn)
  814. {
  815. // "remote dir" column is sorting alias for "local dir" column
  816. if (Index == 5)
  817. {
  818. SecondaryColumn = 1;
  819. }
  820. else
  821. {
  822. SecondaryColumn = -1;
  823. }
  824. }
  825. //---------------------------------------------------------------------------
  826. void __fastcall TSynchronizeChecklistDialog::ListViewContextPopup(
  827. TObject * Sender, TPoint & MousePos, bool & Handled)
  828. {
  829. // to update source popup menu before TBX menu is created
  830. UpdateControls();
  831. MenuPopup(Sender, MousePos, Handled);
  832. }
  833. //---------------------------------------------------------------------------
  834. void __fastcall TSynchronizeChecklistDialog::CustomCommandsActionExecute(
  835. TObject * /*Sender*/)
  836. {
  837. TStrings * LocalFileList = new TStringList();
  838. TStrings * RemoteFileList = new TStringList();
  839. try
  840. {
  841. TListItem * Item = ListView->Selected;
  842. DebugAssert(Item != NULL);
  843. while (Item != NULL)
  844. {
  845. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  846. DebugAssert((GetChecklistItemAction(ChecklistItem) == TSynchronizeChecklist::saUploadUpdate) ||
  847. (GetChecklistItemAction(ChecklistItem) == TSynchronizeChecklist::saDownloadUpdate));
  848. DebugAssert(ChecklistItem->RemoteFile != NULL);
  849. UnicodeString LocalPath =
  850. IncludeTrailingBackslash(ChecklistItem->Local.Directory) +
  851. ChecklistItem->Local.FileName;
  852. LocalFileList->Add(LocalPath);
  853. UnicodeString RemotePath =
  854. UnixIncludeTrailingBackslash(ChecklistItem->Remote.Directory) +
  855. ChecklistItem->Remote.FileName;
  856. RemoteFileList->AddObject(RemotePath, ChecklistItem->RemoteFile);
  857. Item = ListView->GetNextItem(Item, sdAll, TItemStates() << isSelected);
  858. }
  859. }
  860. catch(...)
  861. {
  862. delete LocalFileList;
  863. delete RemoteFileList;
  864. throw;
  865. }
  866. DebugAssert(FOnCustomCommandMenu != NULL);
  867. FOnCustomCommandMenu(CustomCommandsAction, LocalFileList, RemoteFileList);
  868. }
  869. //---------------------------------------------------------------------------
  870. void __fastcall TSynchronizeChecklistDialog::UpdateStatusBarSize()
  871. {
  872. int PanelWidth = Min(StatusBar->Width / PanelCount(), ScaleByTextHeight(this, 160));
  873. for (int Index = 0; Index < PanelCount(); Index++)
  874. {
  875. StatusBar->Panels->Items[Index]->Width = PanelWidth;
  876. }
  877. }
  878. //---------------------------------------------------------------------------
  879. void __fastcall TSynchronizeChecklistDialog::StatusBarResize(TObject * /*Sender*/)
  880. {
  881. UpdateStatusBarSize();
  882. }
  883. //---------------------------------------------------------------------------
  884. const TSynchronizeChecklist::TItem * TSynchronizeChecklistDialog::GetChecklistItem(
  885. TListItem * Item)
  886. {
  887. return static_cast<const TSynchronizeChecklist::TItem *>(Item->Data);
  888. }
  889. //---------------------------------------------------------------------------
  890. TSynchronizeChecklist::TAction & TSynchronizeChecklistDialog::GetChecklistItemAction(
  891. const TSynchronizeChecklist::TItem * ChecklistItem)
  892. {
  893. TActions::iterator i = FActions.find(ChecklistItem);
  894. if (i == FActions.end())
  895. {
  896. throw EInvalidOperation(L"");
  897. }
  898. return i->second;
  899. }
  900. //---------------------------------------------------------------------------
  901. void __fastcall TSynchronizeChecklistDialog::ReverseActionExecute(TObject * /*Sender*/)
  902. {
  903. TAutoFlag Flag(FChangingItemMass);
  904. TListItem * Item = ListView->Selected;
  905. while (Item != NULL)
  906. {
  907. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  908. TSynchronizeChecklist::TAction & Action = GetChecklistItemAction(ChecklistItem);
  909. TSynchronizeChecklist::TAction NewAction = TSynchronizeChecklist::Reverse(Action);
  910. if (DebugAlwaysTrue(Action != NewAction))
  911. {
  912. int ActionIndex = int(Action);
  913. FTotals[ActionIndex]--;
  914. if (Item->Checked)
  915. {
  916. CountItem(ChecklistItem, -1);
  917. }
  918. Action = NewAction;
  919. ActionIndex = int(Action);
  920. FTotals[ActionIndex]++;
  921. if (Item->Checked)
  922. {
  923. // item size may differ with action (0 for delete, but non-0 for new file transfer)
  924. CountItem(ChecklistItem, 1);
  925. }
  926. LoadItem(Item);
  927. }
  928. Item = ListView->GetNextItem(Item, sdAll, TItemStates() << isSelected);
  929. }
  930. Flag.Release();
  931. UpdateControls();
  932. }
  933. //---------------------------------------------------------------------------
  934. void __fastcall TSynchronizeChecklistDialog::ListViewClick(TObject * /*Sender*/)
  935. {
  936. TKeyboardState KeyState;
  937. GetKeyboardState(KeyState);
  938. TShiftState ShiftState = KeyboardStateToShiftState(KeyState);
  939. // when selecting, do not reverse, even when user clicked on action column
  940. if (!ShiftState.Contains(ssShift) && !ShiftState.Contains(ssCtrl))
  941. {
  942. TPoint P = ListView->ScreenToClient(Mouse->CursorPos);
  943. TRect R = GetColumnHeaderRect(ImageColumnIndex);
  944. if ((R.Left <= P.x) && (P.x <= R.Right))
  945. {
  946. // If no item was selected before the click, the action is not enabled yet here,
  947. // and Execute would be noop, force update
  948. UpdateControls();
  949. ReverseAction->Execute();
  950. }
  951. }
  952. }
  953. //---------------------------------------------------------------------------
  954. void __fastcall TSynchronizeChecklistDialog::Dispatch(void * AMessage)
  955. {
  956. TMessage & Message = *reinterpret_cast<TMessage *>(AMessage);
  957. if (Message.Msg == WM_SYSCOMMAND)
  958. {
  959. if (!HandleMinimizeSysCommand(Message))
  960. {
  961. TForm::Dispatch(AMessage);
  962. }
  963. }
  964. else if (Message.Msg == CM_DPICHANGED)
  965. {
  966. CMDpiChanged(Message);
  967. }
  968. else if (Message.Msg == WM_WANTS_MOUSEWHEEL_INACTIVE)
  969. {
  970. Message.Result = FSynchronizing ? 1 : 0;
  971. }
  972. else if (Message.Msg == WM_MANAGES_CAPTION)
  973. {
  974. // calling UpdateControls would cause status bar flicker
  975. UpdateCaption();
  976. Message.Result = 1;
  977. }
  978. else
  979. {
  980. TForm::Dispatch(AMessage);
  981. }
  982. }
  983. //---------------------------------------------------------------------------
  984. void __fastcall TSynchronizeChecklistDialog::UpdateImages()
  985. {
  986. ListView->SmallImages = ShellImageListForControl(this, ilsSmall);
  987. }
  988. //---------------------------------------------------------------------------
  989. void __fastcall TSynchronizeChecklistDialog::CMDpiChanged(TMessage & Message)
  990. {
  991. TForm::Dispatch(&Message);
  992. UpdateImages();
  993. }
  994. //---------------------------------------------------------------------------
  995. void __fastcall TSynchronizeChecklistDialog::ProcessedItem(void * /*Token*/, const TSynchronizeChecklist::TItem * ChecklistItem)
  996. {
  997. TListItem * Item = FChecklistToListViewMap[ChecklistItem];
  998. DebugAssert(Item->Checked);
  999. Item->Checked = false;
  1000. Item->MakeVisible(false);
  1001. }
  1002. //---------------------------------------------------------------------------
  1003. void __fastcall TSynchronizeChecklistDialog::UpdatedSynchronizationChecklistItems(
  1004. const TSynchronizeChecklist::TItemList & Items)
  1005. {
  1006. TSynchronizeChecklist::TItemList::const_iterator Iter = Items.begin();
  1007. while (Iter != Items.end())
  1008. {
  1009. const TSynchronizeChecklist::TItem * ChecklistItem = *Iter;
  1010. TListItem * Item = FChecklistToListViewMap[ChecklistItem];
  1011. LoadItem(Item);
  1012. // When called from FOnSynchronize, we rely on a caller never to update size of an item that had size already,
  1013. // otherwise we get it counted twice here.
  1014. if (Item->Checked)
  1015. {
  1016. CountItemSize(ChecklistItem, 1);
  1017. }
  1018. Iter++;
  1019. }
  1020. UpdateControls();
  1021. }
  1022. //---------------------------------------------------------------------------
  1023. void __fastcall TSynchronizeChecklistDialog::OkButtonClick(TObject * /*Sender*/)
  1024. {
  1025. ListView->SelectAll(smNone);
  1026. for (int Index = 0; Index < ListView->Items->Count; Index++)
  1027. {
  1028. TListItem * Item = ListView->Items->Item[Index];
  1029. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  1030. FChecklist->Update(ChecklistItem, Item->Checked, GetChecklistItemAction(ChecklistItem));
  1031. }
  1032. TAutoFlag Flag(FSynchronizing);
  1033. UpdateControls();
  1034. try
  1035. {
  1036. FOnSynchronize(FToken, ProcessedItem, UpdatedSynchronizationChecklistItems);
  1037. }
  1038. catch (Exception & E)
  1039. {
  1040. FException.reset(CloneException(&E));
  1041. }
  1042. }
  1043. //---------------------------------------------------------------------------
  1044. void __fastcall TSynchronizeChecklistDialog::CalculateSizeActionExecute(TObject * /*Sender*/)
  1045. {
  1046. TItemStates States;
  1047. if (!IsKeyPressed(VK_CONTROL))
  1048. {
  1049. States << isSelected;
  1050. }
  1051. TSynchronizeChecklist::TItemList Items;
  1052. TListItem * Item = NULL;
  1053. while ((Item = ListView->GetNextItem(Item, sdAll, States)) != NULL)
  1054. {
  1055. const TSynchronizeChecklist::TItem * ChecklistItem = GetChecklistItem(Item);
  1056. Items.push_back(ChecklistItem);
  1057. if (Item->Checked)
  1058. {
  1059. CountItemSize(ChecklistItem, -1);
  1060. }
  1061. }
  1062. try
  1063. {
  1064. FOnSynchronizeChecklistCalculateSize(FChecklist, Items, FToken);
  1065. }
  1066. __finally
  1067. {
  1068. UpdatedSynchronizationChecklistItems(Items);
  1069. }
  1070. }
  1071. //---------------------------------------------------------------------------
  1072. void __fastcall TSynchronizeChecklistDialog::CalculateSizeAllActionExecute(TObject * Sender)
  1073. {
  1074. DebugAssert(IsKeyPressed(VK_CONTROL));
  1075. CalculateSizeActionExecute(Sender);
  1076. }
  1077. //---------------------------------------------------------------------------