From: Richard Kimberly Heck Date: Thu, 27 Feb 2020 04:00:09 +0000 (-0500) Subject: Fix bug #11748. X-Git-Tag: 2.3.5~85 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7c0cbe68bc11bbe00deaa0346d96948a9827f35d;p=lyx.git Fix bug #11748. Track the last chosen citation style when we clear the entries. (cherry picked from commit 64f7da961a853f4ea60716129f0f22f39e451aa7) --- diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 638ec7d84d..0a9dbbf1ee 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -386,6 +386,8 @@ void GuiCitation::updateStyles(BiblioInfo const & bi) int curr = selectedLV->model()->rowCount() - 1; if (curr < 0 || selected_keys.empty()) { + last_chosen_style_ = + citationStyleCO->itemData(citationStyleCO->currentIndex()).toString(); citationStyleCO->clear(); citationStyleCO->setEnabled(false); citationStyleLA->setEnabled(false); @@ -408,7 +410,10 @@ void GuiCitation::updateStyles(BiblioInfo const & bi) // save old style selection QString const curdata = citationStyleCO->itemData(citationStyleCO->currentIndex()).toString(); - QString const olddata = (curdata.isEmpty()) ? style_ : curdata; + QString const olddata = (curdata.isEmpty()) ? + (last_chosen_style_.isEmpty() ? style_ : last_chosen_style_): curdata; + // reset this + last_chosen_style_.clear(); citationStyleCO->clear(); BiblioInfo::CiteStringMap::const_iterator cit = sty.begin(); BiblioInfo::CiteStringMap::const_iterator end = sty.end(); diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index 4d85c0315a..08a7c4c42d 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -183,6 +183,8 @@ private: /// last used citation style QString style_; + /// this is the last style chosen in the current dialog + QString last_chosen_style_; /// GuiSelectionManager * selectionManager; /// available keys. diff --git a/status.23x b/status.23x index 3fbb135d68..cf3a79311f 100644 --- a/status.23x +++ b/status.23x @@ -27,6 +27,8 @@ What's new * USER INTERFACE +- Keep citation style when all selected citations are deleted (bug 11748). + * DOCUMENTATION AND LOCALIZATION