Embedding: mark buffer dirty after changing embedding status

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20253 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-09-13 04:45:49 +00:00
parent c5302d6e70
commit 3cdd9376f5
2 changed files with 7 additions and 2 deletions

View File

@ -83,6 +83,8 @@ void ControlEmbeddedFiles::view(EmbeddedFile const & item)
void ControlEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed, bool update)
{
if (item.embedded() == embed)
return;
item.setEmbed(embed);
if (update) {
if (embed)
@ -91,6 +93,11 @@ void ControlEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed, bool update
item.extract(&buffer());
item.updateInsets(&buffer());
}
if (embed)
dispatchMessage("Embed file " + item.outputFilename(buffer().filePath()));
else
dispatchMessage("Stop embedding file " + item.outputFilename(buffer().filePath()));
buffer().markDirty();
}

View File

@ -36,14 +36,12 @@ void GuiEmbeddedFilesDialog::on_filesLW_itemChanged(QListWidgetItem* item)
// this should not be needed after EmbeddedFiles are updated correctly.
files.update();
controller_.setEmbed(files[filesLW->row(item)], true, files.enabled());
controller_.dispatchMessage("Embed file " + fromqstr(item->text()));
} else {
if (!files[filesLW->row(item)].embedded())
return;
// this should not be needed after EmbeddedFiles are updated correctly.
files.update();
controller_.setEmbed(files[filesLW->row(item)], false, files.enabled());
controller_.dispatchMessage("Stop embedding file " + fromqstr(item->text()));
}
}