diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index 31faef3924..789d38db2f 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -279,7 +279,6 @@ void GuiGraphics::on_browsePB_clicked() docstring const str = browse(qstring_to_ucs4(filename->text())); if (!str.empty()) { filename->setText(toqstr(str)); - embedCB->setCheckState(Qt::Unchecked); changed(); } } @@ -300,6 +299,17 @@ void GuiGraphics::on_editPB_clicked() void GuiGraphics::on_filename_textChanged(const QString & filename) { editPB->setDisabled(filename.isEmpty()); + EmbeddedFile file = EmbeddedFile(fromqstr(filename), bufferFilepath()); + if (!file.embeddable()) { + embedCB->setCheckState(Qt::Unchecked); + embedCB->setDisabled(true); + } +} + + +void GuiGraphics::on_embedCB_toggled(bool) +{ + changed(); } @@ -449,7 +459,8 @@ void GuiGraphics::updateContents() string const name = igp.filename.outputFilename(bufferFilepath()); filename->setText(toqstr(name)); - embedCB->setCheckState(igp.filename.embedded() ? Qt::Checked : Qt::Unchecked); + embedCB->setEnabled(igp.filename.embeddable()); + embedCB->setCheckState(igp.filename.embedded() ? Qt::Checked : Qt::Unchecked); // set the bounding box values if (igp.bb.empty()) { diff --git a/src/frontends/qt4/GuiGraphics.h b/src/frontends/qt4/GuiGraphics.h index a80074e70b..338af74892 100644 --- a/src/frontends/qt4/GuiGraphics.h +++ b/src/frontends/qt4/GuiGraphics.h @@ -47,6 +47,7 @@ private Q_SLOTS: void on_getPB_clicked(); void on_editPB_clicked(); void on_filename_textChanged(const QString &); + void on_embedCB_toggled(bool); void on_scaleCB_toggled(bool); void on_WidthCB_toggled(bool); void on_HeightCB_toggled(bool);