X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbufferlist.C;h=8455604fe9570b6e97f2eafb13e7084349f31c41;hb=7aebbe6e10b3b4cf1f110b98c73a0a27059da6d8;hp=3d39fd6de8d0e2e79c4a19ae8c7cae577b04dc0a;hpb=85e30074c271cb2d13b984e9dcb223d7bdde19f4;p=lyx.git diff --git a/src/bufferlist.C b/src/bufferlist.C index 3d39fd6de8..8455604fe9 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -12,24 +12,14 @@ * ====================================================== */ +#include + #ifdef __GNUG__ #pragma implementation #endif -#include - -#include -#include -#include - -#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" @@ -43,6 +33,19 @@ #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 +#include +#include + + 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; }