]> 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 063bce724ee924c493fa2f9baaef349b4e3d927a..58819fd2e034167e508be51e0859357a34451078 100644 (file)
@@ -18,7 +18,6 @@
 #include "insets/InsetCommand.h"
 
 #include <QCheckBox>
-#include <QCloseEvent>
 #include <QLineEdit>
 #include <QPushButton>
 
@@ -27,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);
 
@@ -62,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"]));
@@ -92,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));
 }