]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiExternal.cpp
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiExternal.cpp
index a3dc99831e2ed952198310e9dec929208995eb1e..cd17d2d2f6d8e8c51a87df2f665ea278182b534b 100644 (file)
@@ -38,7 +38,6 @@
 #include "qt_helpers.h"
 #include "Validator.h"
 
-#include <QCloseEvent>
 #include <QCheckBox>
 #include <QLineEdit>
 #include <QPushButton>
 #include <QTextBrowser>
 
 using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace frontend {
 
-using support::FileFilterList;
-using support::FileName;
-using support::float_equal;
-using support::isStrDbl;
-using support::makeAbsPath;
-using support::readBB_from_PSFile;
-using support::token;
-using support::trim;
-using support::os::internal_path;
-
 using namespace external;
 
 namespace {
@@ -98,10 +88,9 @@ char const * const origin_gui_strs[] = {
 
 
 GuiExternal::GuiExternal(GuiView & lv)
-       : GuiDialog(lv, "external"), bbChanged_(false)
+       : GuiDialog(lv, "external", qt_("External Material")), bbChanged_(false)
 {
        setupUi(this);
-       setViewTitle(_("External Material"));
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
@@ -119,6 +108,8 @@ GuiExternal::GuiExternal(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(browsePB, SIGNAL(clicked()),
                this, SLOT(browseClicked()));
+       connect(embedCB, SIGNAL(toggled(bool)),
+               this, SLOT(change_adaptor()));
        connect(editPB, SIGNAL(clicked()),
                this, SLOT(editClicked()));
        connect(externalCO, SIGNAL(activated(QString)),
@@ -208,9 +199,9 @@ GuiExternal::GuiExternal(GuiView & lv)
        bc().addCheckedLineEdit(ytED, rtLA);
        bc().addCheckedLineEdit(fileED, fileLA);
 
-       std::vector<string> templates = getTemplates();
+       vector<string> templates = getTemplates();
 
-       for (std::vector<string>::const_iterator cit = templates.begin();
+       for (vector<string>::const_iterator cit = templates.begin();
                cit != templates.end(); ++cit) {
                externalCO->addItem(qt_(*cit));
        }
@@ -279,13 +270,6 @@ void GuiExternal::change_adaptor()
 }
 
 
-void GuiExternal::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
 void GuiExternal::editClicked()
 {
        editExternal();
@@ -295,7 +279,7 @@ void GuiExternal::editClicked()
 
 void GuiExternal::extraChanged(const QString& text)
 {
-       std::string const format = fromqstr(extraFormatCO->currentText());
+       string const format = fromqstr(extraFormatCO->currentText());
        extra_[format] = text;
        changed();
 }
@@ -448,7 +432,7 @@ static void setSize(QLineEdit & widthED, QComboBox & widthUnitCO,
        external::ResizeData const & data)
 {
        bool using_scale = data.usingScale();
-       std::string scale = data.scale;
+       string scale = data.scale;
        if (data.no_resize()) {
                // Everything is zero, so default to this!
                using_scale = true;
@@ -566,6 +550,7 @@ void GuiExternal::updateContents()
        string const name =
                params_.filename.outputFilename(bufferFilepath());
        fileED->setText(toqstr(name));
+       embedCB->setCheckState(params_.filename.embedded() ? Qt::Checked : Qt::Unchecked);
 
        externalCO->setCurrentIndex(getTemplateNumber(params_.templatename()));
        updateTemplate();
@@ -648,6 +633,7 @@ void GuiExternal::updateTemplate()
 void GuiExternal::applyView()
 {
        params_.filename.set(fromqstr(fileED->text()), bufferFilepath());
+       params_.filename.setEmbed(embedCB->checkState() == Qt::Checked);
 
        params_.settemplate(getTemplate(externalCO->currentIndex()).lyxName);