UnixDriveView.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include "UnixDriveView.h"
  6. #ifndef DESIGN_ONLY
  7. #include <Terminal.h>
  8. #include <RemoteFiles.h>
  9. #endif
  10. #pragma package(smart_init)
  11. //---------------------------------------------------------------------------
  12. static inline void ValidCtrCheck(TUnixDriveView *)
  13. {
  14. new TUnixDriveView(NULL);
  15. }
  16. //---------------------------------------------------------------------------
  17. namespace Unixdriveview
  18. {
  19. void __fastcall PACKAGE Register()
  20. {
  21. TComponentClass classes[1] = {__classid(TUnixDriveView)};
  22. RegisterComponents("Scp", classes, 0);
  23. }
  24. }
  25. //---------------------------------------------------------------------------
  26. __fastcall TUnixDriveView::TUnixDriveView(TComponent * Owner) :
  27. TCustomUnixDriveView(Owner)
  28. {
  29. }
  30. //---------------------------------------------------------------------------
  31. struct TNodeData
  32. {
  33. TRemoteFileList * FileList;
  34. TRemoteFile * File;
  35. AnsiString Directory;
  36. };
  37. //---------------------------------------------------------------------------
  38. __fastcall TCustomUnixDriveView::TCustomUnixDriveView(TComponent* Owner) :
  39. TCustomDriveView(Owner)
  40. {
  41. FTerminal = NULL;
  42. FRootName = DEFAULT_ROOTNAME;
  43. FIgnoreChange = false;
  44. FPrevSelected = NULL;
  45. DDAllowMove = false;
  46. FShowInaccesibleDirectories = true;
  47. FDummyDragFile = NULL;
  48. }
  49. //---------------------------------------------------------------------------
  50. __fastcall TCustomUnixDriveView::~TCustomUnixDriveView()
  51. {
  52. Terminal = NULL;
  53. if (FDummyDragFile != NULL)
  54. {
  55. SAFE_DESTROY(FDummyDragFile);
  56. }
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TCustomUnixDriveView::CreateWnd()
  60. {
  61. TCustomDriveView::CreateWnd();
  62. FDragDropFilesEx->TargetEffects = TDropEffectSet() << deCopy << deMove;
  63. }
  64. //---------------------------------------------------------------------------
  65. void __fastcall TCustomUnixDriveView::SetTerminal(TTerminal * value)
  66. {
  67. if (FTerminal != value)
  68. {
  69. FTerminal = value;
  70. Items->Clear();
  71. }
  72. }
  73. //---------------------------------------------------------------------------
  74. void __fastcall TCustomUnixDriveView::SetDirView(TUnixDirView * Value)
  75. {
  76. if (FDirView != Value)
  77. {
  78. if (FDirView != NULL)
  79. {
  80. FDirView->DriveView = NULL;
  81. }
  82. FDirView = Value;
  83. if (FDirView != NULL)
  84. {
  85. FDirView->DriveView = this;
  86. }
  87. }
  88. }
  89. //---------------------------------------------------------------------------
  90. TCustomDirView * __fastcall TCustomUnixDriveView::GetCustomDirView()
  91. {
  92. return FDirView;
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TCustomUnixDriveView::SetCustomDirView(TCustomDirView * Value)
  96. {
  97. SetDirView(dynamic_cast<TUnixDirView *>(Value));
  98. }
  99. //---------------------------------------------------------------------------
  100. bool __fastcall TCustomUnixDriveView::IsRootNameStored()
  101. {
  102. return (FRootName != DEFAULT_ROOTNAME);
  103. }
  104. //---------------------------------------------------------------------------
  105. bool __fastcall TCustomUnixDriveView::NodeIsHidden(const TTreeNode * Node)
  106. {
  107. #ifndef DESIGN_ONLY
  108. TNodeData * Data = NodeData(Node);
  109. TRemoteFile * File = Data->File;
  110. return
  111. ((File != NULL) && File->IsHidden) ||
  112. ((File == NULL) && IsUnixHiddenFile(UnixExtractFileName(Data->Directory)));
  113. #else
  114. return false;
  115. #endif
  116. }
  117. //---------------------------------------------------------------------------
  118. bool __fastcall TCustomUnixDriveView::NodeCanDelete(TTreeNode * Node)
  119. {
  120. return (Selected == NULL) ||
  121. ((Selected != Node) && !Selected->HasAsParent(Node));
  122. }
  123. //---------------------------------------------------------------------------
  124. void __fastcall TCustomUnixDriveView::UpdatePath(TTreeNode * Node, bool Force,
  125. bool CanLoad)
  126. {
  127. #ifndef DESIGN_ONLY
  128. TNodeData * Data = NodeData(Node);
  129. AnsiString Path = Data->Directory;
  130. if (FTerminal->DirectoryFileList(Path, Data->FileList, CanLoad) ||
  131. ((Data->FileList != NULL) && Force))
  132. {
  133. TStringList * ChildrenDirs = new TStringList();
  134. try
  135. {
  136. ChildrenDirs->Sorted = true;
  137. ChildrenDirs->Duplicates = dupAccept;
  138. ChildrenDirs->CaseSensitive = true;
  139. bool HadChildren = (Node->Count > 0);
  140. if (HadChildren)
  141. {
  142. for (int i = 0; i < Node->Count; i++)
  143. {
  144. TTreeNode * ChildNode = Node->Item[i];
  145. TNodeData * ChildData = NodeData(ChildNode);
  146. ChildData->File = NULL;
  147. ChildrenDirs->AddObject(UnixExtractFileName(ChildData->Directory),
  148. ChildNode);
  149. }
  150. }
  151. for (int i = 0; i < Data->FileList->Count; i++)
  152. {
  153. TRemoteFile * File = Data->FileList->Files[i];
  154. if (File->IsDirectory && !File->IsParentDirectory && !File->IsThisDirectory &&
  155. (ShowHiddenDirs || !File->IsHidden) &&
  156. (ShowInaccesibleDirectories || !File->IsInaccesibleDirectory))
  157. {
  158. int ChildIndex = ChildrenDirs->IndexOf(File->FileName);
  159. if (ChildIndex >= 0)
  160. {
  161. TTreeNode * ChildNode =
  162. dynamic_cast<TTreeNode *>(ChildrenDirs->Objects[ChildIndex]);
  163. TNodeData * ChildData = NodeData(ChildNode);
  164. ChildData->File = File;
  165. UpdatePath(ChildNode, Force);
  166. }
  167. else
  168. {
  169. AnsiString ChildPath = UnixIncludeTrailingBackslash(Path) + File->FileName;
  170. assert(!IsUnixRootPath(ChildPath));
  171. LoadPathEasy(Node, ChildPath, File);
  172. }
  173. }
  174. }
  175. if (HadChildren)
  176. {
  177. for (int i = 0; i < ChildrenDirs->Count; i++)
  178. {
  179. TTreeNode * ChildNode = dynamic_cast<TTreeNode *>(ChildrenDirs->Objects[i]);
  180. TNodeData * ChildData = NodeData(ChildNode);
  181. if ((ChildData->File == NULL) && NodeCanDelete(ChildNode))
  182. {
  183. ChildNode->Delete();
  184. }
  185. }
  186. }
  187. Node->AlphaSort(false);
  188. }
  189. __finally
  190. {
  191. delete ChildrenDirs;
  192. }
  193. }
  194. else if (Force)
  195. {
  196. for (int i = Node->Count - 1; i >= 0; i--)
  197. {
  198. TTreeNode * ChildNode = Node->Item[i];
  199. TRemoteFile * File = NodeFile(ChildNode);
  200. if (!NodeCanDelete(ChildNode) ||
  201. ((ShowHiddenDirs || !NodeIsHidden(ChildNode)) &&
  202. (ShowInaccesibleDirectories || (File == NULL) || !File->IsInaccesibleDirectory)))
  203. {
  204. UpdatePath(ChildNode, true);
  205. }
  206. else
  207. {
  208. ChildNode->Delete();
  209. }
  210. }
  211. }
  212. #endif
  213. }
  214. //---------------------------------------------------------------------------
  215. TTreeNode * __fastcall TCustomUnixDriveView::LoadPathEasy(TTreeNode * Parent,
  216. AnsiString Path, TRemoteFile * File)
  217. {
  218. #ifndef DESIGN_ONLY
  219. assert(Path == UnixExcludeTrailingBackslash(Path));
  220. AnsiString DirName = IsUnixRootPath(Path) ? RootName : UnixExtractFileName(Path);
  221. TTreeNode * Node = Items->AddChild(Parent, DirName);
  222. TNodeData * Data = new TNodeData();
  223. Node->Data = Data;
  224. Data->Directory = Path;
  225. Data->File = File;
  226. Data->FileList = NULL;
  227. UpdatePath(Node, true);
  228. return Node;
  229. #else
  230. return NULL;
  231. #endif
  232. }
  233. //---------------------------------------------------------------------------
  234. TTreeNode * __fastcall TCustomUnixDriveView::LoadPath(AnsiString Path)
  235. {
  236. #ifndef DESIGN_ONLY
  237. if (Path.IsEmpty())
  238. {
  239. Path = ROOTDIRECTORY;
  240. }
  241. TTreeNode * Node = FindNodeToPath(Path);
  242. if (Node == NULL)
  243. {
  244. Path = UnixExcludeTrailingBackslash(Path);
  245. TTreeNode * Parent = NULL;
  246. TRemoteFile * File = NULL;
  247. if (!IsUnixRootPath(Path))
  248. {
  249. Parent = LoadPath(UnixExtractFileDir(Path));
  250. }
  251. Node = FindNodeToPath(Path);
  252. if (Node == NULL)
  253. {
  254. // node still does not exist, this should happen only when
  255. // if the parent directory is not in cache
  256. if (Parent != NULL)
  257. {
  258. TRemoteFileList * ParentFileList = NodeFileList(Parent);
  259. if (ParentFileList != NULL)
  260. {
  261. File = ParentFileList->FindFile(UnixExtractFileName(Path));
  262. }
  263. }
  264. Node = LoadPathEasy(Parent, Path, File);
  265. if (Parent != NULL)
  266. {
  267. Parent->AlphaSort(false);
  268. }
  269. }
  270. else
  271. {
  272. UpdatePath(Node, false);
  273. }
  274. }
  275. else
  276. {
  277. UpdatePath(Node, false);
  278. }
  279. return Node;
  280. #else
  281. return NULL;
  282. #endif
  283. }
  284. //---------------------------------------------------------------------------
  285. void __fastcall TCustomUnixDriveView::LoadDirectory()
  286. {
  287. #ifndef DESIGN_ONLY
  288. assert(!FIgnoreChange);
  289. FIgnoreChange = true;
  290. try
  291. {
  292. Selected = LoadPath(FTerminal->Files->Directory);
  293. assert(Selected != NULL);
  294. FPrevSelected = Selected;
  295. }
  296. __finally
  297. {
  298. FIgnoreChange = false;
  299. FDirectoryLoaded = true;
  300. }
  301. #endif
  302. }
  303. //---------------------------------------------------------------------------
  304. TNodeData * __fastcall TCustomUnixDriveView::NodeData(const TTreeNode * Node)
  305. {
  306. assert(Node->Data != NULL);
  307. return static_cast<TNodeData*>(Node->Data);
  308. }
  309. //---------------------------------------------------------------------------
  310. TRemoteFileList * __fastcall TCustomUnixDriveView::NodeFileList(const TTreeNode * Node)
  311. {
  312. assert(Node->Data != NULL);
  313. return static_cast<TNodeData*>(Node->Data)->FileList;
  314. }
  315. //---------------------------------------------------------------------------
  316. TRemoteFile * __fastcall TCustomUnixDriveView::NodeFile(const TTreeNode * Node)
  317. {
  318. assert(Node->Data != NULL);
  319. return static_cast<TNodeData*>(Node->Data)->File;
  320. }
  321. //---------------------------------------------------------------------------
  322. TRemoteFile * __fastcall TCustomUnixDriveView::NodeFileForce(TTreeNode * Node)
  323. {
  324. TRemoteFile * File = NodeFile(Node);
  325. if (File == NULL)
  326. {
  327. SAFE_DESTROY(FDummyDragFile);
  328. FDummyDragFile = new TRemoteDirectoryFile();
  329. FDummyDragFile->FileName = Node->Text;
  330. FDummyDragFile->FullFileName = NodePathName(Node);
  331. File = FDummyDragFile;
  332. }
  333. return File;
  334. }
  335. //---------------------------------------------------------------------------
  336. void __fastcall TCustomUnixDriveView::Delete(TTreeNode * Node)
  337. {
  338. TNodeData * Data = NULL;
  339. if (Node != NULL)
  340. {
  341. Data = NodeData(Node);
  342. }
  343. TCustomDriveView::Delete(Node);
  344. // delete file list at last, when we are sure that no child nodes exist
  345. if (Data != NULL)
  346. {
  347. #ifndef DESIGN_ONLY
  348. delete Data->FileList;
  349. #endif
  350. delete Data;
  351. }
  352. }
  353. //---------------------------------------------------------------------------
  354. void __fastcall TCustomUnixDriveView::Change(TTreeNode * Node)
  355. {
  356. #ifndef DESIGN_ONLY
  357. // During D&D Selected is set to NULL and then back to previous selection,
  358. // prevent actually changing directory in such case
  359. if (FIgnoreChange || (Node == NULL) || (Node == FPrevSelected))
  360. {
  361. TCustomDriveView::Change(Node);
  362. }
  363. else
  364. {
  365. FDirectoryLoaded = false;
  366. try
  367. {
  368. Terminal->ChangeDirectory(NodePathName(Node));
  369. TCustomDriveView::Change(Node);
  370. }
  371. __finally
  372. {
  373. if (FDirectoryLoaded)
  374. {
  375. FPrevSelected = Selected;
  376. }
  377. else
  378. {
  379. assert(!FIgnoreChange);
  380. FIgnoreChange = true;
  381. try
  382. {
  383. Selected = FPrevSelected;
  384. }
  385. __finally
  386. {
  387. FIgnoreChange = false;
  388. }
  389. }
  390. }
  391. }
  392. #else
  393. TCustomDriveView::Change(Node);
  394. #endif
  395. }
  396. //---------------------------------------------------------------------------
  397. void __fastcall TCustomUnixDriveView::PerformDragDropFileOperation(
  398. TTreeNode * Node, int Effect)
  399. {
  400. if (OnDDFileOperation)
  401. {
  402. assert(DragDropFilesEx->FileList->Count > 0);
  403. assert(Node != NULL);
  404. AnsiString SourceDirectory;
  405. AnsiString TargetDirectory;
  406. SourceDirectory = ExtractFilePath(DragDropFilesEx->FileList->Items[0]->Name);
  407. TargetDirectory = NodeData(Node)->Directory;
  408. bool DoFileOperation = true;
  409. OnDDFileOperation(this, Effect, SourceDirectory, TargetDirectory,
  410. DoFileOperation);
  411. }
  412. }
  413. //---------------------------------------------------------------------------
  414. void __fastcall TCustomUnixDriveView::DDChooseEffect(int KeyState, int & Effect)
  415. {
  416. if (DropTarget != NULL)
  417. {
  418. if ((KeyState & (MK_CONTROL | MK_SHIFT)) == 0)
  419. {
  420. Effect = DROPEFFECT_Copy;
  421. }
  422. }
  423. else
  424. {
  425. Effect = DROPEFFECT_None;
  426. }
  427. TCustomDriveView::DDChooseEffect(KeyState, Effect);
  428. }
  429. //---------------------------------------------------------------------------
  430. void __fastcall TCustomUnixDriveView::UpdateDropTarget()
  431. {
  432. // should never be NULL
  433. if (DropTarget != NULL)
  434. {
  435. UpdatePath(DropTarget, false, true);
  436. }
  437. }
  438. //---------------------------------------------------------------------------
  439. void __fastcall TCustomUnixDriveView::UpdateDropSource()
  440. {
  441. // DragNode may be NULL if its parent directory was reloaded as result
  442. // of D&D operation and thus all child nodes are recreated
  443. if ((DragNode != NULL) && (DragNode->Parent != NULL))
  444. {
  445. UpdatePath(DragNode->Parent, false, true);
  446. }
  447. }
  448. //---------------------------------------------------------------------------
  449. TStrings * __fastcall TCustomUnixDriveView::DragFileList()
  450. {
  451. assert(DragNode != NULL);
  452. TStrings * FileList = new TStringList();
  453. try
  454. {
  455. #ifndef DESIGN_ONLY
  456. FileList->AddObject(ExcludeTrailingBackslash(NodePathName(DragNode)),
  457. NodeFileForce(DragNode));
  458. #endif
  459. }
  460. catch(...)
  461. {
  462. delete FileList;
  463. throw;
  464. }
  465. return FileList;
  466. }
  467. //---------------------------------------------------------------------------
  468. bool __fastcall TCustomUnixDriveView::DragCompleteFileList()
  469. {
  470. return true;
  471. }
  472. //---------------------------------------------------------------------------
  473. TDropEffectSet __fastcall TCustomUnixDriveView::DDSourceEffects()
  474. {
  475. TDropEffectSet Result;
  476. Result << deCopy;
  477. if (DDAllowMove)
  478. {
  479. Result << deMove;
  480. }
  481. return Result;
  482. }
  483. //---------------------------------------------------------------------------
  484. AnsiString __fastcall TCustomUnixDriveView::NodePathName(TTreeNode * Node)
  485. {
  486. // same as NodePath
  487. return NodeData(Node)->Directory;
  488. }
  489. //---------------------------------------------------------------------------
  490. void __fastcall TCustomUnixDriveView::ClearDragFileList(TFileList * FileList)
  491. {
  492. if (FDummyDragFile != NULL)
  493. {
  494. SAFE_DESTROY(FDummyDragFile);
  495. }
  496. TCustomDriveView::ClearDragFileList(FileList);
  497. }
  498. //---------------------------------------------------------------------------
  499. void __fastcall TCustomUnixDriveView::AddToDragFileList(TFileList * FileList,
  500. TTreeNode * Node)
  501. {
  502. AnsiString FileName = NodePathName(Node);
  503. TRemoteFile * File = NodeFileForce(Node);
  504. if (OnDDDragFileName != NULL)
  505. {
  506. OnDDDragFileName(this, File, FileName);
  507. }
  508. FileList->AddItem(NULL, FileName);
  509. }
  510. //---------------------------------------------------------------------------
  511. AnsiString __fastcall TCustomUnixDriveView::NodePath(TTreeNode * Node)
  512. {
  513. // same as NodePathName
  514. return NodeData(Node)->Directory;
  515. }
  516. //---------------------------------------------------------------------------
  517. bool __fastcall TCustomUnixDriveView::NodeIsRecycleBin(TTreeNode * /*Node*/)
  518. {
  519. return false;
  520. }
  521. //---------------------------------------------------------------------------
  522. bool __fastcall TCustomUnixDriveView::NodePathExists(TTreeNode * /*Node*/)
  523. {
  524. return true;
  525. }
  526. //---------------------------------------------------------------------------
  527. TColor __fastcall TCustomUnixDriveView::NodeColor(TTreeNode * Node)
  528. {
  529. assert(Node != NULL);
  530. TColor Result = static_cast<TColor>(clDefaultItemColor);
  531. #ifndef DESIGN_ONLY
  532. if (FDimmHiddenDirs && !Node->Selected)
  533. {
  534. if (NodeIsHidden(Node))
  535. {
  536. Result = clGrayText;
  537. }
  538. }
  539. #endif
  540. return Result;
  541. }
  542. //---------------------------------------------------------------------------
  543. Word __fastcall TCustomUnixDriveView::NodeOverlayIndexes(TTreeNode * Node)
  544. {
  545. #ifndef DESIGN_ONLY
  546. Word Result = oiNoOverlay;
  547. // Cannot query root node for file
  548. if (Node->Parent != NULL)
  549. {
  550. TRemoteFile * File = NodeFile(Node);
  551. if ((File != NULL) && (File->IsSymLink))
  552. {
  553. // broken link cannot probably happen anyway
  554. // as broken links are treated as files
  555. Result |= File->BrokenLink ? oiBrokenLink : oiLink;
  556. }
  557. }
  558. return Result;
  559. #else
  560. return 0;
  561. #endif
  562. }
  563. //---------------------------------------------------------------------------
  564. void __fastcall TCustomUnixDriveView::GetImageIndex(TTreeNode * Node)
  565. {
  566. TCustomDriveView::GetImageIndex(Node);
  567. Node->ImageIndex = StdDirIcon;
  568. Node->SelectedIndex = StdDirSelIcon;
  569. }
  570. //---------------------------------------------------------------------------
  571. TTreeNode * __fastcall TCustomUnixDriveView::FindNodeToPath(AnsiString Path)
  572. {
  573. TTreeNode * Result = NULL;
  574. #ifndef DESIGN_ONLY
  575. if (IsUnixRootPath(Path))
  576. {
  577. if (Items->Count > 0)
  578. {
  579. Result = Items->Item[0];
  580. }
  581. }
  582. else
  583. {
  584. Result = NULL;
  585. Path = UnixExcludeTrailingBackslash(Path);
  586. TTreeNode * Parent = NULL;
  587. if (!IsUnixRootPath(Path))
  588. {
  589. Parent = FindNodeToPath(UnixExtractFileDir(Path));
  590. }
  591. if ((Parent != NULL) && (Parent->Count > 0))
  592. {
  593. AnsiString DirName = UnixExtractFileName(Path);
  594. int StartIndex = 0;
  595. int EndIndex = Parent->Count - 1;
  596. while (true)
  597. {
  598. int Index = (StartIndex + EndIndex) / 2;
  599. AnsiString NodeDir = Parent->Item[Index]->Text;
  600. // lstrcmp is used by AlphaSort()
  601. int C = lstrcmp(DirName.c_str(), NodeDir.c_str());
  602. if (C == 0)
  603. {
  604. Result = Parent->Item[Index];
  605. break;
  606. }
  607. else if (C < 0)
  608. {
  609. if (Index == StartIndex)
  610. {
  611. break;
  612. }
  613. EndIndex = Index - 1;
  614. }
  615. else
  616. {
  617. if (Index == EndIndex)
  618. {
  619. break;
  620. }
  621. StartIndex = Index + 1;
  622. }
  623. }
  624. }
  625. }
  626. #endif
  627. return Result;
  628. }
  629. //---------------------------------------------------------------------------
  630. TTreeNode * __fastcall TCustomUnixDriveView::FindPathNode(AnsiString Path)
  631. {
  632. TTreeNode * Result = NULL;
  633. #ifndef DESIGN_ONLY
  634. if (Items->Count > 0)
  635. {
  636. do
  637. {
  638. Result = FindNodeToPath(Path);
  639. if (Result == NULL)
  640. {
  641. assert(!IsUnixRootPath(Path));
  642. Path = UnixExtractFileDir(UnixExcludeTrailingBackslash(Path));
  643. }
  644. }
  645. while (Result == NULL);
  646. }
  647. #endif
  648. return Result;
  649. }
  650. //---------------------------------------------------------------------------
  651. void __fastcall TCustomUnixDriveView::ValidateDirectoryEx(TTreeNode * /*Node*/,
  652. TRecursiveScan /*Recurse*/, bool /*NewDirs*/)
  653. {
  654. // nothing
  655. }
  656. //---------------------------------------------------------------------------
  657. void __fastcall TCustomUnixDriveView::RebuildTree()
  658. {
  659. if (Items->Count > 0)
  660. {
  661. UpdatePath(Items->Item[0], true);
  662. }
  663. }
  664. //---------------------------------------------------------------------------
  665. void __fastcall TCustomUnixDriveView::SetShowInaccesibleDirectories(bool value)
  666. {
  667. if (FShowInaccesibleDirectories != value)
  668. {
  669. FShowInaccesibleDirectories = value;
  670. RebuildTree();
  671. }
  672. }
  673. //---------------------------------------------------------------------------
  674. void __fastcall TCustomUnixDriveView::CMShowingChanged(TMessage & Message)
  675. {
  676. TCustomDriveView::Dispatch(&Message);
  677. if (Showing && (Terminal != NULL))
  678. {
  679. LoadDirectory();
  680. }
  681. }
  682. //---------------------------------------------------------------------------
  683. void __fastcall TCustomUnixDriveView::DisplayContextMenu(TTreeNode * /*Node*/,
  684. const TPoint & /*ScreenPos*/)
  685. {
  686. // TODO
  687. }
  688. //---------------------------------------------------------------------------
  689. void __fastcall TCustomUnixDriveView::DisplayPropertiesMenu(TTreeNode * /*Node*/)
  690. {
  691. // TODO
  692. }