Bladeren bron

Automatically handling configuration persistence to/from fields

Source commit: a27f1012895c42d07c3449599f5c4625963027fb
Martin Prikryl 6 jaren geleden
bovenliggende
commit
c6ffbb2073
2 gewijzigde bestanden met toevoegingen van 11 en 6 verwijderingen
  1. 6 1
      source/core/Configuration.cpp
  2. 5 5
      source/windows/WinConfiguration.cpp

+ 6 - 1
source/core/Configuration.cpp

@@ -207,7 +207,12 @@ UnicodeString __fastcall TConfiguration::PropertyToKey(const UnicodeString & Pro
 {
   // no longer useful
   int P = Property.LastDelimiter(L".>");
-  return Property.SubString(P + 1, Property.Length() - P);
+  UnicodeString Result = Property.SubString(P + 1, Property.Length() - P);
+  if ((Result[1] == L'F') && ((wchar_t)toupper(Result[2]) == Result[2]))
+  {
+    Result.Delete(1, 1);
+  }
+  return Result;
 }
 //---------------------------------------------------------------------------
 #define BLOCK(KEY, CANCREATE, BLOCK) \

+ 5 - 5
source/windows/WinConfiguration.cpp

@@ -1021,9 +1021,9 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
     KEY(Integer,  RunsSinceLastTip); \
     KEY(Bool,     HonorDrivePolicy); \
     KEY(Integer,  LastMachineInstallations); \
-    KEYEX(String, FExtensionsDeleted, L"ExtensionsDeleted"); \
-    KEYEX(String, FExtensionsOrder, L"ExtensionsOrder"); \
-    KEYEX(String, FExtensionsShortCuts, L"ExtensionsShortCuts"); \
+    KEY(String,   FExtensionsDeleted); \
+    KEY(String,   FExtensionsOrder); \
+    KEY(String,   FExtensionsShortCuts); \
     KEY(Bool,     TimeoutShellOperations); \
     KEY(Bool,     TimeoutShellIconRetrieval); \
     KEY(Bool,     AllowWindowPrint); \
@@ -1148,8 +1148,8 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
     KEY(String,  ScpCommander.RemotePanel.LastPath); \
   ); \
   BLOCK(L"Security", CANCREATE, \
-    KEYEX(Bool,  FUseMasterPassword, L"UseMasterPassword"); \
-    KEYEX(String,FMasterPasswordVerifier, L"MasterPasswordVerifier"); \
+    KEY(Bool,    FUseMasterPassword); \
+    KEY(String,  FMasterPasswordVerifier); \
   );
 //---------------------------------------------------------------------------
 void __fastcall TWinConfiguration::SaveData(THierarchicalStorage * Storage, bool All)