From 2fd9be21437112ad6815bbcca6778f591fbd85ff Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Thu, 17 Apr 2008 18:19:17 +0000 Subject: [PATCH] Embedding: disinfect GuiInclude.cpp, GuiExternal.cpp, and GuiGraphics.cpp git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24317 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiExternal.cpp | 21 --------------------- src/frontends/qt4/GuiGraphics.cpp | 20 -------------------- src/frontends/qt4/GuiInclude.cpp | 19 ------------------- 3 files changed, 60 deletions(-) diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 460a103c4c..e14a945acd 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -14,7 +14,6 @@ #include "GuiExternal.h" -#include "Buffer.h" #include "FuncRequest.h" #include "support/gettext.h" #include "Length.h" @@ -28,10 +27,7 @@ #include "graphics/GraphicsCacheItem.h" #include "graphics/GraphicsImage.h" -#include "frontends/alert.h" - #include "support/convert.h" -#include "support/ExceptionMessage.h" #include "support/FileFilterList.h" #include "support/filetools.h" #include "support/lstrings.h" @@ -112,8 +108,6 @@ 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)), @@ -554,7 +548,6 @@ void GuiExternal::updateContents() string const name = params_.filename.outputFilename(fromqstr(bufferFilepath())); fileED->setText(toqstr(name)); - embedCB->setCheckState(params_.filename.embedded() ? Qt::Checked : Qt::Unchecked); externalCO->setCurrentIndex(getTemplateNumber(params_.templatename())); updateTemplate(); @@ -638,20 +631,6 @@ void GuiExternal::applyView() { params_.filename.set(fromqstr(fileED->text()), fromqstr(bufferFilepath())); - try { - Buffer & buf = buffer(); - EmbeddedFile file(fromqstr(fileED->text()), buf.filePath()); - file.setEmbed(embedCB->checkState() == Qt::Checked); - // move file around if needed, an exception may be raised. - file.enable(buf.embedded(), buf, true); - // if things are OK..., embed params_.filename - params_.filename.setEmbed(file.embedded()); - } catch (ExceptionMessage const & message) { - Alert::error(message.title_, message.details_); - // failed to embed - params_.filename.setEmbed(false); - } - params_.settemplate(getTemplate(externalCO->currentIndex()).lyxName); params_.draft = draftCB->isChecked(); diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index a96e1a795f..6a16a31708 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -16,7 +16,6 @@ #include "GuiGraphics.h" -#include "Buffer.h" #include "LengthCombo.h" #include "Length.h" #include "LyXRC.h" @@ -29,13 +28,10 @@ #include "graphics/GraphicsCacheItem.h" #include "graphics/GraphicsImage.h" -#include "frontends/alert.h" - #include "insets/InsetGraphicsParams.h" #include "support/convert.h" #include "support/debug.h" -#include "support/ExceptionMessage.h" #include "support/FileFilterList.h" #include "support/filetools.h" #include "support/gettext.h" @@ -129,8 +125,6 @@ GuiGraphics::GuiGraphics(GuiView & lv) //graphics pane connect(filename, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); - connect(embedCB, SIGNAL(toggled(bool)), - this, SLOT(change_adaptor())); connect(WidthCB, SIGNAL( clicked()), this, SLOT(change_adaptor())); connect(HeightCB, SIGNAL( clicked()), @@ -434,7 +428,6 @@ void GuiGraphics::updateContents() string const name = igp.filename.outputFilename(fromqstr(bufferFilepath())); filename->setText(toqstr(name)); - embedCB->setCheckState(igp.filename.embedded() ? Qt::Checked : Qt::Unchecked); // set the bounding box values if (igp.bb.empty()) { @@ -573,19 +566,6 @@ void GuiGraphics::applyView() InsetGraphicsParams & igp = params_; igp.filename.set(fromqstr(filename->text()), fromqstr(bufferFilepath())); - try { - Buffer & buf = buffer(); - EmbeddedFile file(fromqstr(filename->text()), buf.filePath()); - file.setEmbed(embedCB->checkState() == Qt::Checked); - // move file around if needed, an exception may be raised. - file.enable(buf.embedded(), buf, true); - // if things are OK..., embed igp.filename - igp.filename.setEmbed(file.embedded()); - } catch (ExceptionMessage const & message) { - Alert::error(message.title_, message.details_); - // failed to embed - igp.filename.setEmbed(false); - } // the bb section igp.bb.erase(); diff --git a/src/frontends/qt4/GuiInclude.cpp b/src/frontends/qt4/GuiInclude.cpp index 9cdad1dfa7..80323fccf7 100644 --- a/src/frontends/qt4/GuiInclude.cpp +++ b/src/frontends/qt4/GuiInclude.cpp @@ -15,7 +15,6 @@ #include "GuiInclude.h" #include "Buffer.h" -#include "EmbeddedFiles.h" #include "Format.h" #include "FuncRequest.h" #include "support/gettext.h" @@ -24,11 +23,8 @@ #include "qt_helpers.h" #include "LyXRC.h" -#include "frontends/alert.h" - #include "support/os.h" #include "support/lstrings.h" -#include "support/ExceptionMessage.h" #include "support/FileFilterList.h" #include "support/filetools.h" @@ -62,7 +58,6 @@ GuiInclude::GuiInclude(GuiView & lv) this, SLOT(change_adaptor())); connect(editPB, SIGNAL(clicked()), this, SLOT(edit())); connect(browsePB, SIGNAL(clicked()), this, SLOT(browse())); - connect(embedCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); @@ -174,7 +169,6 @@ void GuiInclude::typeChanged(int v) void GuiInclude::updateContents() { filenameED->setText(toqstr(params_["filename"])); - embedCB->setCheckState(params_["embed"].empty() ? Qt::Unchecked : Qt::Checked); visiblespaceCB->setChecked(false); visiblespaceCB->setEnabled(false); @@ -244,19 +238,6 @@ void GuiInclude::updateContents() void GuiInclude::applyView() { params_["filename"] = from_utf8(internal_path(fromqstr(filenameED->text()))); - params_["embed"].clear(); - try { - Buffer & buf = buffer(); - EmbeddedFile file(to_utf8(params_["filename"]), buf.filePath()); - file.setEmbed(embedCB->checkState() == Qt::Checked); - // move file around if needed, an exception may be raised. - file.enable(buf.embedded(), buf, true); - // if things are OK..., set params_["embed"] - params_["embed"] = file.embedded() ? from_utf8(file.inzipName()) : docstring(); - } catch (ExceptionMessage const & message) { - Alert::error(message.title_, message.details_); - // params_["embed"] will be empty if a file is failed to embed - } params_.preview(previewCB->isChecked()); int const item = typeCO->currentIndex(); -- 2.39.2