]> git.lyx.org Git - features.git/commitdiff
Respect "literal" setting when entering citation via LyX server.
authorRichard Heck <rgheck@lyx.org>
Thu, 22 Feb 2018 20:24:28 +0000 (15:24 -0500)
committerRichard Heck <rgheck@lyx.org>
Thu, 22 Feb 2018 20:33:01 +0000 (15:33 -0500)
This requires moving the bool that tracks this somewhere that it
is visible from BufferView. It seemed to make sense to put it as
a static member of InsetCitation.

(cherry picked from commit f8e8877f839dcd0d133e6982d107b7d167c524c3)

src/BufferView.cpp
src/frontends/qt4/GuiCitation.cpp
src/frontends/qt4/GuiCitation.h
src/insets/InsetCitation.cpp
src/insets/InsetCitation.h
status.23x

index e23883cd069d4a23d77a3c2d63640d8a3d400418..7788f76d3db747c40b250e702704d6179f25ccfb 100644 (file)
@@ -2022,6 +2022,8 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                icp["key"] = from_utf8(arg);
                if (!opt1.empty())
                        icp["before"] = from_utf8(opt1);
+               icp["literal"] = 
+                       from_ascii(InsetCitation::last_literal ? "true" : "false");
                string icstr = InsetCommand::params2string(icp);
                FuncRequest fr(LFUN_INSET_INSERT, icstr);
                lyx::dispatch(fr);
index 66e7ba7aa488309717b04c7eccf2094dbef95101..ffc8254b6eebceb795c4755392fb48d149154923 100644 (file)
@@ -27,6 +27,7 @@
 #include "TextClass.h"
 #include "FuncRequest.h"
 
+#include "insets/InsetCitation.h"
 #include "insets/InsetCommand.h"
 
 #include "support/debug.h"
@@ -92,7 +93,7 @@ static vector<lyx::docstring> to_docstring_vector(QStringList const & qlist)
 
 GuiCitation::GuiCitation(GuiView & lv)
        : DialogView(lv, "citation", qt_("Citation")),
-         style_(QString()), literal_(false), params_(insetCode("citation"))
+         style_(QString()), params_(insetCode("citation"))
 {
        setupUi(this);
 
@@ -237,7 +238,7 @@ void GuiCitation::on_restorePB_clicked()
 
 void GuiCitation::on_literalCB_clicked()
 {
-       literal_ = literalCB->isChecked();
+       InsetCitation::last_literal = literalCB->isChecked();
        changed();
 }
 
@@ -768,7 +769,7 @@ void GuiCitation::init()
        // if this is a new citation, we set the literal checkbox
        // to its last set value.
        if (cited_keys_.isEmpty())
-               literalCB->setChecked(literal_);
+               literalCB->setChecked(InsetCitation::last_literal);
        else
                literalCB->setChecked(params_["literal"] == "true");
 
@@ -1061,7 +1062,7 @@ void GuiCitation::saveSession(QSettings & settings) const
        settings.setValue(
                sessionKey() + "/citestyle", style_);
        settings.setValue(
-               sessionKey() + "/literal", literal_);
+               sessionKey() + "/literal", InsetCitation::last_literal);
 }
 
 
@@ -1073,7 +1074,8 @@ void GuiCitation::restoreSession()
        casesense_->setChecked(settings.value(sessionKey() + "/casesensitive").toBool());
        instant_->setChecked(settings.value(sessionKey() + "/autofind", true).toBool());
        style_ = settings.value(sessionKey() + "/citestyle").toString();
-       literal_ = settings.value(sessionKey() + "/literal", false).toBool();
+       InsetCitation::last_literal = 
+               settings.value(sessionKey() + "/literal", false).toBool();
        updateFilterHint();
 }
 
index 008d2d556d5ba2bda38ce6485a9616e46f8b2213..4d85c0315ae242de88656a046503284b9112318b 100644 (file)
@@ -183,9 +183,6 @@ private:
 
        /// last used citation style
        QString style_;
-       /// last set value for literal
-       /// this is used only for new citations
-       bool literal_;
        ///
        GuiSelectionManager * selectionManager;
        /// available keys.
index 8571a28643b5c14e93c22eedbe47a0110cf7c55b..ca96d1d56b45cc5a3a354238329d2e7bc942f0cb 100644 (file)
@@ -62,6 +62,12 @@ InsetCitation::~InsetCitation()
 }
 
 
+// May well be over-ridden when session settings are loaded
+// in GuiCitation. Unfortunately, that will not happen until
+// such a dialog is created.
+bool InsetCitation::last_literal = true;
+
+
 ParamInfo const & InsetCitation::findInfo(string const & /* cmdName */)
 {
        // standard cite does only take one argument, but biblatex, jurabib
index 3e5e3baa35a4cec485b0aa585659b3a7993382aa..957488cd8079a1f8d2e0a172834d3970fa7d21db 100644 (file)
@@ -88,6 +88,8 @@ public:
                                       std::vector<CitationStyle> const & valid_styles) const;
        ///
        std::map<docstring, docstring> getQualifiedLists(docstring const p) const;
+       ///
+       static bool last_literal;
 
 private:
        /// tries to make a pretty label and makes a basic one if not
index e548e7dc12849ff1a16ddff3daa50e438a6914f5..d72f1bb6f12a022ce6a95957c414714c0217bf08 100644 (file)
@@ -33,6 +33,9 @@ What's new
 - Handle properly top/bottom of inset with mac-like cursor movement
   (bug 10701).
 
+- Respect the last setting of the 'literal' checkbox when adding citations
+  via the LyX server (e.g., from JabRef).
+
 - Allow unification of graphic groups inside marked block via context
   menu.