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

Caolán McNamara caolanm at redhat.com
Wed Jul 27 08:11:50 UTC 2016


 sw/source/ui/index/swuiidxmrk.cxx |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

New commits:
commit c755336853f20c7b2dd14e9c56eeb441d831be2c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 27 09:10:29 2016 +0100

    Resolves: tdf#57978 don't show duplicate index keys in dropdown list
    
    Change-Id: I25e25157063ea4424f770b397d879cb7bfd46bcb

diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index ac7e0c0..a6a180d 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -192,17 +192,24 @@ void SwIndexMarkPane::InitControls()
         m_pTypeDCB->InsertEntry( pSh->GetTOXType(TOX_USER, i)->GetTypeName() );
 
     // read keywords primary
-    std::vector<OUString> aArr;
-    pSh->GetTOIKeys( TOI_PRIMARY, aArr );
-    std::sort(aArr.begin(), aArr.end());
-    for (std::vector<OUString>::iterator it = aArr.begin(); it != aArr.end(); ++it)
-        m_pKey1DCB->InsertEntry( *it );
+    {
+        std::vector<OUString> aArr;
+        pSh->GetTOIKeys(TOI_PRIMARY, aArr);
+        std::sort(aArr.begin(), aArr.end());
+        auto last = std::unique(aArr.begin(), aArr.end());
+        for (auto it = aArr.begin(); it != last; ++it)
+            m_pKey1DCB->InsertEntry(*it);
+    }
 
     // read keywords secondary
-    pSh->GetTOIKeys( TOI_SECONDARY, aArr );
-    std::sort(aArr.begin(), aArr.end());
-    for (std::vector<OUString>::iterator it = aArr.begin(); it != aArr.end(); ++it)
-        m_pKey2DCB->InsertEntry( *it );
+    {
+        std::vector<OUString> aArr;
+        pSh->GetTOIKeys( TOI_SECONDARY, aArr );
+        std::sort(aArr.begin(), aArr.end());
+        auto last = std::unique(aArr.begin(), aArr.end());
+        for (auto it = aArr.begin(); it != last; ++it)
+            m_pKey2DCB->InsertEntry(*it);
+    }
 
     UpdateLanguageDependenciesForPhoneticReading();
 


More information about the Libreoffice-commits mailing list