From 9073fd6b9fc46cf5da5f2041719c3d7c91e1ce7b Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sat, 5 Jan 2008 04:48:47 +0000 Subject: [PATCH] Embedding: proper embedCB actions in the GuiGraphics dialog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22376 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiGraphics.cpp | 15 +++++++++++++-- src/frontends/qt4/GuiGraphics.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) 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);