diff --git a/src/frontends/controllers/ControlEmbeddedFiles.cpp b/src/frontends/controllers/ControlEmbeddedFiles.cpp index 2146d1fa98..4b5f3aa3c8 100644 --- a/src/frontends/controllers/ControlEmbeddedFiles.cpp +++ b/src/frontends/controllers/ControlEmbeddedFiles.cpp @@ -67,6 +67,19 @@ void ControlEmbeddedFiles::dispatchMessage(string const & msg) } +void ControlEmbeddedFiles::setEmbedding(bool enable) +{ + if (embeddedFiles().enabled() == enable) + return; + embeddedFiles().enable(enable); + buffer().markDirty(); + if (enable) + dispatchMessage("Stop saving in bundled format."); + else + dispatchMessage("Save in bundled format."); +} + + void ControlEmbeddedFiles::goTo(EmbeddedFile const & item, int idx) { BOOST_ASSERT(idx < item.refCount()); diff --git a/src/frontends/controllers/ControlEmbeddedFiles.h b/src/frontends/controllers/ControlEmbeddedFiles.h index ef824e7695..ca0f979430 100644 --- a/src/frontends/controllers/ControlEmbeddedFiles.h +++ b/src/frontends/controllers/ControlEmbeddedFiles.h @@ -44,6 +44,8 @@ public: /// void dispatchParams() {}; /// + void setEmbedding(bool enable); + /// void goTo(EmbeddedFile const & item, int idx); /// void view(EmbeddedFile const & item); diff --git a/src/frontends/qt4/GuiEmbeddedFiles.cpp b/src/frontends/qt4/GuiEmbeddedFiles.cpp index fc8c112d3e..e2223fea85 100644 --- a/src/frontends/qt4/GuiEmbeddedFiles.cpp +++ b/src/frontends/qt4/GuiEmbeddedFiles.cpp @@ -199,13 +199,7 @@ void GuiEmbeddedFilesDialog::on_updatePB_clicked() void GuiEmbeddedFilesDialog::on_enableCB_toggled(bool enable) { - // - controller_.embeddedFiles().enable(enable); - // immediately post the change to buffer (and bufferView) - if (enable) - controller_.dispatchMessage("Enable file embedding"); - else - controller_.dispatchMessage("Disable file embedding"); + controller_.setEmbedding(enable); }