From 6fd2f7769f7deaa694f931fc00b25ddd0a588d48 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 21 Jul 2019 16:27:12 +0200 Subject: [PATCH] Hide custom_language_package if custom is not selected Otherwise people might read it as if babel was automatically selected --- src/frontends/qt/GuiPrefs.cpp | 18 +++++++++++++++--- src/frontends/qt/GuiPrefs.h | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp index 728e8fe379..185b718083 100644 --- a/src/frontends/qt/GuiPrefs.cpp +++ b/src/frontends/qt/GuiPrefs.cpp @@ -2463,7 +2463,13 @@ void PrefLanguage::on_uiLanguageCO_currentIndexChanged(int) void PrefLanguage::on_languagePackageCO_currentIndexChanged(int i) { - languagePackageED->setEnabled(i == 2); + if (i == 2) + languagePackageED->setText(save_langpack_); + else if (!languagePackageED->text().isEmpty()) { + save_langpack_ = languagePackageED->text(); + languagePackageED->clear(); + } + languagePackageED->setEnabled(i == 2); } @@ -2505,8 +2511,14 @@ void PrefLanguage::updateRC(LyXRC const & rc) explicitDocLangBeginCB->setChecked(!rc.language_auto_begin); explicitDocLangEndCB->setChecked(!rc.language_auto_end); languagePackageCO->setCurrentIndex(rc.language_package_selection); - languagePackageED->setText(toqstr(rc.language_custom_package)); - languagePackageED->setEnabled(languagePackageCO->currentIndex() == 2); + if (languagePackageCO->currentIndex() == 2) { + languagePackageED->setText(toqstr(rc.language_custom_package)); + languagePackageED->setEnabled(true); + } else { + languagePackageED->clear(); + save_langpack_ = toqstr(rc.language_custom_package); + languagePackageED->setEnabled(false); + } globalCB->setChecked(rc.language_global_options); startCommandED->setText(toqstr(rc.language_command_begin)); endCommandED->setText(toqstr(rc.language_command_end)); diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h index df16fde51b..edf3aad72a 100644 --- a/src/frontends/qt/GuiPrefs.h +++ b/src/frontends/qt/GuiPrefs.h @@ -408,6 +408,9 @@ public: private Q_SLOTS: void on_uiLanguageCO_currentIndexChanged(int); void on_languagePackageCO_currentIndexChanged(int); +private: + /// + QString save_langpack_; };