[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Add a real Cancel button to 'Already Loaded' dialog box (part of #8787). Also correlate
From:       Juergen Spitzmueller <spitz () lyx ! org>
Date:       2013-11-28 16:06:53
Message-ID: 20131128160653.DE6DC280429 () lyx ! lyx ! org
[Download RAW message or body]

commit afab1140e9598b136e7deb89d79275087c422ca4
Author: Juergen Spitzmueller <spitz@lyx.org>
Date:   Thu Nov 28 17:06:49 2013 +0100

    Add a real Cancel button to 'Already Loaded' dialog box (part of #8787).
    Also correlate the other buttons more explicitly to the question asked.

diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp
index d096eeb..26bff55 100644
--- a/src/buffer_funcs.cpp
+++ b/src/buffer_funcs.cpp
@@ -73,13 +73,22 @@ Buffer * checkAndLoadLyXFile(FileName const & filename, bool const acceptDirty)
 		docstring const text = bformat(_(
 				"The document %1$s is already loaded and has unsaved changes.\n"
 				"Do you want to abandon your changes and reload the version on disk?"), file);
-		if (!Alert::prompt(_("Reload saved document?"),
-			  text, 1, 1,  _("&Reload"), _("&Keep Changes"))) {
-			// reload the document
-			if (checkBuffer->reload() != Buffer::ReadSuccess)
+		int res = Alert::prompt(_("Reload saved document?"),
+					text, 2, 2,  _("Yes, &Reload"), _("No, &Keep Changes"), _("&Cancel"));
+		switch (res) {
+			case 0: {
+				// reload the document
+				if (checkBuffer->reload() != Buffer::ReadSuccess)
+					return 0;
+				return checkBuffer;
+			}
+			case 1:
+				// keep changes
+				return checkBuffer;
+			case 2:
+				// cancel
 				return 0;
 		}
-		return checkBuffer;
 	}
 
 	bool const exists = filename.exists();

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic