[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - configmgr/source

Andras Timar andras.timar at collabora.com
Tue May 8 10:04:43 UTC 2018


 configmgr/source/winreg.cxx |   37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

New commits:
commit 5e71db87d491ac6782655dd36f23624a4eb81fe8
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon May 7 12:23:02 2018 -0700

    Add possibility to read <value xsi:nil="true"/> from winreg conf backend
    
    Change-Id: I67bc14d7ee1bacc15d34e6ee25ca7638de268643
    Reviewed-on: https://gerrit.libreoffice.org/53942
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx
index b4c2cf0fb06c..c6f7eb841731 100644
--- a/configmgr/source/winreg.cxx
+++ b/configmgr/source/winreg.cxx
@@ -37,7 +37,8 @@ namespace {
 // Last element of Key becomes prop, first part is the path and optionally nodes,
 // when the node has oor:op attribute.
 // 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:
 // [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.UserProfile\Data\o]
@@ -92,6 +93,28 @@ namespace {
 //         <value oor:external="com.sun.star.configuration.backend.LdapUserProfileBe company"/>
 //     </prop>
 // </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)
 {
@@ -134,6 +157,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
 
             bool bFinal = false;
             bool bExternal = false;
+            bool bNil = false;
             OUString aValue;
             OUString aType;
             OUString aExternalBackend;
@@ -154,6 +178,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
                     if (*reinterpret_cast<DWORD*>(pValue) == 1)
                         bFinal = true;
                 }
+                else if (!wcscmp(pValueName.get(), L"Nil"))
+                {
+                    if (*reinterpret_cast<DWORD*>(pValue.get()) == 1)
+                        bNil = true;
+                }
                 else if (!wcscmp(pValueName, L"External"))
                 {
                     if (*reinterpret_cast<DWORD*>(pValue) == 1)
@@ -228,7 +257,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
             if(bFinal)
                 writeData(aFileHandle, " oor:finalized=\"true\"");
             writeData(aFileHandle, "><value");
-            if (bExternal)
+            if (aValue.isEmpty() && bNil)
+            {
+                aFileHandle.writeString(" xsi:nil=\"true\"/");
+            }
+            else if (bExternal)
             {
                 writeData(aFileHandle, " oor:external=\"");
                 writeAttributeValue(aFileHandle, aValue);


More information about the Libreoffice-commits mailing list