]> git.lyx.org Git - features.git/commitdiff
Fix bug #11456.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Mon, 18 May 2020 04:28:36 +0000 (00:28 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Mon, 18 May 2020 04:30:13 +0000 (00:30 -0400)
Add cancel button and take no action if we're canceled.

(cherry picked from commit 2de99c5dd9ebdc47f7f569ddf71e44557745f413)

src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h
status.23x

index f2d3157a325d0433397c5872be0e7cbf8c2edc94..ba4cd78dfe958e5edfccfeb77b5be6d433d342cb 100644 (file)
@@ -2884,7 +2884,9 @@ bool GuiView::closeWorkArea(GuiWorkArea * wa)
                                  "  Tools->Preferences->Look&Feel->UserInterface\n"
                                ), file);
                        int ret = Alert::prompt(_("Close or hide document?"),
-                               text, 0, 1, _("&Close"), _("&Hide"));
+                               text, 0, 2, _("&Close"), _("&Hide"), _("&Cancel"));
+                       if (ret == 2)
+                               return false;
                        close_buffer = (ret == 0);
                }
        }
@@ -3023,12 +3025,13 @@ bool GuiView::closeBuffer(Buffer & buf)
                        // Even in this case, children can be dirty (e.g.,
                        // after a label change in the master, see #11405).
                        // Therefore, check this
-                       if (closing_ && (child_buf->isClean() || child_buf->paragraphs().empty()))
+                       if (closing_ && (child_buf->isClean() || child_buf->paragraphs().empty())) {
                                // If we are in a close_event all children will be closed in some time,
                                // so no need to do it here. This will ensure that the children end up
                                // in the session file in the correct order. If we close the master
                                // buffer, we can close or release the child buffers here too.
                                continue;
+                       }
                        // Save dirty buffers also if closing_!
                        if (saveBufferIfNeeded(*child_buf, false)) {
                                child_buf->removeAutosaveFile();
@@ -3045,8 +3048,8 @@ bool GuiView::closeBuffer(Buffer & buf)
                // goto bookmark to update bookmark pit.
                // FIXME: we should update only the bookmarks related to this buffer!
                LYXERR(Debug::DEBUG, "GuiView::closeBuffer()");
-               for (size_t i = 0; i < theSession().bookmarks().size(); ++i)
-                       guiApp->gotoBookmark(i+1, false, false);
+               for (unsigned int i = 0; i < theSession().bookmarks().size(); ++i)
+                       guiApp->gotoBookmark(i + 1, false, false);
 
                if (saveBufferIfNeeded(buf, false)) {
                        buf.removeAutosaveFile();
index 3ca4641ce0178cf4dd04a28662b6d963ca037d5b..e78df4b7a9542bc8641967fce624cf7d8f447779 100644 (file)
@@ -414,7 +414,7 @@ private:
        /// closes the tabworkarea and all tabs. If we are in a close event,
        /// all buffers will be closed, otherwise they will be hidden.
        bool closeTabWorkArea(TabWorkArea * twa);
-       /// gives the user the possibility to save his work
+        /// gives the user the possibility to save their work
        /// or to discard the changes. If hiding is true, the
        /// document will be reloaded.
        bool saveBufferIfNeeded(Buffer & buf, bool hiding);
index 4b05d28d0b57a3cd8a21d9a466c5113c2cd225d5..d634b07da05c48d9dcea9a9758ae0518252f6d97 100644 (file)
@@ -128,6 +128,9 @@ What's new
 - Correct hierarchy level of Bib(la)tex inset in outliner if "Show in Toc"
   is selected (bug 11863).
 
+- Don't close a document if the "close or hide" dialog is canceled (bug
+  11456).
+
 
 * INTERNALS