]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetHyperlink.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / insets / InsetHyperlink.cpp
index e9c9efea9164b5e251d5079c70e92246c87e3bde..eec468ba8d0f42e4261cc0b7599fdee9cc2e20d8 100644 (file)
@@ -35,7 +35,7 @@ namespace lyx {
 
 
 InsetHyperlink::InsetHyperlink(Buffer * buf, InsetCommandParams const & p)
-       : InsetCommand(buf, p, "href")
+       : InsetCommand(buf, p)
 {}
 
 
@@ -89,7 +89,7 @@ bool InsetHyperlink::getStatus(Cursor & cur, FuncRequest const & cmd,
 {
        switch (cmd.action()) {
        case LFUN_INSET_EDIT:
-               flag.setEnabled(getParam("type") == "file:");
+               flag.setEnabled(getParam("type").empty() || getParam("type") == "file:");
                return true;
 
        default:
@@ -100,12 +100,14 @@ bool InsetHyperlink::getStatus(Cursor & cur, FuncRequest const & cmd,
 
 void InsetHyperlink::viewTarget() const
 {
-       // FIXME implement viewer for web url
-       if (getParam("type") != "file:")
-               return;
-       FileName url = makeAbsPath(to_utf8(getParam("target")), buffer().filePath());
-       string format = formats.getFormatFromFile(url);
-       formats.view(buffer(), url, format);
+       if (getParam("type").empty()) 
+               formats.viewURL(to_ascii(getParam("target")));
+
+       else if (getParam("type") == "file:") {
+               FileName url = makeAbsPath(to_utf8(getParam("target")), buffer().filePath());
+               string format = formats.getFormatFromFile(url);
+               formats.view(buffer(), url, format);
+       }
 }