]> git.lyx.org Git - lyx.git/blobdiff - src/bufferlist.C
include shuffling and a mathed compile fix
[lyx.git] / src / bufferlist.C
index 3d39fd6de8d0e2e79c4a19ae8c7cae577b04dc0a..8455604fe9570b6e97f2eafb13e7084349f31c41 100644 (file)
  * ====================================================== 
  */
 
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <config.h>
-
-#include <assert.h>
-#include <algorithm>
-#include <functional>
-
-#include "frontends/Alert.h"
 #include "bufferlist.h"
 #include "lyx_main.h"
-#include "support/FileInfo.h"
-#include "support/filetools.h"
-#include "support/lyxmanip.h"
-#include "support/lyxfunctional.h"
-#include "support/LAssert.h"
 #include "lyx_gui_misc.h"
 #include "lastfiles.h"
 #include "debug.h"
 #include "vc-backend.h"
 #include "TextCache.h"
 
+#include "frontends/Alert.h"
+
+#include "support/FileInfo.h"
+#include "support/filetools.h"
+#include "support/lyxmanip.h"
+#include "support/lyxfunctional.h"
+#include "support/LAssert.h"
+
+#include <assert.h>
+#include <algorithm>
+#include <functional>
+
+
 using std::vector;
 using std::find;
 using std::endl;
@@ -127,32 +130,33 @@ bool BufferList::qwriteOne(Buffer * buf, string const & fname, string & unsaved_
                        return false;
                }
        }
-       return false;
+       return true;
 }
 
  
 bool BufferList::qwriteAll()
 {
-        bool are_unsaved = false;
-        string unsaved;
+       string unsaved;
        for (BufferStorage::iterator it = bstore.begin();
-               it != bstore.end(); ++it) {
+            it != bstore.end(); ++it)
+       {
                if (!(*it)->isLyxClean()) {
                        string fname;
                        if ((*it)->isUnnamed())
                                fname = OnlyFilename((*it)->fileName());
                        else
                                fname = MakeDisplayPath((*it)->fileName(), 50);
-                       are_unsaved = qwriteOne(*it, fname, unsaved);
+                       if (!qwriteOne(*it, fname, unsaved)) // cancel the request!
+                               return false;
                }
        }
  
-        if (are_unsaved && lyxrc.exit_confirmation) {
+       if (!unsaved.empty() && lyxrc.exit_confirmation) {
                return Alert::askQuestion(_("Some documents were not saved:"),
-                       unsaved, _("Exit anyway?"));
-        }
+                                         unsaved, _("Exit anyway?"));
+       }
 
-        return true;
+       return true;
 }