WinConfiguration.h 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  1. //---------------------------------------------------------------------------
  2. #ifndef WinConfigurationH
  3. #define WinConfigurationH
  4. //---------------------------------------------------------------------------
  5. #include "CustomWinConfiguration.h"
  6. #include "CustomDirView.hpp"
  7. #include "FileInfo.h"
  8. //---------------------------------------------------------------------------
  9. enum TEditor { edInternal, edExternal, edOpen };
  10. enum TGenerateUrlCodeTarget { guctUrl, guctScript, guctAssembly };
  11. enum TScriptFormat { sfScriptFile, sfBatchFile, sfCommandLine, sfPowerShell };
  12. enum TLocaleFlagOverride { lfoLanguageIfRecommended, lfoLanguage, lfoAlways, lfoNever };
  13. //---------------------------------------------------------------------------
  14. #define C(Property) (Property != rhc.Property) ||
  15. struct TScpExplorerConfiguration {
  16. UnicodeString WindowParams;
  17. UnicodeString DirViewParams;
  18. UnicodeString ToolbarsLayout;
  19. UnicodeString ToolbarsButtons;
  20. bool SessionsTabs;
  21. bool StatusBar;
  22. UnicodeString LastLocalTargetDirectory;
  23. int ViewStyle;
  24. bool ShowFullAddress;
  25. bool DriveView;
  26. int DriveViewWidth;
  27. int DriveViewWidthPixelsPerInch;
  28. bool __fastcall operator !=(TScpExplorerConfiguration & rhc)
  29. { return C(WindowParams) C(DirViewParams) C(ToolbarsLayout) C(ToolbarsButtons)
  30. C(SessionsTabs) C(StatusBar)
  31. C(LastLocalTargetDirectory) C(ViewStyle) C(ShowFullAddress)
  32. C(DriveView) C(DriveViewWidth) C(DriveViewWidthPixelsPerInch) 0; };
  33. };
  34. //---------------------------------------------------------------------------
  35. struct TScpCommanderPanelConfiguration {
  36. UnicodeString DirViewParams;
  37. bool StatusBar;
  38. bool DriveView;
  39. int DriveViewHeight;
  40. int DriveViewHeightPixelsPerInch;
  41. int DriveViewWidth;
  42. int DriveViewWidthPixelsPerInch;
  43. UnicodeString LastPath;
  44. bool __fastcall operator !=(TScpCommanderPanelConfiguration & rhc)
  45. { return C(DirViewParams) C(StatusBar)
  46. C(DriveView) C(DriveViewHeight) C(DriveViewHeightPixelsPerInch)
  47. C(DriveViewWidth) C(DriveViewWidthPixelsPerInch) C(LastPath) 0; };
  48. };
  49. //---------------------------------------------------------------------------
  50. struct TScpCommanderConfiguration {
  51. UnicodeString WindowParams;
  52. double LocalPanelWidth;
  53. UnicodeString ToolbarsLayout;
  54. UnicodeString ToolbarsButtons;
  55. bool SessionsTabs;
  56. bool StatusBar;
  57. TOperationSide CurrentPanel;
  58. TNortonLikeMode NortonLikeMode;
  59. bool PreserveLocalDirectory;
  60. TScpCommanderPanelConfiguration LocalPanel;
  61. TScpCommanderPanelConfiguration RemotePanel;
  62. bool CompareByTime;
  63. bool CompareBySize;
  64. bool SwappedPanels;
  65. bool TreeOnLeft;
  66. bool ExplorerKeyboardShortcuts;
  67. bool SystemContextMenu;
  68. bool __fastcall operator !=(TScpCommanderConfiguration & rhc)
  69. { return C(WindowParams) C(LocalPanelWidth) C(ToolbarsLayout) C(ToolbarsButtons)
  70. C(SessionsTabs) C(StatusBar)
  71. C(LocalPanel) C(RemotePanel) C(CurrentPanel)
  72. C(NortonLikeMode) C(PreserveLocalDirectory)
  73. C(CompareBySize) C(CompareByTime) C(SwappedPanels)
  74. C(TreeOnLeft) C(ExplorerKeyboardShortcuts) C(SystemContextMenu) 0; };
  75. TCompareCriterias __fastcall CompareCriterias()
  76. {
  77. TCompareCriterias Criterias;
  78. if (CompareByTime)
  79. {
  80. Criterias << ccTime;
  81. }
  82. if (CompareBySize)
  83. {
  84. Criterias << ccSize;
  85. }
  86. return Criterias;
  87. }
  88. };
  89. //---------------------------------------------------------------------------
  90. struct TFontConfiguration
  91. {
  92. UnicodeString FontName;
  93. int FontSize;
  94. int FontCharset;
  95. int FontStyle;
  96. __fastcall TFontConfiguration()
  97. {
  98. FontSize = 0;
  99. FontCharset = DEFAULT_CHARSET;
  100. FontStyle = 0;
  101. }
  102. // keep in sync with SameFont
  103. bool __fastcall operator !=(const TFontConfiguration & rhc)
  104. { return !SameText(FontName, rhc.FontName) || C(FontSize)
  105. C(FontCharset) C(FontStyle) 0; };
  106. };
  107. //---------------------------------------------------------------------------
  108. struct TEditorConfiguration {
  109. TFontConfiguration Font;
  110. TColor FontColor;
  111. TColor BackgroundColor;
  112. bool WordWrap;
  113. UnicodeString FindText;
  114. UnicodeString ReplaceText;
  115. bool FindMatchCase;
  116. bool FindWholeWord;
  117. bool FindDown;
  118. unsigned int TabSize;
  119. unsigned int MaxEditors;
  120. unsigned int EarlyClose;
  121. bool SDIShellEditor;
  122. UnicodeString WindowParams;
  123. int Encoding;
  124. bool WarnOnEncodingFallback;
  125. bool WarnOrLargeFileSize;
  126. bool __fastcall operator !=(TEditorConfiguration & rhc)
  127. { return C(Font) C(FontColor) C(BackgroundColor) C(WordWrap) C(FindText) C(ReplaceText)
  128. C(FindMatchCase) C(FindWholeWord) C(FindDown) C(TabSize)
  129. C(MaxEditors) C(EarlyClose) C(SDIShellEditor) C(WindowParams)
  130. C(Encoding) C(WarnOnEncodingFallback) C(WarnOrLargeFileSize) 0; };
  131. };
  132. //---------------------------------------------------------------------------
  133. enum TQueueViewShow { qvShow, qvHideWhenEmpty, qvHide };
  134. struct TQueueViewConfiguration {
  135. int Height;
  136. int HeightPixelsPerInch;
  137. UnicodeString Layout;
  138. TQueueViewShow Show;
  139. TQueueViewShow LastHideShow;
  140. bool ToolBar;
  141. bool Label;
  142. bool FileList;
  143. int FileListHeight;
  144. int FileListHeightPixelsPerInch;
  145. bool __fastcall operator !=(TQueueViewConfiguration & rhc)
  146. { return C(Height) C(HeightPixelsPerInch) C(Layout) C(Show) C(LastHideShow) C(ToolBar) C(Label)
  147. C(FileList) C(FileListHeight) C(FileListHeightPixelsPerInch) 0; };
  148. };
  149. //---------------------------------------------------------------------------
  150. struct TUpdatesData
  151. {
  152. int ForVersion;
  153. int Version;
  154. UnicodeString Message;
  155. bool Critical;
  156. UnicodeString Release;
  157. bool Disabled;
  158. UnicodeString Url;
  159. UnicodeString UrlButton;
  160. UnicodeString NewsUrl;
  161. TSize NewsSize;
  162. UnicodeString DownloadUrl;
  163. __int64 DownloadSize;
  164. UnicodeString DownloadSha256;
  165. UnicodeString AuthenticationError;
  166. bool OpenGettingStarted;
  167. UnicodeString DownloadingUrl;
  168. TSize TipsSize;
  169. UnicodeString TipsUrl;
  170. UnicodeString Tips;
  171. int TipsIntervalDays;
  172. int TipsIntervalRuns;
  173. bool __fastcall operator !=(TUpdatesData & rhc)
  174. { return C(ForVersion) C(Version) C(Message) C(Critical) C(Release)
  175. C(Disabled) C(Url) C(UrlButton) C(NewsUrl) C(NewsSize)
  176. C(DownloadUrl) C(DownloadSize) C(DownloadSha256) C(AuthenticationError)
  177. C(OpenGettingStarted) C(DownloadingUrl)
  178. C(TipsSize) C(TipsUrl) C(Tips) C(TipsIntervalDays) C(TipsIntervalRuns) 0; };
  179. void Reset()
  180. {
  181. ForVersion = 0;
  182. Version = 0;
  183. Message = L"";
  184. Critical = false;
  185. Release = L"";
  186. Disabled = false;
  187. Url = L"";
  188. UrlButton = L"";
  189. NewsUrl = L"";
  190. NewsSize = TSize();
  191. DownloadUrl = L"";
  192. DownloadSize = 0;
  193. DownloadSha256 = L"";
  194. AuthenticationError = L"";
  195. OpenGettingStarted = false;
  196. DownloadingUrl = L"";
  197. TipsSize = TSize();
  198. TipsUrl = L"";
  199. Tips = L"";
  200. TipsIntervalDays = 7;
  201. TipsIntervalRuns = 5;
  202. }
  203. };
  204. //---------------------------------------------------------------------------
  205. enum TConnectionType { ctDirect, ctAuto, ctProxy };
  206. //---------------------------------------------------------------------------
  207. struct TUpdatesConfiguration
  208. {
  209. TDateTime Period;
  210. TDateTime LastCheck;
  211. TConnectionType ConnectionType;
  212. UnicodeString ProxyHost;
  213. int ProxyPort;
  214. TAutoSwitch BetaVersions;
  215. bool ShowOnStartup;
  216. UnicodeString AuthenticationEmail;
  217. bool HaveResults;
  218. bool ShownResults;
  219. UnicodeString DotNetVersion;
  220. UnicodeString ConsoleVersion;
  221. TUpdatesData Results;
  222. bool __fastcall operator !=(TUpdatesConfiguration & rhc)
  223. { return C(Period) C(LastCheck) C(ConnectionType) C(ProxyHost) C(ProxyPort)
  224. C(BetaVersions) C(ShowOnStartup) C(AuthenticationEmail)
  225. C(HaveResults) C(ShownResults) C(DotNetVersion)
  226. C(ConsoleVersion) C(Results) 0; };
  227. bool __fastcall HaveValidResultsForVersion(int CompoundVersion)
  228. {
  229. return
  230. HaveResults &&
  231. (double(Period) > 0) &&
  232. (ZeroBuildNumber(Results.ForVersion) == CompoundVersion);
  233. }
  234. };
  235. //---------------------------------------------------------------------------
  236. struct TEditorData
  237. {
  238. __fastcall TEditorData();
  239. __fastcall TEditorData(const TEditorData & Source);
  240. TFileMasks FileMask;
  241. TEditor Editor;
  242. UnicodeString ExternalEditor;
  243. bool ExternalEditorText;
  244. bool SDIExternalEditor;
  245. bool DetectMDIExternalEditor;
  246. bool __fastcall operator ==(const TEditorData & rhd) const;
  247. void __fastcall ExternalEditorOptionsAutodetect();
  248. };
  249. //---------------------------------------------------------------------------
  250. struct TFileColorData
  251. {
  252. TFileColorData();
  253. TFileMasks FileMask;
  254. TColor Color;
  255. void Load(const UnicodeString & S);
  256. UnicodeString Save() const;
  257. typedef std::vector<TFileColorData> TList;
  258. static void LoadList(const UnicodeString & S, TList & List);
  259. static UnicodeString SaveList(const TList & List);
  260. };
  261. //---------------------------------------------------------------------------
  262. #undef C
  263. //---------------------------------------------------------------------------
  264. class TEditorPreferences
  265. {
  266. public:
  267. __fastcall TEditorPreferences();
  268. __fastcall TEditorPreferences(const TEditorData & Data);
  269. bool __fastcall Matches(const UnicodeString FileName, bool Local,
  270. const TFileMasks::TParams & Params) const;
  271. void __fastcall Load(THierarchicalStorage * Storage, bool Legacy);
  272. void __fastcall Save(THierarchicalStorage * Storage) const;
  273. void __fastcall LegacyDefaults();
  274. UnicodeString __fastcall ExtractExternalEditorName() const;
  275. static UnicodeString __fastcall GetDefaultExternalEditor();
  276. bool __fastcall operator ==(const TEditorPreferences & rhp) const;
  277. __property const TEditorData * Data = { read = GetConstData };
  278. __property UnicodeString Name = { read = GetName };
  279. TEditorData * __fastcall GetData();
  280. private:
  281. TEditorData FData;
  282. mutable UnicodeString FName;
  283. UnicodeString __fastcall GetName() const;
  284. const TEditorData * __fastcall GetConstData() const { return &FData; };
  285. };
  286. //---------------------------------------------------------------------------
  287. class TEditorList
  288. {
  289. public:
  290. __fastcall TEditorList();
  291. virtual __fastcall ~TEditorList();
  292. const TEditorPreferences * __fastcall Find(const UnicodeString FileName,
  293. bool Local, const TFileMasks::TParams & Params) const;
  294. void __fastcall Load(THierarchicalStorage * Storage);
  295. void __fastcall Save(THierarchicalStorage * Storage) const;
  296. TEditorList & __fastcall operator=(const TEditorList & rhl);
  297. bool __fastcall operator==(const TEditorList & rhl) const;
  298. void __fastcall Clear();
  299. void __fastcall Add(TEditorPreferences * Editor);
  300. void __fastcall Insert(int Index, TEditorPreferences * Editor);
  301. void __fastcall Change(int Index, TEditorPreferences * Editor);
  302. void __fastcall Move(int CurIndex, int NewIndex);
  303. void __fastcall Delete(int Index);
  304. void __fastcall Saved();
  305. bool __fastcall IsDefaultList() const;
  306. __property int Count = { read = GetCount };
  307. __property const TEditorPreferences * Editors[int Index] = { read = GetEditor };
  308. __property bool Modified = { read = FModified };
  309. private:
  310. TList * FEditors;
  311. bool FModified;
  312. int __fastcall GetCount() const;
  313. void __fastcall Init();
  314. void __fastcall Modify();
  315. const TEditorPreferences * __fastcall GetEditor(int Index) const;
  316. };
  317. //---------------------------------------------------------------------------
  318. class TBookmarks;
  319. class TBookmarkList;
  320. class TCustomCommandList;
  321. enum TPathInCaption { picShort, picFull, picNone };
  322. enum TSessionTabNameFormat { stnfNone, stnfShortPath, stnfShortPathTrunc };
  323. // constants must be compatible with legacy CopyOnDoubleClick
  324. enum TDoubleClickAction { dcaOpen = 0, dcaCopy = 1, dcaEdit = 2 };
  325. //---------------------------------------------------------------------------
  326. typedef void __fastcall (__closure *TMasterPasswordPromptEvent)();
  327. //---------------------------------------------------------------------------
  328. class TWinConfiguration : public TCustomWinConfiguration
  329. {
  330. private:
  331. UnicodeString FAutoStartSession;
  332. TDoubleClickAction FDoubleClickAction;
  333. bool FCopyOnDoubleClickConfirmation;
  334. bool FDDDisableMove;
  335. TAutoSwitch FDDTransferConfirmation;
  336. bool FDeleteToRecycleBin;
  337. bool FDimmHiddenFiles;
  338. bool FRenameWholeName;
  339. TScpCommanderConfiguration FScpCommander;
  340. TScpExplorerConfiguration FScpExplorer;
  341. bool FSelectDirectories;
  342. UnicodeString FSelectMask;
  343. bool FShowHiddenFiles;
  344. TFormatBytesStyle FFormatSizeBytes;
  345. TIncrementalSearch FPanelSearch;
  346. bool FShowInaccesibleDirectories;
  347. bool FConfirmTransferring;
  348. bool FConfirmDeleting;
  349. bool FConfirmRecycling;
  350. bool FUseLocationProfiles;
  351. bool FUseSharedBookmarks;
  352. UnicodeString FDDTemporaryDirectory;
  353. UnicodeString FDDDrives;
  354. bool FDDWarnLackOfTempSpace;
  355. bool FDDFakeFile;
  356. int FDDExtInstalled;
  357. int FDDExtTimeout;
  358. bool FConfirmClosingSession;
  359. double FDDWarnLackOfTempSpaceRatio;
  360. UnicodeString FTemporarySessionFile;
  361. UnicodeString FTemporaryKeyFile;
  362. TBookmarks * FBookmarks;
  363. TCustomCommandList * FCustomCommandList;
  364. TCustomCommandList * FExtensionList;
  365. UnicodeString FExtensionsDeleted;
  366. UnicodeString FExtensionsOrder;
  367. UnicodeString FExtensionsShortCuts;
  368. bool FCustomCommandsDefaults;
  369. TEditorConfiguration FEditor;
  370. TQueueViewConfiguration FQueueView;
  371. bool FEnableQueueByDefault;
  372. bool FEmbeddedSessions;
  373. bool FExpertMode;
  374. bool FDisableOpenEdit;
  375. bool FDefaultDirIsHome;
  376. int FDDDeleteDelay;
  377. bool FTemporaryDirectoryAppendSession;
  378. bool FTemporaryDirectoryAppendPath;
  379. bool FTemporaryDirectoryDeterministic;
  380. bool FTemporaryDirectoryCleanup;
  381. bool FConfirmTemporaryDirectoryCleanup;
  382. UnicodeString FDefaultTranslationFile;
  383. UnicodeString FInvalidDefaultTranslationMessage;
  384. bool FPreservePanelState;
  385. TAutoSwitch FDarkTheme;
  386. int FSysDarkTheme;
  387. UnicodeString FLastStoredSession;
  388. UnicodeString FLastWorkspace;
  389. bool FAutoSaveWorkspace;
  390. bool FAutoSaveWorkspacePasswords;
  391. UnicodeString FAutoWorkspace;
  392. TPathInCaption FPathInCaption;
  393. TSessionTabNameFormat FSessionTabNameFormat;
  394. bool FMinimizeToTray;
  395. bool FBalloonNotifications;
  396. unsigned int FNotificationsTimeout;
  397. unsigned int FNotificationsStickTime;
  398. TUpdatesConfiguration FUpdates;
  399. UnicodeString FVersionHistory;
  400. bool FCopyParamAutoSelectNotice;
  401. bool FLockToolbars;
  402. bool FSelectiveToolbarText;
  403. TEditorList * FEditorList;
  404. TEditorPreferences * FLegacyEditor;
  405. UnicodeString FDefaultKeyFile;
  406. bool FAutoOpenInPutty;
  407. TDateTime FDefaultUpdatesPeriod;
  408. bool FRefreshRemotePanel;
  409. TDateTime FRefreshRemotePanelInterval;
  410. TFontConfiguration FPanelFont;
  411. bool FNaturalOrderNumericalSorting;
  412. bool FFullRowSelect;
  413. bool FOfferedEditorAutoConfig;
  414. bool FUseMasterPassword;
  415. UnicodeString FPlainMasterPasswordEncrypt;
  416. UnicodeString FPlainMasterPasswordDecrypt;
  417. UnicodeString FMasterPasswordVerifier;
  418. TMasterPasswordPromptEvent FOnMasterPasswordPrompt;
  419. UnicodeString FOpenedStoredSessionFolders;
  420. bool FAutoImportedFromPuttyOrFilezilla;
  421. int FGenerateUrlComponents;
  422. TGenerateUrlCodeTarget FGenerateUrlCodeTarget;
  423. TScriptFormat FGenerateUrlScriptFormat;
  424. TAssemblyLanguage FGenerateUrlAssemblyLanguage;
  425. bool FExternalSessionInExistingInstance;
  426. bool FShowLoginWhenNoSession;
  427. bool FKeepOpenWhenNoSession;
  428. bool FLocalIconsByExt;
  429. TLocaleFlagOverride FBidiModeOverride;
  430. TLocaleFlagOverride FFlipChildrenOverride;
  431. bool FShowTips;
  432. UnicodeString FTipsSeen;
  433. TDateTime FTipsShown;
  434. UnicodeString FFileColors;
  435. int FRunsSinceLastTip;
  436. bool FLockedInterface;
  437. bool FTimeoutShellIconRetrieval;
  438. bool FUseIconUpdateThread;
  439. bool FAllowWindowPrint;
  440. int FDontDecryptPasswords;
  441. int FMasterPasswordSession;
  442. bool FMasterPasswordSessionAsked;
  443. std::unique_ptr<TStringList> FCustomCommandOptions;
  444. bool FCustomCommandOptionsModified;
  445. int FLastMachineInstallations;
  446. __property int LastMachineInstallations = { read = FLastMachineInstallations, write = FLastMachineInstallations };
  447. int FMachineInstallations;
  448. LCID FDefaultLocale;
  449. std::unique_ptr<TStrings> FExtensionTranslations;
  450. void __fastcall SetDoubleClickAction(TDoubleClickAction value);
  451. void __fastcall SetCopyOnDoubleClickConfirmation(bool value);
  452. void __fastcall SetDDDisableMove(bool value);
  453. void __fastcall SetDDTransferConfirmation(TAutoSwitch value);
  454. void __fastcall SetDeleteToRecycleBin(bool value);
  455. void __fastcall SetDimmHiddenFiles(bool value);
  456. void __fastcall SetRenameWholeName(bool value);
  457. void __fastcall SetScpCommander(TScpCommanderConfiguration value);
  458. void __fastcall SetScpExplorer(TScpExplorerConfiguration value);
  459. void __fastcall SetSelectDirectories(bool value);
  460. void __fastcall SetShowHiddenFiles(bool value);
  461. void __fastcall SetFormatSizeBytes(TFormatBytesStyle value);
  462. void __fastcall SetPanelSearch(TIncrementalSearch value);
  463. void __fastcall SetShowInaccesibleDirectories(bool value);
  464. void __fastcall SetConfirmTransferring(bool value);
  465. void __fastcall SetConfirmDeleting(bool value);
  466. void __fastcall SetConfirmRecycling(bool value);
  467. void __fastcall SetUseLocationProfiles(bool value);
  468. void __fastcall SetUseSharedBookmarks(bool value);
  469. void __fastcall SetDDTemporaryDirectory(UnicodeString value);
  470. void __fastcall SetDDDrives(UnicodeString value);
  471. void __fastcall SetDDWarnLackOfTempSpace(bool value);
  472. void __fastcall SetDDFakeFile(bool value);
  473. void __fastcall SetDDExtTimeout(int value);
  474. void __fastcall SetConfirmClosingSession(bool value);
  475. void __fastcall SetDDWarnLackOfTempSpaceRatio(double value);
  476. void __fastcall SetBookmarks(UnicodeString Key, TBookmarkList * value);
  477. TBookmarkList * __fastcall GetBookmarks(UnicodeString Key);
  478. void __fastcall SetSharedBookmarks(TBookmarkList * value);
  479. TBookmarkList * __fastcall GetSharedBookmarks();
  480. void __fastcall SetAutoStartSession(UnicodeString value);
  481. void __fastcall SetExpertMode(bool value);
  482. void __fastcall SetDefaultDirIsHome(bool value);
  483. void __fastcall SetEditor(TEditorConfiguration value);
  484. void __fastcall SetQueueView(TQueueViewConfiguration value);
  485. void __fastcall SetEnableQueueByDefault(bool value);
  486. void __fastcall SetCustomCommandList(TCustomCommandList * value);
  487. void __fastcall SetExtensionList(TCustomCommandList * value);
  488. void __fastcall SetTemporaryDirectoryAppendSession(bool value);
  489. void __fastcall SetTemporaryDirectoryAppendPath(bool value);
  490. void __fastcall SetTemporaryDirectoryDeterministic(bool value);
  491. void __fastcall SetTemporaryDirectoryCleanup(bool value);
  492. void __fastcall SetConfirmTemporaryDirectoryCleanup(bool value);
  493. void __fastcall SetPreservePanelState(bool value);
  494. void __fastcall SetDarkTheme(TAutoSwitch value);
  495. void __fastcall SetLastStoredSession(UnicodeString value);
  496. void __fastcall SetAutoSaveWorkspace(bool value);
  497. void __fastcall SetAutoSaveWorkspacePasswords(bool value);
  498. void __fastcall SetAutoWorkspace(UnicodeString value);
  499. void __fastcall SetPathInCaption(TPathInCaption value);
  500. void __fastcall SetSessionTabNameFormat(TSessionTabNameFormat value);
  501. void __fastcall SetMinimizeToTray(bool value);
  502. void __fastcall SetBalloonNotifications(bool value);
  503. void __fastcall SetNotificationsTimeout(unsigned int value);
  504. void __fastcall SetNotificationsStickTime(unsigned int value);
  505. void __fastcall SetCopyParamAutoSelectNotice(bool value);
  506. TUpdatesConfiguration __fastcall GetUpdates();
  507. void __fastcall SetUpdates(TUpdatesConfiguration value);
  508. void __fastcall SetVersionHistory(UnicodeString value);
  509. void __fastcall SetLockToolbars(bool value);
  510. void __fastcall SetSelectiveToolbarText(bool value);
  511. const TEditorList * __fastcall GetEditorList();
  512. void __fastcall SetEditorList(const TEditorList * value);
  513. void __fastcall SetAutoOpenInPutty(bool value);
  514. void __fastcall SetRefreshRemotePanel(bool value);
  515. void __fastcall SetRefreshRemotePanelInterval(TDateTime value);
  516. void __fastcall SetPanelFont(const TFontConfiguration & value);
  517. void __fastcall SetNaturalOrderNumericalSorting(bool value);
  518. void __fastcall SetFullRowSelect(bool value);
  519. void __fastcall SetOfferedEditorAutoConfig(bool value);
  520. void __fastcall SetLastMonitor(int value);
  521. int __fastcall GetLastMonitor();
  522. void __fastcall SetOpenedStoredSessionFolders(UnicodeString value);
  523. void __fastcall SetAutoImportedFromPuttyOrFilezilla(bool value);
  524. void __fastcall SetGenerateUrlComponents(int value);
  525. void __fastcall SetGenerateUrlCodeTarget(TGenerateUrlCodeTarget value);
  526. void __fastcall SetGenerateUrlScriptFormat(TScriptFormat value);
  527. void __fastcall SetGenerateUrlAssemblyLanguage(TAssemblyLanguage value);
  528. void __fastcall SetExternalSessionInExistingInstance(bool value);
  529. void __fastcall SetShowLoginWhenNoSession(bool value);
  530. void __fastcall SetKeepOpenWhenNoSession(bool value);
  531. void __fastcall SetLocalIconsByExt(bool value);
  532. void __fastcall SetBidiModeOverride(TLocaleFlagOverride value);
  533. void __fastcall SetFlipChildrenOverride(TLocaleFlagOverride value);
  534. void __fastcall SetShowTips(bool value);
  535. void __fastcall SetTipsSeen(UnicodeString value);
  536. void __fastcall SetTipsShown(TDateTime value);
  537. void __fastcall SetFileColors(UnicodeString value);
  538. void __fastcall SetRunsSinceLastTip(int value);
  539. bool __fastcall GetHonorDrivePolicy();
  540. void __fastcall SetHonorDrivePolicy(bool value);
  541. bool __fastcall GetIsBeta();
  542. TStrings * __fastcall GetCustomCommandOptions();
  543. void __fastcall SetCustomCommandOptions(TStrings * value);
  544. void __fastcall SetLockedInterface(bool value);
  545. bool __fastcall GetTimeoutShellOperations();
  546. void __fastcall SetTimeoutShellOperations(bool value);
  547. void __fastcall SetTimeoutShellIconRetrieval(bool value);
  548. void __fastcall SetUseIconUpdateThread(bool value);
  549. void __fastcall SetAllowWindowPrint(bool value);
  550. int __fastcall GetLocaleCompletenessTreshold();
  551. bool __fastcall GetDDExtInstalled();
  552. void __fastcall AddVersionToHistory();
  553. bool __fastcall GetAnyBetaInVersionHistory();
  554. void __fastcall PurgePassword(UnicodeString & Password);
  555. void __fastcall UpdateEntryInJumpList(
  556. bool Session, const UnicodeString & Name, bool Add);
  557. TStringList * __fastcall LoadJumpList(THierarchicalStorage * Storage,
  558. UnicodeString Name);
  559. void __fastcall SaveJumpList(THierarchicalStorage * Storage,
  560. UnicodeString Name, TStringList * List);
  561. void __fastcall TrimJumpList(TStringList * List);
  562. void __fastcall UpdateIconFont();
  563. protected:
  564. virtual TStorage __fastcall GetStorage();
  565. virtual void __fastcall SaveData(THierarchicalStorage * Storage, bool All);
  566. virtual void __fastcall LoadData(THierarchicalStorage * Storage);
  567. virtual void __fastcall LoadFrom(THierarchicalStorage * Storage);
  568. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  569. virtual void __fastcall CopyData(THierarchicalStorage * Source, THierarchicalStorage * Target);
  570. virtual UnicodeString __fastcall GetDefaultKeyFile();
  571. virtual void __fastcall Saved();
  572. void __fastcall RecryptPasswords(TStrings * RecryptPasswordErrors);
  573. virtual bool __fastcall GetUseMasterPassword();
  574. bool __fastcall SameStringLists(TStrings * Strings1, TStrings * Strings2);
  575. virtual HINSTANCE __fastcall LoadNewResourceModule(LCID Locale,
  576. UnicodeString & FileName);
  577. void __fastcall CheckTranslationVersion(const UnicodeString FileName,
  578. bool InternalLocaleOnError);
  579. virtual void __fastcall DefaultLocalized();
  580. bool __fastcall DetectRegistryStorage(HKEY RootKey);
  581. bool __fastcall CanWriteToStorage();
  582. bool __fastcall DoIsBeta(const UnicodeString & ReleaseType);
  583. void __fastcall AskForMasterPassword();
  584. void __fastcall DoLoadExtensionList(const UnicodeString & Path, const UnicodeString & PathId, TStringList * DeletedExtensions);
  585. TStrings * __fastcall GetExtensionsPaths();
  586. virtual int __fastcall GetResourceModuleCompleteness(HINSTANCE Module);
  587. virtual bool __fastcall IsTranslationComplete(HINSTANCE Module);
  588. void __fastcall LoadExtensionList();
  589. void __fastcall ReleaseExtensionTranslations();
  590. void __fastcall LoadExtensionTranslations();
  591. TStrings * __fastcall DoFindTemporaryFolders(bool OnlyFirst);
  592. public:
  593. __fastcall TWinConfiguration();
  594. virtual __fastcall ~TWinConfiguration();
  595. virtual void __fastcall Default();
  596. void __fastcall ClearTemporaryLoginData();
  597. virtual THierarchicalStorage * CreateScpStorage(bool & SessionList);
  598. UnicodeString __fastcall TemporaryDir(bool Mask = false);
  599. TStrings * __fastcall FindTemporaryFolders();
  600. bool __fastcall AnyTemporaryFolders();
  601. void __fastcall CleanupTemporaryFolders();
  602. void __fastcall CleanupTemporaryFolders(TStrings * Folders = NULL);
  603. UnicodeString __fastcall ExpandedTemporaryDirectory();
  604. void __fastcall CheckDefaultTranslation();
  605. const TEditorPreferences * __fastcall DefaultEditorForFile(
  606. const UnicodeString FileName, bool Local, const TFileMasks::TParams & MaskParams);
  607. virtual UnicodeString __fastcall DecryptPassword(RawByteString Password, UnicodeString Key);
  608. virtual RawByteString __fastcall StronglyRecryptPassword(RawByteString Password, UnicodeString Key);
  609. void __fastcall SetMasterPassword(UnicodeString value);
  610. void __fastcall ChangeMasterPassword(UnicodeString value, TStrings * RecryptPasswordErrors);
  611. bool __fastcall ValidateMasterPassword(UnicodeString value);
  612. void __fastcall ClearMasterPassword(TStrings * RecryptPasswordErrors);
  613. void __fastcall BeginMasterPasswordSession();
  614. void __fastcall EndMasterPasswordSession();
  615. virtual void __fastcall AskForMasterPasswordIfNotSet();
  616. void __fastcall AddSessionToJumpList(UnicodeString SessionName);
  617. void __fastcall DeleteSessionFromJumpList(UnicodeString SessionName);
  618. void __fastcall AddWorkspaceToJumpList(UnicodeString Workspace);
  619. void __fastcall DeleteWorkspaceFromJumpList(UnicodeString Workspace);
  620. void __fastcall UpdateJumpList();
  621. virtual void __fastcall UpdateStaticUsage();
  622. void __fastcall CustomCommandShortCuts(TShortCuts & ShortCuts) const;
  623. UnicodeString __fastcall GetUserExtensionsPath();
  624. UnicodeString __fastcall GetExtensionId(const UnicodeString & ExtensionPath);
  625. UnicodeString __fastcall ExtensionStringTranslation(const UnicodeString & ExtensionId, const UnicodeString & S);
  626. UnicodeString __fastcall UniqueExtensionName(const UnicodeString & ExtensionName, int Counter);
  627. UnicodeString __fastcall GetProvisionaryExtensionId(const UnicodeString & FileName);
  628. bool __fastcall IsDDExtRunning();
  629. bool __fastcall IsDDExtBroken();
  630. bool __fastcall UseDarkTheme();
  631. void __fastcall ResetSysDarkTheme();
  632. static void __fastcall RestoreFont(const TFontConfiguration & Configuration, TFont * Font);
  633. static void __fastcall StoreFont(TFont * Font, TFontConfiguration & Configuration);
  634. __property TScpCommanderConfiguration ScpCommander = { read = FScpCommander, write = SetScpCommander };
  635. __property TScpExplorerConfiguration ScpExplorer = { read = FScpExplorer, write = SetScpExplorer };
  636. __property bool SelectDirectories = { read = FSelectDirectories, write = SetSelectDirectories };
  637. __property UnicodeString SelectMask = { read = FSelectMask, write = FSelectMask };
  638. __property bool ShowHiddenFiles = { read = FShowHiddenFiles, write = SetShowHiddenFiles };
  639. __property TFormatBytesStyle FormatSizeBytes = { read = FFormatSizeBytes, write = SetFormatSizeBytes };
  640. __property TIncrementalSearch PanelSearch = { read = FPanelSearch, write = SetPanelSearch };
  641. __property bool ShowInaccesibleDirectories = { read = FShowInaccesibleDirectories, write = SetShowInaccesibleDirectories };
  642. __property TEditorConfiguration Editor = { read = FEditor, write = SetEditor };
  643. __property TQueueViewConfiguration QueueView = { read = FQueueView, write = SetQueueView };
  644. __property bool EnableQueueByDefault = { read = FEnableQueueByDefault, write = SetEnableQueueByDefault };
  645. __property TUpdatesConfiguration Updates = { read = GetUpdates, write = SetUpdates };
  646. __property UnicodeString VersionHistory = { read = FVersionHistory, write = SetVersionHistory };
  647. __property bool AnyBetaInVersionHistory = { read = GetAnyBetaInVersionHistory };
  648. __property bool IsBeta = { read = GetIsBeta };
  649. __property UnicodeString AutoStartSession = { read = FAutoStartSession, write = SetAutoStartSession };
  650. __property TDoubleClickAction DoubleClickAction = { read = FDoubleClickAction, write = SetDoubleClickAction };
  651. __property bool CopyOnDoubleClickConfirmation = { read = FCopyOnDoubleClickConfirmation, write = SetCopyOnDoubleClickConfirmation };
  652. __property bool DDDisableMove = { read = FDDDisableMove, write = SetDDDisableMove };
  653. __property TAutoSwitch DDTransferConfirmation = { read = FDDTransferConfirmation, write = SetDDTransferConfirmation };
  654. __property bool DeleteToRecycleBin = { read = FDeleteToRecycleBin, write = SetDeleteToRecycleBin };
  655. __property bool DimmHiddenFiles = { read = FDimmHiddenFiles, write = SetDimmHiddenFiles };
  656. __property bool RenameWholeName = { read = FRenameWholeName, write = SetRenameWholeName };
  657. __property bool ConfirmTransferring = { read = FConfirmTransferring, write = SetConfirmTransferring};
  658. __property bool ConfirmDeleting = { read = FConfirmDeleting, write = SetConfirmDeleting};
  659. __property bool ConfirmRecycling = { read = FConfirmRecycling, write = SetConfirmRecycling};
  660. __property bool UseLocationProfiles = { read = FUseLocationProfiles, write = SetUseLocationProfiles};
  661. __property bool UseSharedBookmarks = { read = FUseSharedBookmarks, write = SetUseSharedBookmarks};
  662. __property UnicodeString DDTemporaryDirectory = { read=FDDTemporaryDirectory, write=SetDDTemporaryDirectory };
  663. __property UnicodeString DDDrives = { read=FDDDrives, write=SetDDDrives };
  664. __property bool DDWarnLackOfTempSpace = { read=FDDWarnLackOfTempSpace, write=SetDDWarnLackOfTempSpace };
  665. __property bool DDFakeFile = { read=FDDFakeFile, write=SetDDFakeFile };
  666. __property bool DDExtInstalled = { read=GetDDExtInstalled };
  667. __property int DDExtTimeout = { read=FDDExtTimeout, write=SetDDExtTimeout };
  668. __property bool ConfirmClosingSession = { read=FConfirmClosingSession, write=SetConfirmClosingSession };
  669. __property double DDWarnLackOfTempSpaceRatio = { read=FDDWarnLackOfTempSpaceRatio, write=SetDDWarnLackOfTempSpaceRatio };
  670. __property TBookmarkList * Bookmarks[UnicodeString Key] = { read = GetBookmarks, write = SetBookmarks };
  671. __property TBookmarkList * SharedBookmarks = { read = GetSharedBookmarks, write = SetSharedBookmarks };
  672. __property bool EmbeddedSessions = { read = FEmbeddedSessions };
  673. __property bool ExpertMode = { read = FExpertMode, write = SetExpertMode };
  674. __property bool DefaultDirIsHome = { read = FDefaultDirIsHome, write = SetDefaultDirIsHome };
  675. __property bool DisableOpenEdit = { read = FDisableOpenEdit };
  676. __property TCustomCommandList * CustomCommandList = { read = FCustomCommandList, write = SetCustomCommandList };
  677. __property TCustomCommandList * ExtensionList = { read = FExtensionList, write = SetExtensionList };
  678. __property int DDDeleteDelay = { read = FDDDeleteDelay };
  679. __property bool TemporaryDirectoryAppendSession = { read = FTemporaryDirectoryAppendSession, write = SetTemporaryDirectoryAppendSession };
  680. __property bool TemporaryDirectoryAppendPath = { read = FTemporaryDirectoryAppendPath, write = SetTemporaryDirectoryAppendPath };
  681. __property bool TemporaryDirectoryDeterministic = { read = FTemporaryDirectoryDeterministic, write = SetTemporaryDirectoryDeterministic };
  682. __property bool TemporaryDirectoryCleanup = { read = FTemporaryDirectoryCleanup, write = SetTemporaryDirectoryCleanup };
  683. __property bool ConfirmTemporaryDirectoryCleanup = { read = FConfirmTemporaryDirectoryCleanup, write = SetConfirmTemporaryDirectoryCleanup };
  684. __property bool PreservePanelState = { read = FPreservePanelState, write = SetPreservePanelState };
  685. __property TAutoSwitch DarkTheme = { read = FDarkTheme, write = SetDarkTheme };
  686. __property UnicodeString LastStoredSession = { read = FLastStoredSession, write = SetLastStoredSession };
  687. __property UnicodeString LastWorkspace = { read = FLastWorkspace, write = FLastWorkspace };
  688. __property bool AutoSaveWorkspace = { read = FAutoSaveWorkspace, write = SetAutoSaveWorkspace };
  689. __property bool AutoSaveWorkspacePasswords = { read = FAutoSaveWorkspacePasswords, write = SetAutoSaveWorkspacePasswords };
  690. __property UnicodeString AutoWorkspace = { read = FAutoWorkspace, write = SetAutoWorkspace };
  691. __property TPathInCaption PathInCaption = { read = FPathInCaption, write = SetPathInCaption };
  692. __property TSessionTabNameFormat SessionTabNameFormat = { read = FSessionTabNameFormat, write = FSessionTabNameFormat };
  693. __property bool MinimizeToTray = { read = FMinimizeToTray, write = SetMinimizeToTray };
  694. __property bool BalloonNotifications = { read = FBalloonNotifications, write = SetBalloonNotifications };
  695. __property unsigned int NotificationsTimeout = { read = FNotificationsTimeout, write = SetNotificationsTimeout };
  696. __property unsigned int NotificationsStickTime = { read = FNotificationsStickTime, write = SetNotificationsStickTime };
  697. __property UnicodeString DefaultTranslationFile = { read = FDefaultTranslationFile };
  698. __property bool CopyParamAutoSelectNotice = { read = FCopyParamAutoSelectNotice, write = SetCopyParamAutoSelectNotice };
  699. __property bool LockToolbars = { read = FLockToolbars, write = SetLockToolbars };
  700. __property bool SelectiveToolbarText = { read = FSelectiveToolbarText, write = SetSelectiveToolbarText };
  701. __property bool AutoOpenInPutty = { read = FAutoOpenInPutty, write = SetAutoOpenInPutty };
  702. __property bool RefreshRemotePanel = { read = FRefreshRemotePanel, write = SetRefreshRemotePanel };
  703. __property TDateTime RefreshRemotePanelInterval = { read = FRefreshRemotePanelInterval, write = SetRefreshRemotePanelInterval };
  704. __property TFontConfiguration PanelFont = { read = FPanelFont, write = SetPanelFont };
  705. __property bool NaturalOrderNumericalSorting = { read = FNaturalOrderNumericalSorting, write = SetNaturalOrderNumericalSorting };
  706. __property bool FullRowSelect = { read = FFullRowSelect, write = SetFullRowSelect };
  707. __property bool OfferedEditorAutoConfig = { read = FOfferedEditorAutoConfig, write = SetOfferedEditorAutoConfig };
  708. __property int LastMonitor = { read = GetLastMonitor, write = SetLastMonitor };
  709. __property const TEditorList * EditorList = { read = GetEditorList, write = SetEditorList };
  710. __property UnicodeString DefaultKeyFile = { read = GetDefaultKeyFile, write = FDefaultKeyFile };
  711. __property UnicodeString OpenedStoredSessionFolders = { read = FOpenedStoredSessionFolders, write = SetOpenedStoredSessionFolders };
  712. __property bool AutoImportedFromPuttyOrFilezilla = { read = FAutoImportedFromPuttyOrFilezilla, write = SetAutoImportedFromPuttyOrFilezilla };
  713. __property int GenerateUrlComponents = { read = FGenerateUrlComponents, write = SetGenerateUrlComponents };
  714. __property TGenerateUrlCodeTarget GenerateUrlCodeTarget = { read = FGenerateUrlCodeTarget, write = SetGenerateUrlCodeTarget };
  715. __property TScriptFormat GenerateUrlScriptFormat = { read = FGenerateUrlScriptFormat, write = SetGenerateUrlScriptFormat };
  716. __property TAssemblyLanguage GenerateUrlAssemblyLanguage = { read = FGenerateUrlAssemblyLanguage, write = SetGenerateUrlAssemblyLanguage };
  717. __property bool ExternalSessionInExistingInstance = { read = FExternalSessionInExistingInstance, write = SetExternalSessionInExistingInstance };
  718. __property bool ShowLoginWhenNoSession = { read = FShowLoginWhenNoSession, write = SetShowLoginWhenNoSession };
  719. __property bool KeepOpenWhenNoSession = { read = FKeepOpenWhenNoSession, write = SetKeepOpenWhenNoSession };
  720. __property bool LocalIconsByExt = { read = FLocalIconsByExt, write = SetLocalIconsByExt };
  721. __property TLocaleFlagOverride BidiModeOverride = { read = FBidiModeOverride, write = SetBidiModeOverride };
  722. __property TLocaleFlagOverride FlipChildrenOverride = { read = FFlipChildrenOverride, write = SetFlipChildrenOverride };
  723. __property bool ShowTips = { read = FShowTips, write = SetShowTips };
  724. __property UnicodeString TipsSeen = { read = FTipsSeen, write = SetTipsSeen };
  725. __property TDateTime TipsShown = { read = FTipsShown, write = SetTipsShown };
  726. __property UnicodeString FileColors = { read = FFileColors, write = SetFileColors };
  727. __property int RunsSinceLastTip = { read = FRunsSinceLastTip, write = SetRunsSinceLastTip };
  728. __property bool HonorDrivePolicy = { read = GetHonorDrivePolicy, write = SetHonorDrivePolicy };
  729. __property TMasterPasswordPromptEvent OnMasterPasswordPrompt = { read = FOnMasterPasswordPrompt, write = FOnMasterPasswordPrompt };
  730. __property TStrings * CustomCommandOptions = { read = GetCustomCommandOptions, write = SetCustomCommandOptions };
  731. __property bool LockedInterface = { read = FLockedInterface, write = SetLockedInterface };
  732. __property bool TimeoutShellOperations = { read = GetTimeoutShellOperations, write = SetTimeoutShellOperations };
  733. __property bool TimeoutShellIconRetrieval = { read = FTimeoutShellIconRetrieval, write = SetTimeoutShellIconRetrieval };
  734. __property bool UseIconUpdateThread = { read = FUseIconUpdateThread, write = SetUseIconUpdateThread };
  735. __property bool AllowWindowPrint = { read = FAllowWindowPrint, write = SetAllowWindowPrint };
  736. __property LCID DefaultLocale = { read = FDefaultLocale };
  737. __property int LocaleCompletenessTreshold = { read = GetLocaleCompletenessTreshold };
  738. };
  739. //---------------------------------------------------------------------------
  740. class TCustomCommandType
  741. {
  742. public:
  743. __fastcall TCustomCommandType();
  744. __fastcall TCustomCommandType(const TCustomCommandType & Other);
  745. enum TOptionKind { okUnknown, okLabel, okLink, okSeparator, okGroup, okTextBox, okFile, okDropDownList, okComboBox, okCheckBox };
  746. enum TOptionFlag { ofRun = 0x01, ofConfig = 0x02, ofSite = 0x04 };
  747. class TOption
  748. {
  749. public:
  750. __fastcall TOption() {}
  751. UnicodeString Id;
  752. unsigned int Flags;
  753. TOptionKind Kind;
  754. UnicodeString Caption;
  755. UnicodeString Default;
  756. typedef std::vector<UnicodeString> TParams;
  757. TParams Params;
  758. UnicodeString FileCaption;
  759. UnicodeString FileFilter;
  760. UnicodeString FileInitial;
  761. UnicodeString FileExt;
  762. bool operator==(const TOption & Other) const;
  763. __property bool IsControl = { read = GetIsControl };
  764. bool HasPatterns(TCustomCommand * CustomCommandForOptions) const;
  765. private:
  766. bool __fastcall GetIsControl() const;
  767. };
  768. TCustomCommandType & operator=(const TCustomCommandType & Other);
  769. bool __fastcall Equals(const TCustomCommandType * Other) const;
  770. void __fastcall LoadExtension(const UnicodeString & Path);
  771. void __fastcall LoadExtension(TStrings * Lines, const UnicodeString & PathForBaseName);
  772. static UnicodeString __fastcall GetExtensionId(const UnicodeString & Name);
  773. __property UnicodeString Name = { read = FName, write = FName };
  774. __property UnicodeString Command = { read = FCommand, write = FCommand };
  775. __property int Params = { read = FParams, write = FParams };
  776. __property TShortCut ShortCut = { read = FShortCut, write = FShortCut };
  777. __property UnicodeString Id = { read = FId, write = FId };
  778. __property UnicodeString FileName = { read = FFileName, write = FFileName };
  779. __property UnicodeString Description = { read = FDescription, write = FDescription };
  780. __property UnicodeString HomePage = { read = FHomePage, write = FHomePage };
  781. __property UnicodeString OptionsPage = { read = FOptionsPage, write = FOptionsPage };
  782. __property int OptionsCount = { read = GetOptionsCount };
  783. const TOption & __fastcall GetOption(int Index) const;
  784. bool __fastcall AnyOptionWithFlag(unsigned int Flag) const;
  785. UnicodeString __fastcall GetOptionKey(const TOption & Option, const UnicodeString & Site) const;
  786. UnicodeString __fastcall GetCommandWithExpandedOptions(
  787. TStrings * CustomCommandOptions, const UnicodeString & Site) const;
  788. bool __fastcall HasCustomShortCut() const;
  789. protected:
  790. bool __fastcall ParseOption(const UnicodeString & Value, TOption & Option, const UnicodeString & ExtensionBaseName);
  791. int __fastcall GetOptionsCount() const;
  792. UnicodeString __fastcall GetOptionCommand(const TOption & Option, const UnicodeString & Value) const;
  793. private:
  794. UnicodeString FName;
  795. UnicodeString FCommand;
  796. int FParams;
  797. TShortCut FShortCut;
  798. TShortCut FShortCutOriginal;
  799. UnicodeString FId;
  800. UnicodeString FFileName;
  801. UnicodeString FDescription;
  802. UnicodeString FHomePage;
  803. UnicodeString FOptionsPage;
  804. std::vector<TOption> FOptions;
  805. };
  806. //---------------------------------------------------------------------------
  807. class TCustomCommandList
  808. {
  809. public:
  810. __fastcall TCustomCommandList();
  811. __fastcall ~TCustomCommandList();
  812. void __fastcall Load(THierarchicalStorage * Storage);
  813. void __fastcall Save(THierarchicalStorage * Storage);
  814. void __fastcall Reset();
  815. void __fastcall Modify();
  816. void __fastcall Clear();
  817. void __fastcall Add(const UnicodeString Name, const UnicodeString Command, int Params);
  818. void __fastcall Add(TCustomCommandType * Command);
  819. void __fastcall Insert(int Index, TCustomCommandType * Command);
  820. void __fastcall Change(int Index, TCustomCommandType * Command);
  821. void __fastcall Move(int CurIndex, int NewIndex);
  822. void __fastcall Delete(int Index);
  823. void __fastcall SortBy(TStrings * Ids);
  824. const TCustomCommandType * Find(const UnicodeString Name) const;
  825. const TCustomCommandType * Find(TShortCut ShortCut) const;
  826. int FindIndexByFileName(const UnicodeString & FileName) const;
  827. bool __fastcall Equals(const TCustomCommandList * Other) const;
  828. void __fastcall Assign(const TCustomCommandList * Other);
  829. void __fastcall ShortCuts(TShortCuts & ShortCuts) const;
  830. __property bool Modified = { read = FModified };
  831. __property int Count = { read = GetCount };
  832. __property const TCustomCommandType * Commands[int Index] = { read = GetConstCommand };
  833. private:
  834. bool FModified;
  835. TList * FCommands;
  836. int __fastcall GetCount() const;
  837. const TCustomCommandType * __fastcall GetConstCommand(int Index) const;
  838. TCustomCommandType * __fastcall GetCommand(int Index);
  839. };
  840. //---------------------------------------------------------------------------
  841. extern TWinConfiguration * WinConfiguration;
  842. extern const UnicodeString WinSCPExtensionExt;
  843. //---------------------------------------------------------------------------
  844. #endif