commit 2de99c5dd9ebdc47f7f569ddf71e44557745f413
Author: Richard Kimberly Heck <[email protected]>
Date:   Mon May 18 00:28:36 2020 -0400

    Fix bug #11456.
    
    Add cancel button and take no action if we're canceled.
---
 src/frontends/qt/GuiView.cpp |   11 +++++++----
 src/frontends/qt/GuiView.h   |    2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 87a4f32..f939573 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -3070,7 +3070,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);
                }
        }
@@ -3214,12 +3216,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();
@@ -3236,8 +3239,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();
diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h
index 007e4f9..5bbac22 100644
--- a/src/frontends/qt/GuiView.h
+++ b/src/frontends/qt/GuiView.h
@@ -423,7 +423,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);
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to