WinConfiguration.h 32 KB

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