basctl/source/dlged/managelang.cxx | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
New commits: commit f2f97ec5bf4f2808544bef5eb583ed4d424acfa9 Author: Michael Meeks <[email protected]> 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/17929 Tested-by: Jenkins <[email protected]> Tested-by: Julien Nabet <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> 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 ) {
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
