]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBibtex.cpp
Do not show master's errors if compiling child
[lyx.git] / src / frontends / qt4 / GuiBibtex.cpp
index 1be20bc4b1fd441e7a344bd23f16e43fead0a533..4b4dd7e61c7dead146cf2b4ff0a85f7c606a069e 100644 (file)
@@ -57,6 +57,7 @@ GuiBibtex::GuiBibtex(GuiView & lv)
        setupUi(this);
 
        QDialog::setModal(true);
+       setWindowModality(Qt::WindowModal);
 
        connect(okPB, SIGNAL(clicked()),
                this, SLOT(slotOK()));
@@ -110,6 +111,10 @@ GuiBibtex::GuiBibtex(GuiView & lv)
        connect(add_->closePB, SIGNAL(clicked()),
                add_, SLOT(reject()));
 
+       add_->bibLW->setToolTip(formatToolTip(qt_("This list consists of all databases that are indexed by LaTeX and thus are found without a file path. "
+                                   "This is usually everything in the bib/ subdirectory of LaTeX's texmf tree. "
+                                   "If you want to reuse your own database, this is the place you should store it.")));
+
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
        bc().setOK(okPB);
        bc().setCancel(closePB);
@@ -300,6 +305,11 @@ void GuiBibtex::updateContents()
        bool bibtopic = usingBibtopic();
        bool biblatex = usingBiblatex();
 
+       if (biblatex)
+               setTitle(qt_("Biblatex Bibliography"));
+       else
+               setTitle(qt_("BibTeX Bibliography"));
+
        databaseLW->clear();
 
        docstring bibs = params_["bibfiles"];
@@ -326,20 +336,19 @@ void GuiBibtex::updateContents()
        bibtocCB->setChecked(bibtotoc() && !bibtopic);
        bibtocCB->setEnabled(!bibtopic);
 
-       if (!bibtopic && btPrintCO->count() == 3)
-               btPrintCO->removeItem(1);
-       else if (bibtopic && btPrintCO->count() < 3)
-               btPrintCO->insertItem(1, qt_("all uncited references", 0));
-
-       docstring const & btprint = params_["btprint"];
-       int btp = 0;
-       if ((bibtopic && btprint == from_ascii("btPrintNotCited")) ||
-          (!bibtopic && btprint == from_ascii("btPrintAll")))
-               btp = 1;
-       else if (bibtopic && btprint == from_ascii("btPrintAll"))
-               btp = 2;
+       btPrintCO->clear();
+       btPrintCO->addItem(qt_("all cited references"), toqstr("btPrintCited"));
+       if (bibtopic)
+               btPrintCO->addItem(qt_("all uncited references"), toqstr("btPrintNotCited"));
+       btPrintCO->addItem(qt_("all references"), toqstr("btPrintAll"));
+       if (usingBiblatex() && !buffer().masterParams().multibib.empty())
+               btPrintCO->addItem(qt_("all reference units"), toqstr("bibbysection"));
 
-       btPrintCO->setCurrentIndex(btp);
+       docstring btprint = params_["btprint"];
+       if (btprint.empty())
+               // default
+               btprint = from_ascii("btPrintCited");
+       btPrintCO->setCurrentIndex(btPrintCO->findData(toqstr(btprint)));
 
        // Only useful for biblatex
        biblatexOptsLA->setVisible(biblatex);
@@ -411,35 +420,7 @@ void GuiBibtex::applyView()
 
        params_["biblatexopts"] = qstring_to_ucs4(biblatexOptsLE->text());
 
-       int btp = btPrintCO->currentIndex();
-
-       if (usingBibtopic()) {
-               // bibtopic allows three kinds of sections:
-               // 1. sections that include all cited references of the database(s)
-               // 2. sections that include all uncited references of the database(s)
-               // 3. sections that include all references of the database(s), cited or not
-               switch (btp) {
-               case 0:
-                       params_["btprint"] = from_ascii("btPrintCited");
-                       break;
-               case 1:
-                       params_["btprint"] = from_ascii("btPrintNotCited");
-                       break;
-               case 2:
-                       params_["btprint"] = from_ascii("btPrintAll");
-                       break;
-               }
-       } else {
-               switch (btp) {
-               case 0:
-                       params_["btprint"] = docstring();
-                       break;
-               case 1:
-                       // use \nocite{*}
-                       params_["btprint"] = from_ascii("btPrintAll");
-                       break;
-               }
-       }
+       params_["btprint"] = qstring_to_ucs4(btPrintCO->itemData(btPrintCO->currentIndex()).toString());
 }
 
 
@@ -512,7 +493,7 @@ void GuiBibtex::rescanBibStyles() const
 
 bool GuiBibtex::usingBibtopic() const
 {
-       return buffer().params().use_bibtopic;
+       return buffer().params().useBibtopic();
 }
 
 
@@ -524,7 +505,7 @@ bool GuiBibtex::bibtotoc() const
 
 bool GuiBibtex::usingBiblatex() const
 {
-       return buffer().params().useBiblatex();
+       return buffer().masterBuffer()->params().useBiblatex();
 }