]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiHyperlink.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiHyperlink.cpp
index 6cd9262798a0d092dfbf738edc150274344db55d..c063ca236260789badf89e16a8178c55e010e019 100644 (file)
@@ -24,8 +24,8 @@ namespace lyx {
        namespace frontend {
                bool operator==(lyx::docstring const & d, char const * c)
                  { return lyx::operator ==(d, c); }
-       }
-}
+       } // namespace frontend
+} // namespace lyx
 #endif
 
 
@@ -40,6 +40,8 @@ GuiHyperlink::GuiHyperlink(QWidget * parent) : InsetParamsWidget(parent)
                this, SIGNAL(changed()));
        connect(nameED, SIGNAL(textChanged(const QString &)),
                this, SIGNAL(changed()));
+       connect(literalCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
        connect(webRB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(emailRB, SIGNAL(clicked()),
@@ -58,6 +60,7 @@ void GuiHyperlink::paramsToDialog(Inset const * inset)
 
        targetED->setText(toqstr(params["target"]));
        nameED->setText(toqstr(params["name"]));
+       literalCB->setChecked(params["literal"] == "true");
        docstring const & type = params["type"];
        if (type.empty())
                webRB->setChecked(true);
@@ -68,13 +71,14 @@ void GuiHyperlink::paramsToDialog(Inset const * inset)
 }
 
 
-bool GuiHyperlink::initialiseParams(std::string const & data)
+bool GuiHyperlink::initialiseParams(std::string const & sdata)
 {
        InsetCommandParams params(insetCode());
-       if (!InsetCommand::string2params(data, params))
+       if (!InsetCommand::string2params(sdata, params))
                return false;
        targetED->setText(toqstr(params["target"]));
        nameED->setText(toqstr(params["name"]));
+       literalCB->setChecked(params["literal"] == "true");
        if (params["type"] == from_utf8("mailto:"))
                emailRB->setChecked(true);
        else if (params["type"] == from_utf8("file:"))
@@ -97,13 +101,18 @@ docstring GuiHyperlink::dialogToParams() const
                params["type"] = from_utf8("mailto:");
        else if (fileRB->isChecked())
                params["type"] = from_utf8("file:");
+       params["literal"] = literalCB->isChecked()
+                       ? from_ascii("true") : from_ascii("false");
        params.setCmdName("href");
        return from_utf8(InsetHyperlink::params2string(params));
 }
 
 
-bool GuiHyperlink::checkWidgets() const
+bool GuiHyperlink::checkWidgets(bool readonly) const
 {
+       targetED->setReadOnly(readonly);
+       nameED->setReadOnly(readonly);
+       typeGB->setEnabled(!readonly);
        if (!InsetParamsWidget::checkWidgets())
                return false;
        return !targetED->text().isEmpty() || !nameED->text().isEmpty();