From fd34e3def1e1e978e669e54c32f1105298353292 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 12 Mar 2008 21:42:55 +0000 Subject: [PATCH] Embedding: adjust how parameters are passed from the graphics dialog to InsetInclude git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23694 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetInclude.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 4e48f9a3d2..140fe76cc2 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -270,13 +270,16 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd) try { // the embed parameter passed back from the dialog // is "true" or "false", we need to change it. - if (p["embed"] == _("false")) - p["embed"].clear(); + EmbeddedFile file = EmbeddedFile(to_utf8(p["filename"]), + onlyPath(parentFilename(buf))); + file.setEmbed(p["embed"] == _("true")); + // move file around if needed, an exception may be raised. + file.enable(buf.embedded(), &buf, true); + // if things are OK..., set p["embed"] + if (file.embedded()) + p["embed"] = from_utf8(file.inzipName()); else - p["embed"] = from_utf8(EmbeddedFile(to_utf8(p["filename"]), - onlyPath(parentFilename(buf))).inzipName()); - // test parameter - includedFilename(cur.buffer(), p); + p["embed"].clear(); } catch (ExceptionMessage const & message) { Alert::error(message.title_, message.details_); // do not set parameter if an error happens -- 2.39.2