]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBibtex.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiBibtex.cpp
index 1a1dfb6ca9f0e4b7a402c0c36b8f6eea82ca0dd4..cfc696664ad77fb9e4a1d73976bb58aef662b6eb 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "EmbeddedFiles.h"
 #include "ui_BibtexAddUi.h"
 #include "qt_helpers.h"
 #include "Validator.h"
 
 #include "frontends/alert.h"
 
+#include "insets/InsetBibtex.h"
+
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
 #include "support/FileFilterList.h"
+#include "support/FileName.h"
 #include "support/filetools.h" // changeExtension
 #include "support/gettext.h"
 #include "support/lstrings.h"
@@ -206,9 +208,7 @@ void GuiBibtex::addDatabase()
                        if (matches.empty()) {
                                QString label = item->text();
                                QListWidgetItem * db = new QListWidgetItem(label);
-                               db->setFlags(db->flags() | Qt::ItemIsSelectable
-                                       | Qt::ItemIsUserCheckable);
-                               db->setCheckState(Qt::Checked);
+                               db->setFlags(db->flags() | Qt::ItemIsSelectable);
                                databaseLW->addItem(db);
                        }
                }
@@ -221,9 +221,7 @@ void GuiBibtex::addDatabase()
                        databaseLW->findItems(f, Qt::MatchExactly);
                if (matches.empty()) {
                        QListWidgetItem * db = new QListWidgetItem(f);
-                       db->setFlags(db->flags() | Qt::ItemIsSelectable
-                               | Qt::ItemIsUserCheckable);
-                       db->setCheckState(Qt::Checked);
+                       db->setFlags(db->flags() | Qt::ItemIsSelectable);
                        databaseLW->addItem(db);
                }
        }
@@ -288,19 +286,14 @@ void GuiBibtex::updateContents()
        databaseLW->clear();
 
        docstring bibs = params_["bibfiles"];
-       docstring embs = params_["embed"];
        docstring bib;
-       docstring emb;
 
        while (!bibs.empty()) {
                bibs = split(bibs, bib, ',');
-               embs = split(embs, emb, ',');
                bib = trim(bib);
                if (!bib.empty()) {
                        QListWidgetItem * db = new QListWidgetItem(toqstr(bib));
-                       db->setFlags(db->flags() | Qt::ItemIsSelectable
-                               | Qt::ItemIsUserCheckable);
-                       db->setCheckState(emb.empty() ? Qt::Unchecked : Qt::Checked);
+                       db->setFlags(db->flags() | Qt::ItemIsSelectable);
                        databaseLW->addItem(db);
                }
        }
@@ -358,34 +351,17 @@ void GuiBibtex::updateContents()
 void GuiBibtex::applyView()
 {
        docstring dbs;
-       docstring emb;
 
        unsigned int maxCount = databaseLW->count();
-       Buffer & buf = buffer();
        for (unsigned int i = 0; i < maxCount; i++) {
-               if (i != 0) {
+               if (i != 0)
                        dbs += ',';
-                       emb += ',';
-               }
-               QString filename = databaseLW->item(i)->text();
-               dbs += qstring_to_ucs4(filename);
-               try {
-                       EmbeddedFile file(fromqstr(changeExtension(filename, "bib")),
-                               buf.filePath());
-                       file.setEmbed(databaseLW->item(i)->checkState() == Qt::Checked);
-                       // move file around if needed, an exception may be raised.
-                       file.enable(buf.embedded(), &buf, true);
-                       // if things are OK..., 
-                       if (file.embedded())
-                               emb += from_utf8(file.inzipName());
-               } catch (ExceptionMessage const & message) {
-                       Alert::error(message.title_, message.details_);
-                       // failed to embed
-               }
+               QString item = databaseLW->item(i)->text();
+               docstring bibfile = qstring_to_ucs4(item);
+               dbs += bibfile;
        }
 
        params_["bibfiles"] = dbs;
-       params_["embed"] = emb;
 
        docstring const bibstyle = qstring_to_ucs4(styleCB->currentText());
        bool const bibtotoc = bibtocCB->isChecked();
@@ -515,7 +491,7 @@ QString GuiBibtex::styleFile() const
 {
        // the different bibtex packages have (and need) their
        // own "plain" stylefiles
-       biblio::CiteEngine const engine = buffer().params().getEngine();
+       biblio::CiteEngine const engine = buffer().params().citeEngine();
        QString defaultstyle;
        switch (engine) {
        case biblio::ENGINE_BASIC: