]> git.lyx.org Git - features.git/commitdiff
Fix bug #11748.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 27 Feb 2020 04:00:09 +0000 (23:00 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 27 Feb 2020 04:00:09 +0000 (23:00 -0500)
Track the last chosen citation style when we clear the entries.

src/frontends/qt/GuiCitation.cpp
src/frontends/qt/GuiCitation.h

index c14d34e8c10f593f2a6e43e4fbe717e0cf4a4051..7a554e77648c97f40f1d4cec08bb87cbe447862e 100644 (file)
@@ -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();
index d3a23b587c815fcd2a5827b0c83c6d3e904017fa..29b7b9b48509d201b448fa53bc9ad4d31a5e72d7 100644 (file)
@@ -182,6 +182,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.