]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
A better fix for bug 675:
[lyx.git] / src / lyxfunc.C
index 5358c2412f39e086f3bf6448b7f08cbe876bab68..4570bfba8f511ab85c6e4ac5f501e9d105ff67ce 100644 (file)
@@ -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,