]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiHyperlink.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiHyperlink.cpp
index 7cb9cc61d4ad7f5c4791eb3416fd9708c5137d96..6cd9262798a0d092dfbf738edc150274344db55d 100644 (file)
@@ -68,6 +68,23 @@ void GuiHyperlink::paramsToDialog(Inset const * inset)
 }
 
 
+bool GuiHyperlink::initialiseParams(std::string const & data)
+{
+       InsetCommandParams params(insetCode());
+       if (!InsetCommand::string2params(data, params))
+               return false;
+       targetED->setText(toqstr(params["target"]));
+       nameED->setText(toqstr(params["name"]));
+       if (params["type"] == from_utf8("mailto:"))
+               emailRB->setChecked(true);
+       else if (params["type"] == from_utf8("file:"))
+               fileRB->setChecked(true);
+       else
+               webRB->setChecked(true);
+       return true;
+}
+
+
 docstring GuiHyperlink::dialogToParams() const
 {
        InsetCommandParams params(insetCode());
@@ -75,11 +92,11 @@ docstring GuiHyperlink::dialogToParams() const
        params["target"] = qstring_to_ucs4(targetED->text());
        params["name"] = qstring_to_ucs4(nameED->text());
        if (webRB->isChecked())
-               params["type"] = qstring_to_ucs4("");
+               params["type"] = from_utf8("");
        else if (emailRB->isChecked())
-               params["type"] = qstring_to_ucs4("mailto:");
+               params["type"] = from_utf8("mailto:");
        else if (fileRB->isChecked())
-               params["type"] = qstring_to_ucs4("file:");
+               params["type"] = from_utf8("file:");
        params.setCmdName("href");
        return from_utf8(InsetHyperlink::params2string(params));
 }