[Libreoffice-commits] core.git: sw/source

Stephan Bergmann sbergman at redhat.com
Tue Jun 6 12:25:50 UTC 2017


 sw/source/uibase/dbui/dbtree.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 7176800239f60cd3e990ddb8a6793a198d4c21e3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 6 14:25:05 2017 +0200

    tdf#107231 Sort list of databases
    
    Change-Id: I3271c205676de83ce3cad924b81e3b97ddb65f45

diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index c7ac900b50db..217aafee44ae 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <com/sun/star/container/XContainerListener.hpp>
 #include <com/sun/star/container/XContainer.hpp>
 #include <cppuhelper/implbase.hxx>
@@ -182,6 +183,13 @@ void SwDBTreeList::InitTreeList()
     GetModel()->SetCompareHdl(LINK(this, SwDBTreeList, DBCompare));
 
     Sequence< OUString > aDBNames = pImpl->GetContext()->getElementNames();
+    auto const sort = comphelper::string::NaturalStringSorter(
+        comphelper::getProcessComponentContext(),
+        Application::GetSettings().GetUILanguageTag().getLocale());
+    std::sort(
+        aDBNames.begin(), aDBNames.end(),
+        [&sort](OUString const & x, OUString const & y)
+        { return sort.compare(x, y) < 0; });
     const OUString* pDBNames = aDBNames.getConstArray();
     long nCount = aDBNames.getLength();
 


More information about the Libreoffice-commits mailing list