Kaydet (Commit) 4760c7ee authored tarafından Andras Timar's avatar Andras Timar Kaydeden (comit) Mike Kaganski

Add possibility to read <value xsi:nil="true"/> from winreg conf backend

Change-Id: I67bc14d7ee1bacc15d34e6ee25ca7638de268643
Reviewed-on: https://gerrit.libreoffice.org/53942Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst b2f445b5
...@@ -40,7 +40,8 @@ namespace { ...@@ -40,7 +40,8 @@ namespace {
// Last element of Key becomes prop, first part is the path and optionally nodes, // Last element of Key becomes prop, first part is the path and optionally nodes,
// when the node has oor:op attribute. // when the node has oor:op attribute.
// Values can be the following: Value (string), Type (string, optional), // Values can be the following: Value (string), Type (string, optional),
// Final (dword, optional), External (dword, optional), ExternalBackend (string, optional) // Final (dword, optional), External (dword, optional), ExternalBackend (string, optional),
// Nil (dword, optional)
// //
// For example the following registry setting: // For example the following registry setting:
// [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.UserProfile\Data\o] // [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.UserProfile\Data\o]
...@@ -95,6 +96,28 @@ namespace { ...@@ -95,6 +96,28 @@ namespace {
// <value oor:external="com.sun.star.configuration.backend.LdapUserProfileBe company"/> // <value oor:external="com.sun.star.configuration.backend.LdapUserProfileBe company"/>
// </prop> // </prop>
// </item> // </item>
//
// Nil example:
// Empty value (<value></value>) and nil value (<value xsi:nil="true"/>) are different.
// In case of some path settings, the base path setting has to be cleared.
// [HKEY_CURRENT_USER\Software\Policies\LibreOffice\org.openoffice.Office.Common\Path\Current\Work]
// "Value"=""
// "Final"=dword:00000001
// "Nil"=dword:00000001
// [HKEY_CURRENT_USER\Software\Policies\LibreOffice\org.openoffice.Office.Paths\Paths\org.openoffice.Office.Paths:NamedPath['Work']\WritePath]
// "Value"="file:///H:/"
// "Final"=dword:00000001
// becomes the following in configuration:
// <item oor:path="/org.openoffice.Office.Common/Path/Current">
// <prop oor:name="Work" oor:finalized="true">
// <value xsi:nil="true"/>
// </prop>
// </item>
// <item oor:path="/org.openoffice.Office.Paths/Paths/org.openoffice.Office.Paths:NamedPath['Work']">
// <prop oor:name="WritePath" oor:finalized="true">
// <value>file:///H:/</value>
// </prop>
// </item>
void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFileHandle) void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFileHandle)
{ {
...@@ -142,6 +165,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil ...@@ -142,6 +165,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
bool bFinal = false; bool bFinal = false;
bool bExternal = false; bool bExternal = false;
bool bNil = false;
OUString aValue; OUString aValue;
OUString aType; OUString aType;
OUString aExternalBackend; OUString aExternalBackend;
...@@ -162,6 +186,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil ...@@ -162,6 +186,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
if (*reinterpret_cast<DWORD*>(pValue.get()) == 1) if (*reinterpret_cast<DWORD*>(pValue.get()) == 1)
bFinal = true; bFinal = true;
} }
else if (!wcscmp(pValueName.get(), L"Nil"))
{
if (*reinterpret_cast<DWORD*>(pValue.get()) == 1)
bNil = true;
}
else if (!wcscmp(pValueName.get(), L"External")) else if (!wcscmp(pValueName.get(), L"External"))
{ {
if (*reinterpret_cast<DWORD*>(pValue.get()) == 1) if (*reinterpret_cast<DWORD*>(pValue.get()) == 1)
...@@ -237,7 +266,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil ...@@ -237,7 +266,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
if(bFinal) if(bFinal)
aFileHandle.writeString(" oor:finalized=\"true\""); aFileHandle.writeString(" oor:finalized=\"true\"");
aFileHandle.writeString("><value"); aFileHandle.writeString("><value");
if (bExternal) if (aValue.isEmpty() && bNil)
{
aFileHandle.writeString(" xsi:nil=\"true\"/");
}
else if (bExternal)
{ {
aFileHandle.writeString(" oor:external=\""); aFileHandle.writeString(" oor:external=\"");
writeAttributeValue(aFileHandle, aValue); writeAttributeValue(aFileHandle, aValue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment