]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiHyperlink.cpp
Patch from Vincent van Ravesteijn.
[lyx.git] / src / frontends / qt4 / GuiHyperlink.cpp
index 95ae76a64a09e62819d68632735f1a07e725415e..58819fd2e034167e508be51e0859357a34451078 100644 (file)
@@ -26,7 +26,8 @@ namespace lyx {
 namespace frontend {
 
 GuiHyperlink::GuiHyperlink(GuiView & lv)
-       : GuiCommand(lv, "href",qt_("Hyperlink"))
+       : GuiDialog(lv, "href", qt_("Hyperlink")),
+    params_(insetCode("href"))
 {
        setupUi(this);
 
@@ -61,7 +62,7 @@ void GuiHyperlink::changed_adaptor()
 }
 
 
-void GuiHyperlink::updateContents()
+void GuiHyperlink::paramsToDialog(InsetCommandParams const & icp)
 {
        targetED->setText(toqstr(params_["target"]));
        nameED->setText(toqstr(params_["name"]));
@@ -91,10 +92,24 @@ void GuiHyperlink::applyView()
 
 bool GuiHyperlink::isValid()
 {
-       QString const u = targetED->text();
-       QString const n = nameED->text();
+       return !targetED->text().isEmpty() || !nameED->text().isEmpty();
+}
+
 
-       return !u.isEmpty() || !n.isEmpty();
+bool GuiHyperlink::initialiseParams(std::string const & data)
+{
+       // The name passed with LFUN_INSET_APPLY is also the name
+       // used to identify the mailer.
+       InsetCommand::string2params("href", data, params_);
+       paramsToDialog(params_);
+       return true;
+}
+
+
+void GuiHyperlink::dispatchParams()
+{
+       std::string const lfun = InsetCommand::params2string("href", params_);
+       dispatch(FuncRequest(getLfun(), lfun));
 }