]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiInclude.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / GuiInclude.cpp
index 3e184cd3529ce146bc777f593be6c5ece4495819..43f71d73441a2f392cd1ee72ddd683fa01e2dc36 100644 (file)
@@ -31,9 +31,9 @@
 #include "insets/InsetListingsParams.h"
 #include "insets/InsetInclude.h"
 
-#include <QPushButton>
 #include <QCheckBox>
 #include <QLineEdit>
+#include <QPushButton>
 
 #include <utility>
 
@@ -51,8 +51,8 @@ GuiInclude::GuiInclude(GuiView & lv)
 {
        setupUi(this);
 
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+               this, SLOT(slotButtonBox(QAbstractButton *)));
 
        connect(visiblespaceCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
        connect(filenameED, SIGNAL(textChanged(const QString &)),
@@ -64,6 +64,7 @@ GuiInclude::GuiInclude(GuiView & lv)
        connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
        connect(captionLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
        connect(labelLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
+       connect(literalCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
        connect(listingsED, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
        connect(listingsED, SIGNAL(textChanged()), this, SLOT(setListingsMsg()));
        connect(bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
@@ -72,8 +73,8 @@ GuiInclude::GuiInclude(GuiView & lv)
        setFocusProxy(filenameED);
 
        bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy);
-       bc().setOK(okPB);
-       bc().setCancel(closePB);
+       bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
+       bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
        bc().addReadOnly(filenameED);
        bc().addReadOnly(browsePB);
        bc().addReadOnly(visiblespaceCB);
@@ -156,7 +157,7 @@ void GuiInclude::typeChanged(int v)
        //see this thread
        //  http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg118471.html
        //for the reason this is here.
-       okPB->setDefault(true);
+       buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
 }
 
 
@@ -227,6 +228,7 @@ void GuiInclude::paramsToDialog(InsetCommandParams const & icp)
                string extra = getStringFromVector(pars);
                listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
        }
+       literalCB->setChecked(icp["literal"] == "true");
 
        // Make sure that the bc is in the INITIAL state
        if (bc().policy().buttonStatus(ButtonPolicy::OKAY))
@@ -265,6 +267,8 @@ void GuiInclude::applyView()
                else
                        params_.setCmdName("verbatiminput");
        }
+       params_["literal"] = literalCB->isChecked()
+                       ? from_ascii("true") : from_ascii("false");
 }
 
 
@@ -327,7 +331,7 @@ QString GuiInclude::browse(QString const & in_name, Type in_type) const
        QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
 
        return browseRelToParent(in_name, docpath, title, filters, false,
-               qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+               qt_("D&ocuments"), toqstr(lyxrc.document_path));
 }