WinConfiguration.h 38 KB

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