+void InsetHyperlink::doDispatch(Cursor & cur, FuncRequest & cmd)
+{
+ switch (cmd.action()) {
+
+ case LFUN_INSET_EDIT:
+ viewTarget();
+ break;
+
+ default:
+ InsetCommand::doDispatch(cur, cmd);
+ break;
+ }
+}
+
+
+bool InsetHyperlink::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
+{
+ switch (cmd.action()) {
+ case LFUN_INSET_EDIT: {
+ QUrl url(toqstr(getParam("target")),QUrl::StrictMode);
+ bool url_valid = getParam("type").empty() && url.isValid();
+
+ flag.setEnabled(url_valid || getParam("type") == "file:");
+ return true;
+ }
+
+ default:
+ return InsetCommand::getStatus(cur, cmd, flag);
+ }
+}
+
+
+void InsetHyperlink::viewTarget() const
+{
+ if (getParam("type").empty()) { //==Web
+ QUrl url(toqstr(getParam("target")),QUrl::StrictMode);
+ if (!QDesktopServices::openUrl(url))
+ LYXERR0("Unable to open URL!");
+
+ } else if (getParam("type") == "file:") {
+ FileName url = makeAbsPath(to_utf8(getParam("target")), buffer().filePath());
+ string const format = theFormats().getFormatFromFile(url);
+ theFormats().view(buffer(), url, format);
+ }
+}
+
+
+void InsetHyperlink::latex(otexstream & os,
+ OutputParams const & runparams) const