]> git.lyx.org Git - features.git/commitdiff
Embedding: proper embedCB actions in the GuiGraphics dialog
authorBo Peng <bpeng@lyx.org>
Sat, 5 Jan 2008 04:48:47 +0000 (04:48 +0000)
committerBo Peng <bpeng@lyx.org>
Sat, 5 Jan 2008 04:48:47 +0000 (04:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22376 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiGraphics.cpp
src/frontends/qt4/GuiGraphics.h

index 31faef392492ac9fb24a61d04af1b73bac6e5d15..789d38db2f8321f26113d280a4d123745cefc4f0 100644 (file)
@@ -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()) {
index a80074e70b465abee079bcb3b2817476059cb41a..338af748925653a28699aa1ba315082fefd4c7ae 100644 (file)
@@ -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);