]> git.lyx.org Git - features.git/commitdiff
Fix bug #2120 - Emergency saves removal.
authorPavel Sanda <sanda@lyx.org>
Tue, 11 Aug 2009 08:20:43 +0000 (08:20 +0000)
committerPavel Sanda <sanda@lyx.org>
Tue, 11 Aug 2009 08:20:43 +0000 (08:20 +0000)
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg143251.html
http://marc.info/?l=lyx-devel&m=124938609111483&w=2

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30976 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp

index 3095b484f64bdc935ca0f2d6626305533661e003..c97a6cddf4d0969f30a58f21874c17e1555d4cb4 100644 (file)
@@ -3040,11 +3040,32 @@ bool Buffer::readFileHelper(FileName const & s)
                                      _("&Recover"),  _("&Load Original"),
                                      _("&Cancel")))
                {
-               case 0:
+               case 0: {
                        // the file is not saved if we load the emergency file.
                        markDirty();
-                       return readFile(e);
+                       docstring str;
+                       bool res;
+
+                       if ((res = readFile(e)) == success)
+                               str = _("Document was successfully recovered.");
+                       else
+                               str = _("Document was NOT successfully recovered.");
+                       str += "\n\n" + _("Remove emergency file now?");
+
+                       if (!Alert::prompt(_("Delete emergency file?"), str, 1, 1,
+                                       _("&Remove"), _("&Keep it"))) {
+                               e.removeFile();
+                               if (res == success)
+                                       Alert::warning(_("Emergency file deleted"),
+                                               _("Do not forget to save your file now!"), true);
+                               }
+                       return res;
+               }
                case 1:
+                       if (!Alert::prompt(_("Delete emergency file?"),
+                                       _("Remove emergency file now?"), 1, 1,
+                                       _("&Remove"), _("&Keep it")))
+                               e.removeFile();
                        break;
                default:
                        return false;