[LyX/2.4.x] Remove unneeded cycle checks (#12954)

Juergen Spitzmueller spitz at lyx.org
Wed Jul 3 07:56:50 UTC 2024


commit 03f59bf49e24d3ed2afb0d1f388778f0742e94f5
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Jun 23 14:53:07 2024 +0200

    Remove unneeded cycle checks (#12954)
    
    (cherry picked from commit b5260a3a0f8b5267b108b9d94520a6b77b2fe5ac)
---
 src/frontends/qt/GuiDocument.cpp | 10 ++--------
 src/frontends/qt/GuiDocument.h   |  3 ---
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 5a57ada79d..11d8f53cd9 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -821,7 +821,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 	: GuiDialog(lv, "document", qt_("Document Settings")),
 	  biblioChanged_(false), nonModuleChanged_(false),
 	  modulesChanged_(false), shellescapeChanged_(false),
-	  switchback_(false), prompted_(false)
+	  switchback_(false)
 {
 	setupUi(this);
 
@@ -1889,21 +1889,15 @@ void GuiDocument::onBufferViewChanged()
 	    && theBufferList().exists(FileName(prev_buffer_filename_))
 	    && buttonBox->button(QDialogButtonBox::Apply)->isEnabled()) {
 		// Only ask if we haven't yet in this cycle
-		int const ret = prompted_ ? 3 : Alert::prompt(_("Unapplied changes"),
+		int const ret = Alert::prompt(_("Unapplied changes"),
 				_("Some changes in the previous document were not yet applied.\n"
 				"Do you want to switch back in order to apply them or dismiss the changes?"),
 				1, 1, _("&Switch Back"), _("&Dismiss Changes"));
 		if (ret == 0) {
 			// Switch to previous buffer view
 			switchback_ = true;
-			// Record that we have asked.
-			prompted_ = true;
 			lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH, prev_buffer_filename_));
 			return;
-		} else if (ret == 3) {
-			// We are in the second cycle. Set back.
-			prompted_ = false;
-			return;
 		}
 	}
 
diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h
index c7d0cc06f8..acb7c91b17 100644
--- a/src/frontends/qt/GuiDocument.h
+++ b/src/frontends/qt/GuiDocument.h
@@ -358,9 +358,6 @@ private:
 	/// Track if we switch back to a buffer due to unapplied
 	/// changes
 	bool switchback_;
-	/// Track whether we prompted the user about unapplied
-	/// changes
-	bool prompted_;
 	/// Cache margin values
 	std::string tmp_leftmargin_;
 	///


More information about the lyx-cvs mailing list