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.
This commit is contained in:
Richard Heck 2017-05-29 22:53:11 -04:00
parent 7f0a1df472
commit 60bd141f1b
2 changed files with 21 additions and 1 deletions

View File

@ -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();
}

View File

@ -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.