]> git.lyx.org Git - features.git/commitdiff
Tolerate formats that are not supported by lyx2lyx.
authorTommaso Cucinotta <tommaso@lyx.org>
Wed, 19 Oct 2016 09:18:10 +0000 (11:18 +0200)
committerTommaso Cucinotta <tommaso@lyx.org>
Fri, 5 May 2017 06:31:24 +0000 (08:31 +0200)
src/Buffer.cpp

index 58de3b5a922d01630545cca1d9078d04a1d94dee..3d0f7800631082cca22f528e4d023865fa22e5b7 100644 (file)
@@ -1179,14 +1179,22 @@ Buffer::ReadStatus Buffer::readFile(FileName const & fn)
        if (file_format != LYX_FORMAT) {
                FileName tmpFile;
                ReadStatus ret_clf = convertLyXFormat(fn, tmpFile, file_format);
-               if (ret_clf != ReadSuccess)
-                       return ret_clf;
-               ret_clf = readFile(tmpFile);
                if (ret_clf == ReadSuccess) {
-                       d->file_format = file_format;
-                       d->need_format_backup = true;
+                       ret_clf = readFile(tmpFile);
+                       if (ret_clf == ReadSuccess) {
+                               d->file_format = file_format;
+                               d->need_format_backup = true;
+                               return ret_clf;
+                       }
+               }
+               if (ret_clf != ReadSuccess) {
+                       int const ret = Alert::prompt(_("Document format failure"),
+                               _("Fileformat unrecognized by lyx2lyx. Trying to load anyway, "
+                                 "but some contents might be lost and LyX might crash!\n"
+                                 "Would you like to proceed ?"), 0, 1, _("&No"), _("&Yes"));
+                       if (ret == 0)
+                               return ret_clf;
                }
-               return ret_clf;
        }
 
        // FIXME: InsetInfo needs to know whether the file is under VCS