LocationProfiles.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. //---------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <ScpMain.h>
  5. #include <Configuration.h>
  6. #include <RemoteFiles.h>
  7. #include <VCLCommon.h>
  8. #include <TextsWin.h>
  9. #include <Common.h>
  10. #include "LocationProfiles.h"
  11. #include "WinConfiguration.h"
  12. //---------------------------------------------------------------------
  13. #pragma link "XPGroupBox"
  14. #pragma link "IEComboBox"
  15. #pragma resource "*.dfm"
  16. //---------------------------------------------------------------------
  17. bool __fastcall LocationProfilesDialog(TOpenDirectoryMode Mode,
  18. TOperationSide Side, AnsiString & LocalDirectory, AnsiString & RemoteDirectory,
  19. TStrings * RemoteDirectories, TTerminal * Terminal)
  20. {
  21. bool Result;
  22. TLocationProfilesDialog * Dialog = new TLocationProfilesDialog(Application);
  23. try
  24. {
  25. Dialog->LocalDirectory = LocalDirectory;
  26. Dialog->RemoteDirectory = RemoteDirectory;
  27. Dialog->OperationSide = Side;
  28. Dialog->Terminal = Terminal;
  29. Dialog->RemoteDirectories = RemoteDirectories;
  30. Dialog->Mode = Mode;
  31. Result = Dialog->Execute();
  32. if (Result)
  33. {
  34. LocalDirectory = Dialog->LocalDirectory;
  35. RemoteDirectory = Dialog->RemoteDirectory;
  36. }
  37. }
  38. __finally
  39. {
  40. delete Dialog;
  41. }
  42. return Result;
  43. }
  44. //---------------------------------------------------------------------
  45. __fastcall TLocationProfilesDialog::TLocationProfilesDialog(TComponent * AOwner):
  46. TForm(AOwner)
  47. {
  48. FOperationSide = osLocal;
  49. FBookmarkDragSource = NULL;
  50. FTerminal = NULL;
  51. FBookmarkList = new TBookmarkList();
  52. FChanging = false;
  53. FFolders = new TStringList;
  54. FFolders->CaseSensitive = false;
  55. FFolders->Sorted = true;
  56. FFolders->Duplicates = dupIgnore;
  57. UseSystemSettings(this);
  58. }
  59. //---------------------------------------------------------------------
  60. __fastcall TLocationProfilesDialog::~TLocationProfilesDialog()
  61. {
  62. SAFE_DESTROY(FBookmarkList);
  63. }
  64. //---------------------------------------------------------------------------
  65. void __fastcall TLocationProfilesDialog::SetLocalDirectory(AnsiString value)
  66. {
  67. if (LocalDirectory != value)
  68. {
  69. LocalDirectoryEdit->Text = value;
  70. FindProfile();
  71. UpdateControls();
  72. }
  73. }
  74. //---------------------------------------------------------------------------
  75. AnsiString __fastcall TLocationProfilesDialog::GetLocalDirectory()
  76. {
  77. return ExcludeTrailingBackslash(LocalDirectoryEdit->Text);
  78. }
  79. //---------------------------------------------------------------------------
  80. void __fastcall TLocationProfilesDialog::SetRemoteDirectory(AnsiString value)
  81. {
  82. if (RemoteDirectory != value)
  83. {
  84. RemoteDirectoryEdit->Text = value;
  85. FindProfile();
  86. UpdateControls();
  87. }
  88. }
  89. //---------------------------------------------------------------------------
  90. AnsiString __fastcall TLocationProfilesDialog::GetRemoteDirectory()
  91. {
  92. return UnixExcludeTrailingBackslash(RemoteDirectoryEdit->Text);
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TLocationProfilesDialog::SetRemoteDirectories(TStrings * value)
  96. {
  97. RemoteDirectoryEdit->Items = value;
  98. }
  99. //---------------------------------------------------------------------------
  100. TStrings * __fastcall TLocationProfilesDialog::GetRemoteDirectories()
  101. {
  102. return RemoteDirectoryEdit->Items;
  103. }
  104. //---------------------------------------------------------------------------
  105. void __fastcall TLocationProfilesDialog::FindProfile()
  106. {
  107. TTreeNode * Match = NULL;
  108. for (int Index = 0; Index < ProfilesView->Items->Count; Index++)
  109. {
  110. TTreeNode * Node = ProfilesView->Items->Item[Index];
  111. if (Node->Data)
  112. {
  113. TBookmark * Bookmark = (TBookmark *)Node->Data;
  114. if (Bookmark->Local == LocalDirectory &&
  115. Bookmark->Remote == RemoteDirectory)
  116. {
  117. Match = Node;
  118. break;
  119. }
  120. }
  121. }
  122. if (Match)
  123. {
  124. ProfilesView->Selected = Match;
  125. Match->MakeVisible();
  126. }
  127. else
  128. {
  129. ProfilesView->Selected = NULL;
  130. }
  131. }
  132. //---------------------------------------------------------------------------
  133. void __fastcall TLocationProfilesDialog::ControlChange(TObject * /*Sender*/)
  134. {
  135. UpdateControls();
  136. }
  137. //---------------------------------------------------------------------------
  138. void __fastcall TLocationProfilesDialog::UpdateControls()
  139. {
  140. EnableControl(OKBtn, !LocalDirectory.IsEmpty() || !RemoteDirectory.IsEmpty());
  141. EnableControl(AddBookmarkButton,
  142. !LocalDirectory.IsEmpty() || !RemoteDirectory.IsEmpty());
  143. EnableControl(RemoveBookmarkButton, ProfilesView->Selected);
  144. EnableControl(RenameButton, ProfilesView->Selected);
  145. EnableControl(MoveToButton, ProfilesView->Selected && ProfilesView->Selected->Data);
  146. EnableControl(UpBookmarkButton, ProfilesView->Selected &&
  147. ProfilesView->Selected->Data && ProfilesView->Selected->getPrevSibling() &&
  148. ProfilesView->Selected->getPrevSibling()->Data);
  149. EnableControl(DownBookmarkButton, ProfilesView->Selected &&
  150. ProfilesView->Selected->Data && ProfilesView->Selected->getNextSibling() &&
  151. ProfilesView->Selected->getNextSibling()->Data);
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TLocationProfilesDialog::LoadBookmarks()
  155. {
  156. assert(FBookmarkList);
  157. FFolders->Clear();
  158. for (int Index = 0; Index < FBookmarkList->Count; Index++)
  159. {
  160. TBookmark * Bookmark = FBookmarkList->Bookmarks[Index];
  161. if (!Bookmark->Node.IsEmpty())
  162. {
  163. FFolders->Add(Bookmark->Node);
  164. }
  165. }
  166. ProfilesView->Items->Clear();
  167. for (int Index = 0; Index < FFolders->Count; Index++)
  168. {
  169. FFolders->Objects[Index] = ProfilesView->Items->Add(NULL, FFolders->Strings[Index]);
  170. }
  171. for (int Index = 0; Index < FBookmarkList->Count; Index++)
  172. {
  173. TBookmark * Bookmark = FBookmarkList->Bookmarks[Index];
  174. TTreeNode * Parent = NULL;
  175. if (!Bookmark->Node.IsEmpty())
  176. {
  177. assert(FFolders->IndexOf(Bookmark->Node) >= 0);
  178. Parent = dynamic_cast<TTreeNode *>(FFolders->Objects[FFolders->IndexOf(Bookmark->Node)]);
  179. }
  180. ProfilesView->Items->AddChildObject(Parent, Bookmark->Name, Bookmark);
  181. }
  182. }
  183. //---------------------------------------------------------------------------
  184. bool __fastcall TLocationProfilesDialog::Execute()
  185. {
  186. bool Result;
  187. if (Terminal)
  188. {
  189. TBookmarkList * BookmarkList;
  190. BookmarkList = WinConfiguration->Bookmarks[Terminal->SessionData->SessionKey];
  191. if (BookmarkList)
  192. {
  193. FBookmarkList->Assign(BookmarkList);
  194. }
  195. else
  196. {
  197. FBookmarkList->Clear();
  198. }
  199. LoadBookmarks();
  200. }
  201. Result = ((Mode != odAddBookmark) || AddAsBookmark()) && (ShowModal() == mrOk);
  202. if (Terminal)
  203. {
  204. WinConfiguration->Bookmarks[Terminal->SessionData->SessionKey] = FBookmarkList;
  205. }
  206. return Result;
  207. }
  208. //---------------------------------------------------------------------------
  209. bool __fastcall TLocationProfilesDialog::AddAsBookmark()
  210. {
  211. assert(!LocalDirectory.IsEmpty() || !RemoteDirectory.IsEmpty());
  212. bool Result;
  213. AnsiString BookmarkName;
  214. if ((OperationSide == osLocal && !LocalDirectory.IsEmpty()) ||
  215. RemoteDirectory.IsEmpty())
  216. {
  217. BookmarkName = LocalDirectory;
  218. }
  219. else
  220. {
  221. BookmarkName = RemoteDirectory;
  222. }
  223. Result = InputDialog(LoadStr(ADD_BOOKMARK_CAPTION), LoadStr(ADD_BOOKMARK_PROMPT), BookmarkName);
  224. if (Result)
  225. {
  226. if (BookmarkName.IsEmpty() || (StrToIntDef(BookmarkName, -123) != -123))
  227. {
  228. throw Exception(FMTLOAD(BOOKMARK_INVALID_NAME, (BookmarkName)));
  229. }
  230. TBookmark * Bookmark = new TBookmark();
  231. Bookmark->Name = BookmarkName;
  232. Bookmark->Local = LocalDirectory;
  233. Bookmark->Remote = RemoteDirectory;
  234. TTreeNode * Selected = ProfilesView->Selected;
  235. if (Selected && Selected->Data)
  236. {
  237. TBookmark * SelectedBookmark = (TBookmark *)Selected->Data;
  238. Bookmark->Node = SelectedBookmark->Node;
  239. FBookmarkList->InsertBefore(SelectedBookmark, Bookmark);
  240. Selected = ProfilesView->Items->InsertObject(Selected, Bookmark->Name, Bookmark);
  241. }
  242. else if (Selected && !Selected->Data)
  243. {
  244. // must be a folder
  245. assert(!Selected->Parent); // more than one level of folders is not supported
  246. Bookmark->Node = Selected->Text;
  247. FBookmarkList->Add(Bookmark);
  248. Selected = ProfilesView->Items->AddChildObject(Selected, Bookmark->Name, Bookmark);
  249. }
  250. else
  251. {
  252. FBookmarkList->Add(Bookmark);
  253. Selected = ProfilesView->Items->AddObject(NULL, Bookmark->Name, Bookmark);
  254. }
  255. ProfilesView->Selected = Selected;
  256. }
  257. UpdateControls();
  258. return Result;
  259. }
  260. //---------------------------------------------------------------------------
  261. void __fastcall TLocationProfilesDialog::AddBookmarkButtonClick(TObject */*Sender*/)
  262. {
  263. AddAsBookmark();
  264. }
  265. //---------------------------------------------------------------------------
  266. void __fastcall TLocationProfilesDialog::RemoveBookmarkButtonClick(TObject * /*Sender*/)
  267. {
  268. assert(ProfilesView->Selected);
  269. TTreeNode * Node = ProfilesView->Selected;
  270. if (Node->Data)
  271. {
  272. FBookmarkList->Delete((TBookmark *)Node->Data);
  273. TTreeNode * ParentNode = Node->Parent;
  274. Node->Delete();
  275. if (ParentNode && !ParentNode->Count)
  276. {
  277. assert(FFolders->IndexOfObject(ParentNode) >= 0);
  278. FFolders->Delete(FFolders->IndexOfObject(ParentNode));
  279. ParentNode->Delete();
  280. }
  281. }
  282. else
  283. {
  284. if (MessageDialog(LoadStr(DELETE_BOOKMARK_FOLDER), qtConfirmation,
  285. qaYes | qaNo, 0) == qaYes)
  286. {
  287. assert(Node->Count);
  288. for (int i = 0; i < Node->Count; i++)
  289. {
  290. FBookmarkList->Delete((TBookmark *)Node->Item[i]->Data);
  291. }
  292. assert(FFolders->IndexOfObject(Node) >= 0);
  293. FFolders->Delete(FFolders->IndexOfObject(Node));
  294. Node->Delete();
  295. }
  296. }
  297. UpdateControls();
  298. }
  299. //---------------------------------------------------------------------------
  300. void __fastcall TLocationProfilesDialog::BookmarkMove(
  301. TTreeNode * Source, TTreeNode * Dest)
  302. {
  303. assert(Source && Source->Data);
  304. TBookmark * Bookmark = (TBookmark *)Source->Data;
  305. TTreeNode * PrevFolderNode = Source->Parent;
  306. if (!Dest || !Dest->Data)
  307. {
  308. Bookmark->Node = Dest ? Dest->Text : AnsiString("");
  309. FBookmarkList->MoveAtEnd(Bookmark);
  310. ProfilesView->Selected->MoveTo(Dest, naAddChild);
  311. }
  312. else
  313. {
  314. TBookmark * DestBookmark = (TBookmark *)Dest->Data;
  315. Bookmark->Node = DestBookmark->Node;
  316. FBookmarkList->MoveBefore(DestBookmark, Bookmark);
  317. Source->MoveTo(Dest, naInsert);
  318. }
  319. if (PrevFolderNode && !PrevFolderNode->Count)
  320. {
  321. assert(FFolders->IndexOfObject(PrevFolderNode) >= 0);
  322. FFolders->Delete(FFolders->IndexOfObject(PrevFolderNode));
  323. PrevFolderNode->Delete();
  324. }
  325. Source->MakeVisible();
  326. UpdateControls();
  327. }
  328. //---------------------------------------------------------------------------
  329. void __fastcall TLocationProfilesDialog::BookmarkButtonClick(TObject *Sender)
  330. {
  331. TTreeNode * Node = ProfilesView->Selected;
  332. assert(Node);
  333. assert(Node->Data);
  334. TTreeNode * TargetNode;
  335. if (Sender == UpBookmarkButton)
  336. {
  337. TargetNode = Node->getPrevSibling();
  338. assert(TargetNode);
  339. }
  340. else
  341. {
  342. TargetNode = Node->getNextSibling();
  343. assert(TargetNode);
  344. TargetNode = TargetNode->getNextSibling();
  345. }
  346. BookmarkMove(Node, TargetNode ? TargetNode : Node->Parent);
  347. }
  348. //---------------------------------------------------------------------------
  349. void __fastcall TLocationProfilesDialog::ProfilesViewStartDrag(
  350. TObject * /*Sender*/ , TDragObject *& /*DragObject*/)
  351. {
  352. if (!ProfilesView->Selected->Data)
  353. {
  354. Abort();
  355. }
  356. FBookmarkDragSource = ProfilesView->Selected;
  357. }
  358. //---------------------------------------------------------------------------
  359. void __fastcall TLocationProfilesDialog::ProfilesViewDragOver(
  360. TObject */*Sender*/, TObject *Source, int /*X*/, int /*Y*/,
  361. TDragState /*State*/, bool &Accept)
  362. {
  363. if (Source == ProfilesView)
  364. {
  365. Accept = FBookmarkDragSource != ProfilesView->DropTarget;
  366. }
  367. }
  368. //---------------------------------------------------------------------------
  369. void __fastcall TLocationProfilesDialog::ProfilesViewDragDrop(
  370. TObject * /*Sender*/, TObject * Source, int /*X*/, int /*Y*/)
  371. {
  372. if ((Source == ProfilesView) && (FBookmarkDragSource != ProfilesView->DropTarget))
  373. {
  374. assert(FBookmarkDragSource);
  375. TTreeNode * Target = ProfilesView->DropTarget;
  376. if (Target->Data && (Target->AbsoluteIndex > FBookmarkDragSource->AbsoluteIndex))
  377. {
  378. Target = Target->getNextSibling() ? Target->getNextSibling() : Target->Parent;
  379. }
  380. BookmarkMove(FBookmarkDragSource, Target);
  381. FBookmarkDragSource = NULL;
  382. }
  383. }
  384. //---------------------------------------------------------------------------
  385. void __fastcall TLocationProfilesDialog::ProfilesViewDblClick(TObject * /*Sender*/)
  386. {
  387. TPoint P = ProfilesView->ScreenToClient(Mouse->CursorPos);
  388. TTreeNode * Node = ProfilesView->GetNodeAt(P.x, P.y);
  389. if (OKBtn->Enabled && Node && Node->Data && Node->Selected)
  390. {
  391. ModalResult = mrOk;
  392. }
  393. }
  394. //---------------------------------------------------------------------------
  395. void __fastcall TLocationProfilesDialog::FormShow(TObject * /*Sender*/)
  396. {
  397. FindProfile();
  398. if (OperationSide == osLocal)
  399. {
  400. LocalDirectoryEdit->SetFocus();
  401. }
  402. else
  403. {
  404. RemoteDirectoryEdit->SetFocus();
  405. }
  406. UpdateControls();
  407. }
  408. //---------------------------------------------------------------------------
  409. void __fastcall TLocationProfilesDialog::ProfilesViewKeyDown(TObject * /*Sender*/,
  410. WORD &Key, TShiftState /*Shift*/)
  411. {
  412. if (RemoveBookmarkButton->Enabled && (Key == VK_DELETE))
  413. {
  414. RemoveBookmarkButtonClick(NULL);
  415. }
  416. }
  417. //---------------------------------------------------------------------------
  418. void __fastcall TLocationProfilesDialog::DirectoryEditChange(
  419. TObject * /*Sender*/)
  420. {
  421. if (!FChanging)
  422. {
  423. FindProfile();
  424. UpdateControls();
  425. }
  426. }
  427. //---------------------------------------------------------------------------
  428. void __fastcall TLocationProfilesDialog::ProfilesViewChange(
  429. TObject * /*Sender*/, TTreeNode * Node)
  430. {
  431. if (Node && Node->Data)
  432. {
  433. assert(!FChanging);
  434. FChanging = true;
  435. try
  436. {
  437. LocalDirectoryEdit->Text = ((TBookmark *)Node->Data)->Local;
  438. RemoteDirectoryEdit->Text = ((TBookmark *)Node->Data)->Remote;
  439. }
  440. __finally
  441. {
  442. FChanging = false;
  443. }
  444. }
  445. UpdateControls();
  446. }
  447. //---------------------------------------------------------------------------
  448. void __fastcall TLocationProfilesDialog::MoveToButtonClick(TObject * /*Sender*/)
  449. {
  450. assert(ProfilesView->Selected->Data);
  451. TBookmark * Bookmark = (TBookmark *)ProfilesView->Selected->Data;
  452. AnsiString Name = Bookmark->Node;
  453. if (DoComboInputDialog(LoadStr(MOVE_BOOKMARK_CAPTION), LoadStr(MOVE_BOOKMARK_PROMPT),
  454. Name, FFolders, NULL, true) && Name != Bookmark->Node)
  455. {
  456. if (Name.Pos("\\"))
  457. {
  458. throw Exception(FMTLOAD(BOOKMARK_FOLDER_INVALID_NAME, (Name)));
  459. }
  460. TTreeNode * FolderNode;
  461. int I = FFolders->IndexOf(Name);
  462. if (Name.IsEmpty())
  463. {
  464. FolderNode = NULL;
  465. }
  466. else if (I >= 0)
  467. {
  468. FolderNode = dynamic_cast<TTreeNode *>(FFolders->Objects[I]);
  469. assert(FolderNode);
  470. }
  471. else
  472. {
  473. I = FFolders->Add(Name);
  474. TTreeNode * NextNode;
  475. // duplicated in RenameButtonClick()
  476. if (I < FFolders->Count-1)
  477. {
  478. NextNode = dynamic_cast<TTreeNode *>(FFolders->Objects[I+1]);
  479. assert(NextNode);
  480. }
  481. else if (FFolders->Count > 1)
  482. {
  483. NextNode = (dynamic_cast<TTreeNode *>(FFolders->Objects[I-1]))->getNextSibling();
  484. }
  485. else
  486. {
  487. assert(ProfilesView->Items->Count);
  488. NextNode = ProfilesView->Items->Item[0];
  489. }
  490. FolderNode = ProfilesView->Items->Insert(NextNode, Name);
  491. assert(FolderNode);
  492. FFolders->Objects[I] = FolderNode;
  493. }
  494. BookmarkMove(ProfilesView->Selected, FolderNode);
  495. }
  496. }
  497. //---------------------------------------------------------------------------
  498. void __fastcall TLocationProfilesDialog::RenameButtonClick(TObject * /*Sender*/)
  499. {
  500. assert(ProfilesView->Selected);
  501. TTreeNode * Node = ProfilesView->Selected;
  502. AnsiString Name = Node->Text;
  503. if (InputDialog(LoadStr(RENAME_BOOKMARK_CAPTION), LoadStr(RENAME_BOOKMARK_PROMPT),
  504. Name) && (Name != Node->Text))
  505. {
  506. if (Node->Data)
  507. {
  508. if (Name.IsEmpty() || (StrToIntDef(Name, -123) != -123))
  509. {
  510. throw Exception(FMTLOAD(BOOKMARK_INVALID_NAME, (Name)));
  511. }
  512. // raises exception in case of duplicate name??
  513. ((TBookmark *)Node->Data)->Name = Name;
  514. Node->Text = Name;
  515. }
  516. else
  517. {
  518. if (Name.IsEmpty() || Name.Pos("\\"))
  519. {
  520. throw Exception(FMTLOAD(BOOKMARK_FOLDER_INVALID_NAME, (Name)));
  521. }
  522. if ((FFolders->IndexOf(Name) >= 0) && AnsiCompareText(Name, Node->Text))
  523. {
  524. throw Exception(FMTLOAD(DUPLICATE_BOOKMARK_FOLDER, (Name)));
  525. }
  526. assert(Node->Count);
  527. FFolders->Delete(FFolders->IndexOf(Node->Text));
  528. int I = FFolders->AddObject(Name, Node);
  529. TTreeNode * NextNode;
  530. // duplicated in MoveToButtonClick()
  531. if (I < FFolders->Count-1)
  532. {
  533. NextNode = dynamic_cast<TTreeNode *>(FFolders->Objects[I+1]);
  534. assert(NextNode);
  535. }
  536. else if (FFolders->Count > 1)
  537. {
  538. NextNode = (dynamic_cast<TTreeNode *>(FFolders->Objects[I-1]))->getNextSibling();
  539. }
  540. else
  541. {
  542. assert(ProfilesView->Items->Count);
  543. NextNode = ProfilesView->Items->Item[0];
  544. }
  545. if (NextNode != Node)
  546. {
  547. Node->MoveTo(NextNode, NextNode ? naInsert : naAddChild);
  548. }
  549. Node->Text = Name;
  550. for (int i = 0; i < Node->Count; i++)
  551. {
  552. ((TBookmark *)Node->Item[i]->Data)->Node = Name;
  553. }
  554. Node->MakeVisible();
  555. }
  556. }
  557. UpdateControls();
  558. }
  559. //---------------------------------------------------------------------------
  560. void __fastcall TLocationProfilesDialog::ProfilesViewGetImageIndex(
  561. TObject * /*Sender*/, TTreeNode * Node)
  562. {
  563. Node->ImageIndex = Node->Data ? 0 : (Node->Expanded ? 1 : 2);
  564. }
  565. //---------------------------------------------------------------------------
  566. void __fastcall TLocationProfilesDialog::ProfilesViewGetSelectedIndex(
  567. TObject * /*Sender*/, TTreeNode * Node)
  568. {
  569. Node->SelectedIndex = Node->Data ? 0 : (Node->Expanded ? 1 : 2);
  570. }
  571. //---------------------------------------------------------------------------