From 60bd141f1bff5c9c9f7725c099980ec0764a8abb Mon Sep 17 00:00:00 2001 From: Richard Heck <rgheck@lyx.org> Date: Mon, 29 May 2017 22:53:11 -0400 Subject: [PATCH] Keep track of the last manually set state of the literal checkbox in the citation dialog. Use that information to set it appropriately for new citations. --- src/frontends/qt4/GuiCitation.cpp | 18 +++++++++++++++++- src/frontends/qt4/GuiCitation.h | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 2b0f05e439..d5f1ebb28a 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -235,6 +235,13 @@ void GuiCitation::on_restorePB_clicked() } +void GuiCitation::on_literalCB_clicked() +{ + literal_ = literalCB->isChecked(); + changed(); +} + + void GuiCitation::updateControls() { BiblioInfo const & bi = bibInfo(); @@ -752,7 +759,13 @@ void GuiCitation::init() documentBuffer().params().fullAuthorList()); textBeforeED->setText(toqstr(params_["before"])); textAfterED->setText(toqstr(params_["after"])); - literalCB->setChecked(params_["literal"] == "true"); + + // if this is a new citation, we set the literal checkbox + // to its last set value. + if (cited_keys_.isEmpty()) + literalCB->setChecked(literal_); + else + literalCB->setChecked(params_["literal"] == "true"); setPreTexts(getVectorFromString(params_["pretextlist"], from_ascii("\t"))); setPostTexts(getVectorFromString(params_["posttextlist"], from_ascii("\t"))); @@ -1043,6 +1056,8 @@ void GuiCitation::saveSession() const sessionKey() + "/autofind", instant_->isChecked()); settings.setValue( sessionKey() + "/citestyle", style_); + settings.setValue( + sessionKey() + "/literal", literal_); } @@ -1054,6 +1069,7 @@ void GuiCitation::restoreSession() casesense_->setChecked(settings.value(sessionKey() + "/casesensitive").toBool()); instant_->setChecked(settings.value(sessionKey() + "/autofind", true).toBool()); style_ = settings.value(sessionKey() + "/citestyle").toInt(); + literal_ = settings.value(sessionKey() + "/literal", false).toBool(); updateFilterHint(); } diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index 5a72e02dcf..db88ca9d44 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -50,6 +50,7 @@ private Q_SLOTS: void on_cancelPB_clicked(); void on_restorePB_clicked(); void on_applyPB_clicked(); + void on_literalCB_clicked(); void filterPressed(); void filterChanged(const QString & text); void on_fieldsCO_currentIndexChanged(int index); @@ -180,6 +181,9 @@ private: /// last used citation style int style_; + /// last set value for literal + /// this is used only for new citations + bool literal_; /// GuiSelectionManager * selectionManager; /// available keys.