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
This commit is contained in:
Bo Peng 2008-03-12 21:42:55 +00:00
parent a3c4711b08
commit fd34e3def1

View File

@ -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