[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - framework/inc framework/source

Tor Lillqvist tml at collabora.com
Thu Aug 21 05:14:49 PDT 2014


 framework/inc/services/pathsettings.hxx    |    4 +--
 framework/source/services/pathsettings.cxx |   32 ++++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 0d7dee3c85cb0a7e85214432cd4b13328d77d497
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Aug 19 20:16:53 2014 +0300

    bnc#529470: I can't remove a path in AutoText dialog
    
    This is, not surprisingly, somewhat weird code, but I think this patch does
    what is necessary, it does fix the bug.
    
    Change-Id: Ie1947b311f1455ba48a904f5ef42ad92899fac31
    Reviewed-on: https://gerrit.libreoffice.org/11032
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/framework/inc/services/pathsettings.hxx b/framework/inc/services/pathsettings.hxx
index 34e65f5..352e824 100644
--- a/framework/inc/services/pathsettings.hxx
+++ b/framework/inc/services/pathsettings.hxx
@@ -372,8 +372,8 @@ class PathSettings : // base classes
             So real user defined paths can be extracted from the list of
             fix internal paths !
          */
-        void impl_purgeKnownPaths(const PathSettings::PathInfo& rPath,
-                                         OUStringList&           lList);
+        void impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
+                                  OUStringList&           lList);
 
         /** rebuild the member m_lPropDesc using the path list m_lPaths. */
         void impl_rebuildPropertyDescriptor();
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 15fb3c0..77d2224 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -694,10 +694,13 @@ OUStringList PathSettings::impl_convertOldStyle2Path(const OUString& sOldStylePa
 }
 
 //-----------------------------------------------------------------------------
-void PathSettings::impl_purgeKnownPaths(const PathSettings::PathInfo& rPath,
-                                               OUStringList&           lList)
+void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
+                                        OUStringList&           lList)
 {
-    OUStringList::const_iterator pIt;
+    OUStringList::iterator pIt;
+
+    // Erase items in the internal path list from lList.
+    // Also erase items in the internal path list from the user path list.
     for (  pIt  = rPath.lInternalPaths.begin();
            pIt != rPath.lInternalPaths.end()  ;
          ++pIt                                 )
@@ -706,7 +709,29 @@ void PathSettings::impl_purgeKnownPaths(const PathSettings::PathInfo& rPath,
         OUStringList::iterator pItem = lList.find(rItem);
         if (pItem != lList.end())
             lList.erase(pItem);
+        pItem = rPath.lUserPaths.find(rItem);
+        if (pItem != rPath.lUserPaths.end())
+            rPath.lUserPaths.erase(pItem);
+    }
+
+    // Erase itsems not in lList from the user path list.
+    pIt = rPath.lUserPaths.begin();
+    while ( pIt != rPath.lUserPaths.end() )
+    {
+        const OUString& rItem = *pIt;
+        OUStringList::iterator pItem = lList.find(rItem);
+        if ( pItem == lList.end() )
+        {
+            rPath.lUserPaths.erase(pIt);
+            pIt = rPath.lUserPaths.begin();
+        }
+        else
+        {
+            ++pIt;
+        }
     }
+
+    // Erase items in the user path list from lList.
     for (  pIt  = rPath.lUserPaths.begin();
            pIt != rPath.lUserPaths.end()  ;
          ++pIt                             )
@@ -717,6 +742,7 @@ void PathSettings::impl_purgeKnownPaths(const PathSettings::PathInfo& rPath,
             lList.erase(pItem);
     }
 
+    // Erase the write path from lList
     OUStringList::iterator pItem = lList.find(rPath.sWritePath);
     if (pItem != lList.end())
         lList.erase(pItem);


More information about the Libreoffice-commits mailing list