X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FFormat.cpp;h=7e82f9a3b073756f4eadaed6ebc4bc702f9ed9d7;hb=dad3c8ce74d1ebea92973bea5ca44f97d660d38e;hp=74a19eaf23596d05c3127508e23b0ab8a725b679;hpb=b1d6406ac4da81d589c0b0aafeb99ac6de363d6e;p=lyx.git diff --git a/src/Format.cpp b/src/Format.cpp index 74a19eaf23..7e82f9a3b0 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -258,29 +258,28 @@ void Formats::setEditor(string const & name, string const & command) it->setEditor(command); } -bool Formats::viewURL(string const &url){ + +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(url)); + command = subst(command, token_from_format, quoteName(to_utf8(url))); LYXERR(Debug::FILES, "Executing command: " << command); - //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 URL"), - 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; } + bool Formats::view(Buffer const & buffer, FileName const & filename, string const & format_name) const { @@ -340,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; } @@ -412,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; }