void registerBibfiles(docstring_list const & bf) const;
///
support::FileName getBibfilePath(docstring const & bibid) const;
+ /// Return the list with all bibfiles in use (including bibfiles
+ /// of loaded child documents).
+ docstring_list const &
+ getBibfiles(UpdateScope scope = UpdateMaster) const;
/// routines for dealing with possible self-inclusion
void pushIncludedBuffer(Buffer const * buf) const;
/// last time we loaded the cache. Note that this does NOT update the
/// cached information.
void checkIfBibInfoCacheIsValid() const;
- /// Return the list with all bibfiles in use (including bibfiles
- /// of loaded child documents).
- docstring_list const &
- getBibfiles(UpdateScope scope = UpdateMaster) const;
///
void collectChildren(ListOfBuffers & children, bool grand_children) const;
#include "insets/InsetBibtex.h"
#include "support/debug.h"
+#include "support/docstring_list.h"
#include "support/ExceptionMessage.h"
#include "support/FileName.h"
#include "support/filetools.h" // changeExtension
this, SLOT(change_adaptor()));
connect(browseBibPB, SIGNAL(clicked()),
this, SLOT(browseBibPressed()));
+ connect(inheritPB, SIGNAL(clicked()),
+ this, SLOT(inheritPressed()));
selected_model_.insertColumns(0, 1);
selectionManager = new GuiSelectionManager(this, availableLV, selectedLV,
int const srows = selectedLV->model()->rowCount();
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(srows > 0);
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(srows > 0);
+ inheritPB->setEnabled(hasInherits());
}
}
+bool GuiBibtex::hasInherits()
+{
+ if (!buffer().parent())
+ return false;
+
+ docstring_list const mbibs = buffer().masterBuffer()->getBibfiles();
+ if (mbibs.empty())
+ return false;
+
+ for (auto const & f : mbibs) {
+ if (!selected_bibs_.contains(toqstr(f)))
+ return true;
+ }
+ return false;
+}
+
+
+void GuiBibtex::inheritPressed()
+{
+ docstring_list const mbibs = buffer().masterBuffer()->getBibfiles();
+ bool chng = false;
+ vector<docstring> nfe;
+ for (auto const & f : mbibs) {
+ if (!selected_bibs_.contains(toqstr(f))) {
+ selected_bibs_.append(toqstr(f));
+ setSelectedBibs(selected_bibs_);
+ string enc;
+ if (usingBiblatex()) {
+ string const bfe = buffer().masterParams().bibFileEncoding(to_utf8(f));
+ if (!bfe.empty())
+ nfe.push_back(f + " " + from_utf8(bfe));
+ }
+ chng = true;
+ }
+ }
+ if (chng) {
+ if (!nfe.empty())
+ setFileEncodings(nfe);
+ change_adaptor();
+ }
+}
+
+
void GuiBibtex::on_editPB_clicked()
{
QModelIndexList selIdx =
bibtocCB->setChecked((bibtotoc() && !bibtopic) || hasbibintoc);
bibtocCB->setEnabled(!bibtopic && !hasbibintoc);
+ inheritPB->setEnabled(hasInherits());
+
btPrintCO->clear();
btPrintCO->addItem(qt_("all cited references"), toqstr("btPrintCited"));
if (bibtopic)