Custom.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. //---------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Dialogs.hpp>
  5. //---------------------------------------------------------------------
  6. #include <Common.h>
  7. #include <CustomWinConfiguration.h>
  8. #include <WinInterface.h>
  9. #include <VCLCommon.h>
  10. #include <TextsWin.h>
  11. #include <HelpWin.h>
  12. #include <CoreMain.h>
  13. #include <PasTools.hpp>
  14. #include <ProgParams.h>
  15. #include <Tools.h>
  16. #include "Custom.h"
  17. //---------------------------------------------------------------------
  18. #pragma link "PasswordEdit"
  19. #ifndef NO_RESOURCES
  20. #pragma resource "*.dfm"
  21. #endif
  22. //---------------------------------------------------------------------
  23. __fastcall TCustomDialog::TCustomDialog(UnicodeString AHelpKeyword)
  24. : TForm(GetFormOwner())
  25. {
  26. UseSystemSettings(this);
  27. FPos = ScaleByTextHeight(this, 8);
  28. HelpKeyword = AHelpKeyword;
  29. TBorderIcons BI = BorderIcons;
  30. if (HelpKeyword.IsEmpty())
  31. {
  32. BI >> biHelp;
  33. OKButton->Left = CancelButton->Left;
  34. CancelButton->Left = HelpButton->Left;
  35. HelpButton->Visible = false;
  36. }
  37. else
  38. {
  39. BI << biHelp;
  40. }
  41. BorderIcons = BI;
  42. }
  43. //---------------------------------------------------------------------
  44. bool __fastcall TCustomDialog::Execute()
  45. {
  46. Changed();
  47. return (ShowModal() == DefaultResult(this));
  48. }
  49. //---------------------------------------------------------------------
  50. void __fastcall TCustomDialog::DoChange(bool & /*CanSubmit*/)
  51. {
  52. // noop
  53. }
  54. //---------------------------------------------------------------------
  55. void __fastcall TCustomDialog::Changed()
  56. {
  57. bool CanSubmit = true;
  58. DoChange(CanSubmit);
  59. EnableControl(OKButton, CanSubmit);
  60. }
  61. //---------------------------------------------------------------------
  62. void __fastcall TCustomDialog::Change(TObject * /*Sender*/)
  63. {
  64. Changed();
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TCustomDialog::HelpButtonClick(TObject * /*Sender*/)
  68. {
  69. FormHelp(this);
  70. }
  71. //---------------------------------------------------------------------------
  72. void __fastcall TCustomDialog::DoShow()
  73. {
  74. OKButton->TabOrder = FCount;
  75. CancelButton->TabOrder = static_cast<short>(FCount + 1);
  76. HelpButton->TabOrder = static_cast<short>(FCount + 2);
  77. Changed();
  78. TForm::DoShow();
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TCustomDialog::DoValidate()
  82. {
  83. // noop
  84. }
  85. //---------------------------------------------------------------------------
  86. bool __fastcall TCustomDialog::CloseQuery()
  87. {
  88. if (ModalResult == DefaultResult(this))
  89. {
  90. DoValidate();
  91. }
  92. return TForm::CloseQuery();
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TCustomDialog::AddWinControl(TWinControl * Control)
  96. {
  97. Control->TabOrder = FCount;
  98. FCount++;
  99. }
  100. //---------------------------------------------------------------------------
  101. TLabel * __fastcall TCustomDialog::CreateLabel(UnicodeString Label)
  102. {
  103. TLabel * Result = new TLabel(this);
  104. Result->Caption = Label;
  105. return Result;
  106. }
  107. //---------------------------------------------------------------------------
  108. void __fastcall TCustomDialog::AddEditLikeControl(TWinControl * Edit, TLabel * Label)
  109. {
  110. int PrePos = FPos;
  111. Label->Parent = this;
  112. Label->Left = ScaleByTextHeight(this, 8);
  113. Label->Top = FPos;
  114. FPos += Label->Height + ScaleByTextHeight(this, 4);
  115. Edit->Parent = this;
  116. Edit->Left = ScaleByTextHeight(this, 8);
  117. Edit->Top = FPos;
  118. Edit->Width = ClientWidth - (Edit->Left * 2);
  119. // this updates Height property to real value
  120. Edit->HandleNeeded();
  121. FPos += Edit->Height + ScaleByTextHeight(this, 8);
  122. if (Label->FocusControl == NULL)
  123. {
  124. Label->FocusControl = Edit;
  125. }
  126. else
  127. {
  128. assert(Label->FocusControl == Edit);
  129. }
  130. ClientHeight = ClientHeight + (FPos - PrePos);
  131. AddWinControl(Edit);
  132. }
  133. //---------------------------------------------------------------------------
  134. void __fastcall TCustomDialog::AddEdit(TCustomEdit * Edit, TLabel * Label)
  135. {
  136. AddEditLikeControl(Edit, Label);
  137. TEdit * PublicEdit = reinterpret_cast<TEdit *>(Edit);
  138. if (PublicEdit->OnChange == NULL)
  139. {
  140. PublicEdit->OnChange = Change;
  141. }
  142. }
  143. //---------------------------------------------------------------------------
  144. void __fastcall TCustomDialog::AddComboBox(TCustomCombo * Combo, TLabel * Label)
  145. {
  146. AddEditLikeControl(Combo, Label);
  147. TComboBox * PublicCombo = reinterpret_cast<TComboBox *>(Combo);
  148. if (PublicCombo->OnChange == NULL)
  149. {
  150. PublicCombo->OnChange = Change;
  151. }
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TCustomDialog::AddButtonControl(TButtonControl * Control)
  155. {
  156. int PrePos = FPos;
  157. Control->Parent = this;
  158. Control->Left = ScaleByTextHeight(this, 14);
  159. Control->Top = FPos;
  160. Control->Width = ClientWidth - Control->Left - ScaleByTextHeight(this, 8);
  161. // this updates Height property to real value
  162. Control->HandleNeeded();
  163. // buttons do not scale with text on their own
  164. Control->Height = ScaleByTextHeight(Control, Control->Height);
  165. FPos += Control->Height + ScaleByTextHeight(this, 8);
  166. ClientHeight = ClientHeight + (FPos - PrePos);
  167. AddWinControl(Control);
  168. TCheckBox * PublicControl = reinterpret_cast<TCheckBox *>(Control);
  169. if (PublicControl->OnClick == NULL)
  170. {
  171. PublicControl->OnClick = Change;
  172. }
  173. }
  174. //---------------------------------------------------------------------------
  175. //---------------------------------------------------------------------------
  176. class TSaveSessionDialog : public TCustomDialog
  177. {
  178. public:
  179. __fastcall TSaveSessionDialog(TComponent* AOwner);
  180. void __fastcall Init(bool CanSavePassword, bool NotRecommendedSavingPassword);
  181. bool __fastcall Execute(UnicodeString & SessionName, bool & SavePassword,
  182. bool & CreateShortcut, const UnicodeString & OriginalSessionName);
  183. protected:
  184. virtual void __fastcall DoValidate();
  185. virtual void __fastcall DoChange(bool & CanSubmit);
  186. private:
  187. UnicodeString FOriginalSessionName;
  188. TEdit * SessionNameEdit;
  189. TComboBox * FolderCombo;
  190. TCheckBox * SavePasswordCheck;
  191. TCheckBox * CreateShortcutCheck;
  192. UnicodeString FRootFolder;
  193. UnicodeString __fastcall GetSessionName();
  194. };
  195. //---------------------------------------------------------------------------
  196. // Need to have an Owner argument for SafeFormCreate
  197. __fastcall TSaveSessionDialog::TSaveSessionDialog(TComponent* /*AOwner*/) :
  198. TCustomDialog(HELP_SESSION_SAVE)
  199. {
  200. }
  201. //---------------------------------------------------------------------------
  202. void __fastcall TSaveSessionDialog::Init(bool CanSavePassword, bool NotRecommendedSavingPassword)
  203. {
  204. Caption = LoadStr(SAVE_SESSION_CAPTION);
  205. SessionNameEdit = new TEdit(this);
  206. AddEdit(SessionNameEdit, CreateLabel(LoadStr(SAVE_SESSION_PROMPT)));
  207. FolderCombo = new TComboBox(this);
  208. AddComboBox(FolderCombo, CreateLabel(LoadStr(SAVE_SESSION_FOLDER)));
  209. FolderCombo->Items->BeginUpdate();
  210. try
  211. {
  212. FRootFolder = LoadStr(SAVE_SESSION_ROOT_FOLDER);
  213. FolderCombo->Items->Add(FRootFolder);
  214. for (int Index = 0; Index < StoredSessions->Count; Index++)
  215. {
  216. TSessionData * Data = StoredSessions->Sessions[Index];
  217. if (!Data->Special && !Data->IsWorkspace)
  218. {
  219. UnicodeString Folder = Data->FolderName;
  220. if (!Folder.IsEmpty() && FolderCombo->Items->IndexOf(Folder) < 0)
  221. {
  222. FolderCombo->Items->Add(Folder);
  223. }
  224. }
  225. }
  226. }
  227. __finally
  228. {
  229. FolderCombo->Items->EndUpdate();
  230. }
  231. SavePasswordCheck = new TCheckBox(this);
  232. SavePasswordCheck->Caption = LoadStr(
  233. NotRecommendedSavingPassword ? SAVE_SESSION_PASSWORD :
  234. (CustomWinConfiguration->UseMasterPassword ? SAVE_SESSION_PASSWORD_MASTER : SAVE_SESSION_PASSWORD_RECOMMENDED));
  235. AddButtonControl(SavePasswordCheck);
  236. CreateShortcutCheck = new TCheckBox(this);
  237. CreateShortcutCheck->Caption = LoadStr(SAVE_SITE_WORKSPACE_SHORTCUT);
  238. AddButtonControl(CreateShortcutCheck);
  239. EnableControl(SavePasswordCheck, CanSavePassword);
  240. }
  241. //---------------------------------------------------------------------------
  242. bool __fastcall TSaveSessionDialog::Execute(
  243. UnicodeString & SessionName, bool & SavePassword, bool & CreateShortcut,
  244. const UnicodeString & OriginalSessionName)
  245. {
  246. FOriginalSessionName = OriginalSessionName;
  247. SessionNameEdit->Text = TSessionData::ExtractLocalName(SessionName);
  248. UnicodeString Folder = TSessionData::ExtractFolderName(SessionName);
  249. if (Folder.IsEmpty())
  250. {
  251. FolderCombo->Text = FRootFolder;
  252. }
  253. else
  254. {
  255. FolderCombo->Text = Folder;
  256. }
  257. SavePasswordCheck->Checked = SavePassword;
  258. CreateShortcutCheck->Checked = CreateShortcut;
  259. bool Result = TCustomDialog::Execute();
  260. if (Result)
  261. {
  262. SessionName = GetSessionName();
  263. SavePassword = SavePasswordCheck->Checked;
  264. CreateShortcut = CreateShortcutCheck->Checked;
  265. }
  266. return Result;
  267. }
  268. //---------------------------------------------------------------------------
  269. UnicodeString __fastcall TSaveSessionDialog::GetSessionName()
  270. {
  271. UnicodeString Folder;
  272. if (FolderCombo->Text != FRootFolder)
  273. {
  274. Folder = FolderCombo->Text;
  275. }
  276. return TSessionData::ComposePath(Folder, SessionNameEdit->Text);
  277. }
  278. //---------------------------------------------------------------------------
  279. void __fastcall TSaveSessionDialog::DoValidate()
  280. {
  281. TSessionData::ValidateName(SessionNameEdit->Text);
  282. SessionNameValidate(GetSessionName(), FOriginalSessionName);
  283. UnicodeString Folder = TSessionData::ExtractFolderName(GetSessionName());
  284. if (!Folder.IsEmpty() && StoredSessions->IsWorkspace(Folder))
  285. {
  286. throw Exception(FMTLOAD(WORKSPACE_NOT_FOLDER, (Folder)));
  287. }
  288. if (SavePasswordCheck->Enabled && SavePasswordCheck->Checked &&
  289. CustomWinConfiguration->UseMasterPassword)
  290. {
  291. CustomWinConfiguration->AskForMasterPasswordIfNotSet();
  292. }
  293. TCustomDialog::DoValidate();
  294. }
  295. //---------------------------------------------------------------------------
  296. void __fastcall TSaveSessionDialog::DoChange(bool & CanSubmit)
  297. {
  298. CanSubmit = !SessionNameEdit->Text.IsEmpty();
  299. TCustomDialog::DoChange(CanSubmit);
  300. }
  301. //---------------------------------------------------------------------------
  302. TSessionData * __fastcall DoSaveSession(TSessionData * SessionData,
  303. TSessionData * OriginalSession, bool ForceDialog)
  304. {
  305. bool SavePassword = false;
  306. bool * PSavePassword;
  307. bool NotRecommendedSavingPassword =
  308. !CustomWinConfiguration->UseMasterPassword &&
  309. !SameText(SessionData->UserName, AnonymousUserName);
  310. if (Configuration->DisablePasswordStoring ||
  311. !SessionData->HasAnyPassword())
  312. {
  313. PSavePassword = NULL;
  314. }
  315. else
  316. {
  317. PSavePassword = &SavePassword;
  318. SavePassword =
  319. ((OriginalSession != NULL) &&
  320. !OriginalSession->Password.IsEmpty()) ||
  321. !NotRecommendedSavingPassword;
  322. }
  323. UnicodeString SessionName = SessionData->SessionName;
  324. bool Result;
  325. bool CreateShortcut = false;
  326. if (!ForceDialog && ((PSavePassword == NULL) || SavePassword))
  327. {
  328. CustomWinConfiguration->AskForMasterPasswordIfNotSetAndNeededToPersistSessionData(SessionData);
  329. Result = true;
  330. }
  331. else
  332. {
  333. // This can be a standalone dialog when used with save URL (from GetLoginData)
  334. TSaveSessionDialog * Dialog = SafeFormCreate<TSaveSessionDialog>();
  335. try
  336. {
  337. Dialog->Init((PSavePassword != NULL), NotRecommendedSavingPassword);
  338. Result = Dialog->Execute(SessionName, SavePassword, CreateShortcut, SessionData->Name);
  339. }
  340. __finally
  341. {
  342. delete Dialog;
  343. }
  344. }
  345. TSessionData * NewSession = NULL;
  346. if (Result)
  347. {
  348. if ((PSavePassword != NULL) && !SavePassword)
  349. {
  350. SessionData->Password = L"";
  351. }
  352. NewSession =
  353. StoredSessions->NewSession(SessionName, SessionData);
  354. // modified only, explicit
  355. StoredSessions->Save(false, true);
  356. if (CreateShortcut)
  357. {
  358. UnicodeString AdditionalParams =
  359. TProgramParams::FormatSwitch(DESKTOP_SWITCH) + L" " +
  360. TProgramParams::FormatSwitch(UPLOAD_IF_ANY_SWITCH);
  361. CreateDesktopSessionShortCut(SessionName, L"", AdditionalParams, -1, SITE_ICON);
  362. }
  363. }
  364. return NewSession;
  365. }
  366. //---------------------------------------------------------------------------
  367. void __fastcall SessionNameValidate(const UnicodeString & Text,
  368. const UnicodeString & OriginalName)
  369. {
  370. TSessionData::ValidatePath(Text);
  371. assert(StoredSessions);
  372. TSessionData * Data = (TSessionData *)StoredSessions->FindByName(Text);
  373. if (Data && Data->Special)
  374. {
  375. MessageDialog(FMTLOAD(CANNOT_OVERWRITE_SPECIAL_SESSION, (Text)),
  376. qtError, qaOK, HELP_NONE);
  377. Abort();
  378. }
  379. else if ((Data != NULL) && (Text != OriginalName) &&
  380. MessageDialog(MainInstructions(FMTLOAD(CONFIRM_OVERWRITE_SESSION, (Text))),
  381. qtConfirmation, qaYes | qaNo, HELP_SESSION_SAVE_OVERWRITE) != qaYes)
  382. {
  383. Abort();
  384. }
  385. }
  386. //---------------------------------------------------------------------------
  387. //---------------------------------------------------------------------------
  388. class TSaveWorkspaceDialog : public TCustomDialog
  389. {
  390. public:
  391. __fastcall TSaveWorkspaceDialog(bool CanSavePasswords,
  392. bool NotRecommendedSavingPasswords);
  393. bool __fastcall Execute(
  394. UnicodeString & WorkspaceName, bool & SavePasswords, bool & CreateShortcut,
  395. bool & EnableAutoSave);
  396. protected:
  397. virtual void __fastcall DoValidate();
  398. virtual void __fastcall DoChange(bool & CanSubmit);
  399. private:
  400. TComboBox * WorkspaceNameCombo;
  401. TCheckBox * SavePasswordsCheck;
  402. TCheckBox * CreateShortcutCheck;
  403. TCheckBox * EnableAutoSaveCheck;
  404. };
  405. //---------------------------------------------------------------------------
  406. __fastcall TSaveWorkspaceDialog::TSaveWorkspaceDialog(
  407. bool CanSavePasswords, bool NotRecommendedSavingPasswords) :
  408. TCustomDialog(HELP_WORKSPACE_SAVE)
  409. {
  410. Caption = LoadStr(SAVE_WORKSPACE_CAPTION);
  411. WorkspaceNameCombo = new TComboBox(this);
  412. WorkspaceNameCombo->AutoComplete = false;
  413. AddComboBox(WorkspaceNameCombo, CreateLabel(LoadStr(SAVE_WORKSPACE_PROMPT)));
  414. std::unique_ptr<TStrings> Workspaces(StoredSessions->GetWorkspaces());
  415. WorkspaceNameCombo->Items->AddStrings(Workspaces.get());
  416. SavePasswordsCheck = new TCheckBox(this);
  417. SavePasswordsCheck->Caption = LoadStr(
  418. NotRecommendedSavingPasswords ? SAVE_WORKSPACE_PASSWORDS :
  419. (CustomWinConfiguration->UseMasterPassword ?
  420. SAVE_WORKSPACE_PASSWORDS_MASTER : SAVE_WORKSPACE_PASSWORDS_RECOMMENDED));
  421. AddButtonControl(SavePasswordsCheck);
  422. EnableControl(SavePasswordsCheck, CanSavePasswords);
  423. CreateShortcutCheck = new TCheckBox(this);
  424. CreateShortcutCheck->Caption = LoadStr(SAVE_SITE_WORKSPACE_SHORTCUT);
  425. AddButtonControl(CreateShortcutCheck);
  426. EnableAutoSaveCheck = new TCheckBox(this);
  427. EnableAutoSaveCheck->Caption = LoadStr(SAVE_WORKSPACE_AUTO);
  428. AddButtonControl(EnableAutoSaveCheck);
  429. }
  430. //---------------------------------------------------------------------------
  431. bool __fastcall TSaveWorkspaceDialog::Execute(
  432. UnicodeString & WorkspaceName, bool & SavePasswords, bool & CreateShortcut,
  433. bool & EnableAutoSave)
  434. {
  435. WorkspaceNameCombo->Text = WorkspaceName;
  436. SavePasswordsCheck->Checked = SavePasswords;
  437. CreateShortcutCheck->Checked = CreateShortcut;
  438. EnableAutoSaveCheck->Checked = EnableAutoSave;
  439. bool Result = TCustomDialog::Execute();
  440. if (Result)
  441. {
  442. WorkspaceName = WorkspaceNameCombo->Text;
  443. SavePasswords = SavePasswordsCheck->Checked;
  444. CreateShortcut = CreateShortcutCheck->Checked;
  445. EnableAutoSave = EnableAutoSaveCheck->Checked;
  446. }
  447. return Result;
  448. }
  449. //---------------------------------------------------------------------------
  450. void __fastcall TSaveWorkspaceDialog::DoValidate()
  451. {
  452. TSessionData::ValidateName(WorkspaceNameCombo->Text);
  453. if (StoredSessions->IsFolder(WorkspaceNameCombo->Text))
  454. {
  455. throw Exception(FMTLOAD(FOLDER_NOT_WORKSPACE, (WorkspaceNameCombo->Text)));
  456. }
  457. if (SavePasswordsCheck->Enabled && SavePasswordsCheck->Checked &&
  458. CustomWinConfiguration->UseMasterPassword)
  459. {
  460. CustomWinConfiguration->AskForMasterPasswordIfNotSet();
  461. }
  462. TCustomDialog::DoValidate();
  463. }
  464. //---------------------------------------------------------------------------
  465. void __fastcall TSaveWorkspaceDialog::DoChange(bool & CanSubmit)
  466. {
  467. CanSubmit = !WorkspaceNameCombo->Text.IsEmpty();
  468. TCustomDialog::DoChange(CanSubmit);
  469. }
  470. //---------------------------------------------------------------------------
  471. bool __fastcall DoSaveWorkspaceDialog(UnicodeString & WorkspaceName,
  472. bool * SavePasswords, bool NotRecommendedSavingPasswords,
  473. bool & CreateShortcut, bool & EnableAutoSave)
  474. {
  475. std::unique_ptr<TSaveWorkspaceDialog> Dialog(
  476. new TSaveWorkspaceDialog((SavePasswords != NULL), NotRecommendedSavingPasswords));
  477. bool Dummy = false;
  478. if (SavePasswords == NULL)
  479. {
  480. SavePasswords = &Dummy;
  481. }
  482. return
  483. Dialog->Execute(
  484. WorkspaceName, *SavePasswords, CreateShortcut, EnableAutoSave);
  485. }
  486. //---------------------------------------------------------------------------
  487. //---------------------------------------------------------------------------
  488. class TShortCutDialog : public TCustomDialog
  489. {
  490. public:
  491. __fastcall TShortCutDialog(const TShortCuts & ShortCuts, UnicodeString HelpKeyword);
  492. bool __fastcall Execute(TShortCut & ShortCut);
  493. private:
  494. TComboBox * ShortCutCombo;
  495. };
  496. //---------------------------------------------------------------------------
  497. __fastcall TShortCutDialog::TShortCutDialog(const TShortCuts & ShortCuts, UnicodeString HelpKeyword) :
  498. TCustomDialog(HelpKeyword)
  499. {
  500. Caption = LoadStr(SHORTCUT_CAPTION);
  501. ShortCutCombo = new TComboBox(this);
  502. AddComboBox(ShortCutCombo, CreateLabel(LoadStr(SHORTCUT_LABEL)));
  503. InitializeShortCutCombo(ShortCutCombo, ShortCuts);
  504. }
  505. //---------------------------------------------------------------------------
  506. bool __fastcall TShortCutDialog::Execute(TShortCut & ShortCut)
  507. {
  508. SetShortCutCombo(ShortCutCombo, ShortCut);
  509. bool Result = TCustomDialog::Execute();
  510. if (Result)
  511. {
  512. ShortCut = GetShortCutCombo(ShortCutCombo);
  513. }
  514. return Result;
  515. }
  516. //---------------------------------------------------------------------------
  517. bool __fastcall DoShortCutDialog(TShortCut & ShortCut,
  518. const TShortCuts & ShortCuts, UnicodeString HelpKeyword)
  519. {
  520. bool Result;
  521. TShortCutDialog * Dialog = new TShortCutDialog(ShortCuts, HelpKeyword);
  522. try
  523. {
  524. Result = Dialog->Execute(ShortCut);
  525. }
  526. __finally
  527. {
  528. delete Dialog;
  529. }
  530. return Result;
  531. }