mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Report back if citation target could not be opened
This commit is contained in:
parent
5cc191ddee
commit
ff14d0bd00
@ -122,7 +122,7 @@ def main(argv):
|
|||||||
result = find(args, path = os.environ["HOME"])
|
result = find(args, path = os.environ["HOME"])
|
||||||
if result == "":
|
if result == "":
|
||||||
message("no document found!")
|
message("no document found!")
|
||||||
return 0
|
exit(2)
|
||||||
else:
|
else:
|
||||||
message("found document %s" % result)
|
message("found document %s" % result)
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ def main(argv):
|
|||||||
|
|
||||||
subprocess.call([viewer, result])
|
subprocess.call([viewer, result])
|
||||||
|
|
||||||
return 0
|
exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
@ -298,7 +298,8 @@ void showDirectory(FileName const & directory)
|
|||||||
LYXERR0("Unable to open QUrl even though dir exists!");
|
LYXERR0("Unable to open QUrl even though dir exists!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void showTarget(string const & target, string const & pdfv, string const & psv){
|
void showTarget(string const & target, string const & pdfv, string const & psv)
|
||||||
|
{
|
||||||
LYXERR(Debug::INSETS, "Showtarget:" << target << "\n");
|
LYXERR(Debug::INSETS, "Showtarget:" << target << "\n");
|
||||||
if (prefixIs(target, "EXTERNAL ")) {
|
if (prefixIs(target, "EXTERNAL ")) {
|
||||||
if (!lyxrc.citation_search)
|
if (!lyxrc.citation_search)
|
||||||
@ -311,12 +312,23 @@ void showTarget(string const & target, string const & pdfv, string const & psv){
|
|||||||
opts += " -w " + psv;
|
opts += " -w " + psv;
|
||||||
if (!opts.empty())
|
if (!opts.empty())
|
||||||
opts += " ";
|
opts += " ";
|
||||||
FuncRequest cmd = FuncRequest(LFUN_VC_COMMAND,"U . \"" +
|
Systemcall one;
|
||||||
lyxrc.citation_search_view + " " + opts + tar + "\"");
|
string const command = lyxrc.citation_search_view + " " + opts + tar;
|
||||||
lyx::dispatch(cmd);
|
int const result = one.startscript(Systemcall::Wait, command);
|
||||||
|
if (result == 1)
|
||||||
|
// Script failed
|
||||||
|
frontend::Alert::error(_("Could not open file"),
|
||||||
|
_("The lyxpaperview script failed."));
|
||||||
|
else if (result == 2)
|
||||||
|
frontend::Alert::error(_("Could not open file"),
|
||||||
|
bformat(_("No file was found using the pattern `%1$s'."),
|
||||||
|
from_utf8(tar)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDesktopServices::openUrl(QUrl(toqstr(target), QUrl::TolerantMode));
|
if (!QDesktopServices::openUrl(QUrl(toqstr(target), QUrl::TolerantMode)))
|
||||||
|
frontend::Alert::error(_("Could not open file"),
|
||||||
|
bformat(_("The target `%1$s' could not be resolved."),
|
||||||
|
from_utf8(target)));
|
||||||
}
|
}
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user