[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - basctl/source

Michael Meeks michael.meeks at collabora.com
Sat Aug 22 12:11:30 PDT 2015


 basctl/source/dlged/managelang.cxx |   36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

New commits:
commit a198e618f6e7a94536c259247151150a6e3ea361
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Aug 22 11:25:13 2015 +0100

    tdf#93077 - basic dialog localization issues.
    
    Don't remove non-existent languages to clean the dialog.
    Avoid crashing when adding languages to a non-localized dialog.
    
    Change-Id: Ie356177e00e56c214727d513ae0ce6d62d32591c
    Reviewed-on: https://gerrit.libreoffice.org/17932
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 998a688..bde64e2 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -149,12 +149,19 @@ IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl)
     ScopedVclPtrInstance< SetDefaultLanguageDialog > aDlg( this, m_xLocalizationMgr );
     if ( RET_OK == aDlg->Execute() )
     {
-        // add new locales
-        Sequence< Locale > aLocaleSeq = aDlg->GetLocales();
-        m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
-        // update listbox
-        ClearLanguageBox();
-        FillLanguageBox();
+        if (!m_xLocalizationMgr->isLibraryLocalized())
+        {
+            SAL_WARN("basctl.basicide", "Adding langs to non-localized library tdf#93077");
+        }
+        else
+        {
+            // add new locales
+            Sequence< Locale > aLocaleSeq = aDlg->GetLocales();
+            m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
+            // update listbox
+            ClearLanguageBox();
+            FillLanguageBox();
+        }
 
         if (SfxBindings* pBindings = GetBindingsPtr())
             pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
@@ -277,16 +284,17 @@ void SetDefaultLanguageDialog::FillLanguageBox()
 {
     // fill list with all languages
     m_pLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL, false );
-    // remove the already localized languages
-    Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales();
-    const Locale* pLocale = aLocaleSeq.getConstArray();
-    sal_Int32 i, nCount = aLocaleSeq.getLength();
-    for ( i = 0;  i < nCount;  ++i )
-        m_pLanguageLB->RemoveLanguage( LanguageTag::convertToLanguageType( pLocale[i] ) );
-
-    // fill checklistbox if not in default mode
+
     if ( m_xLocalizationMgr->isLibraryLocalized() )
     {
+        // remove the already localized languages
+        Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales();
+        const Locale* pLocale = aLocaleSeq.getConstArray();
+        sal_Int32 i, nCount = aLocaleSeq.getLength();
+        for ( i = 0;  i < nCount;  ++i )
+            m_pLanguageLB->RemoveLanguage( LanguageTag::convertToLanguageType( pLocale[i] ) );
+
+        // fill checklistbox if not in default mode
         sal_uInt16 j, nCount_ = m_pLanguageLB->GetEntryCount();
         for ( j = 0;  j < nCount_;  ++j )
         {


More information about the Libreoffice-commits mailing list