mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +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"])
|
||||
if result == "":
|
||||
message("no document found!")
|
||||
return 0
|
||||
exit(2)
|
||||
else:
|
||||
message("found document %s" % result)
|
||||
|
||||
@ -140,7 +140,7 @@ def main(argv):
|
||||
|
||||
subprocess.call([viewer, result])
|
||||
|
||||
return 0
|
||||
exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
|
@ -298,7 +298,8 @@ void showDirectory(FileName const & directory)
|
||||
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");
|
||||
if (prefixIs(target, "EXTERNAL ")) {
|
||||
if (!lyxrc.citation_search)
|
||||
@ -311,12 +312,23 @@ void showTarget(string const & target, string const & pdfv, string const & psv){
|
||||
opts += " -w " + psv;
|
||||
if (!opts.empty())
|
||||
opts += " ";
|
||||
FuncRequest cmd = FuncRequest(LFUN_VC_COMMAND,"U . \"" +
|
||||
lyxrc.citation_search_view + " " + opts + tar + "\"");
|
||||
lyx::dispatch(cmd);
|
||||
Systemcall one;
|
||||
string const command = lyxrc.citation_search_view + " " + opts + tar;
|
||||
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;
|
||||
}
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user