X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfunc.C;h=4570bfba8f511ab85c6e4ac5f501e9d105ff67ce;hb=969ab85d985485f503790cb13f98a582d4e1cdb5;hp=5358c2412f39e086f3bf6448b7f08cbe876bab68;hpb=2af3ebc90354052e7895be57848a986fa238f6de;p=lyx.git diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 5358c2412f..4570bfba8f 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -577,6 +577,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const case LFUN_DIALOG_SHOW_NEW_INSET: enable = cur.inset().lyxCode() != InsetBase::ERT_CODE; + if (cur.inset().lyxCode() == InsetBase::CAPTION_CODE) { + FuncStatus flag; + if (cur.inset().getStatus(cur, cmd, flag)) + return flag; + } break; case LFUN_DIALOG_UPDATE: { @@ -1055,9 +1060,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd) } else { // case 1: print to a file + FileName const filename(makeAbsPath(target_name, path)); + if (fs::exists(filename.toFilesystemEncoding())) { + docstring text = bformat( + _("The file %1$s already exists.\n\n" + "Do you want to over-write that file?"), + makeDisplayPath(filename.absFilename())); + if (Alert::prompt(_("Over-write file?"), + text, 0, 1, _("&Over-write"), _("&Cancel")) != 0) { + showPrintError(buffer->fileName()); + break; + } + } command += lyxrc.print_to_file - + quoteName(makeAbsPath(target_name, - path).toFilesystemEncoding()) + + quoteName(filename.toFilesystemEncoding()) + ' ' + quoteName(dviname); res = one.startscript(Systemcall::DontWait,