#include "GuiExternal.h"
+#include "Buffer.h"
#include "FuncRequest.h"
#include "support/gettext.h"
#include "Length.h"
#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"
void GuiExternal::applyView()
{
params_.filename.set(fromqstr(fileED->text()), fromqstr(bufferFilepath()));
- params_.filename.setEmbed(embedCB->checkState() == Qt::Checked);
+ 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();
#include "MetricsInfo.h"
#include "OutputParams.h"
-#include "frontends/alert.h"
-
#include "graphics/PreviewLoader.h"
#include "support/debug.h"
-#include "support/ExceptionMessage.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
namespace lyx {
-namespace Alert = frontend::Alert;
-
namespace external {
TempName::TempName()
case LFUN_INSET_MODIFY: {
InsetExternalParams p;
InsetExternalMailer::string2params(to_utf8(cmd.argument()), buffer(), p);
- if (!p.filename.empty()) {
- try {
- p.filename.enable(buffer().embedded(), &buffer(), true);
- } catch (ExceptionMessage const & message) {
- Alert::error(message.title_, message.details_);
- // do not set parameter if an error happens
- break;
- }
- }
setParams(p);
break;
}