]> git.lyx.org Git - lyx.git/blobdiff - src/Format.cpp
Try to disambibuate the use of "xetex". Here, we actually require polyglossia.
[lyx.git] / src / Format.cpp
index 1b2ffea0d7ddde5ef00679fd9629f3d919126717..7e82f9a3b073756f4eadaed6ebc4bc702f9ed9d7 100644 (file)
@@ -25,6 +25,8 @@
 #include "support/os.h"
 #include "support/Systemcall.h"
 
+#include <algorithm>
+
 // FIXME: Q_WS_MACX is not available, it's in Qt
 #ifdef USE_MACOSX_PACKAGING
 #include "support/linkback/LinkBackProxy.h"
@@ -257,6 +259,27 @@ void Formats::setEditor(string const & name, string const & command)
 }
 
 
+bool Formats::viewURL(docstring const & url) {
+       Format const * format = getFormat("html");
+       if (!format)
+               return false;
+
+       string command = libScriptSearch(format->viewer());
+
+       if (!contains(command, token_from_format))
+               command += ' ' + token_from_format;
+       command = subst(command, token_from_format, quoteName(to_utf8(url)));
+
+       LYXERR(Debug::FILES, "Executing command: " << command);
+
+       Systemcall one;
+       one.startscript(Systemcall::DontWait, command);
+
+       // we can't report any sort of error, since we aren't waiting
+       return true;
+}
+
+
 bool Formats::view(Buffer const & buffer, FileName const & filename,
                   string const & format_name) const
 {
@@ -316,14 +339,9 @@ bool Formats::view(Buffer const & buffer, FileName const & filename,
        buffer.message(_("Executing command: ") + from_utf8(command));
 
        Systemcall one;
-       int const res = one.startscript(Systemcall::DontWait, command);
+       one.startscript(Systemcall::DontWait, command);
 
-       if (res) {
-               Alert::error(_("Cannot view file"),
-                            bformat(_("An error occurred whilst running %1$s"),
-                              makeDisplayPath(command, 50)));
-               return false;
-       }
+       // we can't report any sort of error, since we aren't waiting
        return true;
 }
 
@@ -388,14 +406,9 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename,
        buffer.message(_("Executing command: ") + from_utf8(command));
 
        Systemcall one;
-       int const res = one.startscript(Systemcall::DontWait, command);
+       one.startscript(Systemcall::DontWait, command);
 
-       if (res) {
-               Alert::error(_("Cannot edit file"),
-                            bformat(_("An error occurred whilst running %1$s"),
-                              makeDisplayPath(command, 50)));
-               return false;
-       }
+       // we can't report any sort of error, since we aren't waiting
        return true;
 }