From b45f8b96a6156e9c405fc074dfa8718e1679c934 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Wed, 19 Aug 2009 21:12:53 +0000 Subject: [PATCH] File->Close All now really closes all buffers. That is, all visible buffers in all views and all hidden buffers. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31151 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index b482b08a05..c92103062a 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1188,21 +1188,9 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) enable = buf; break; - case LFUN_BUFFER_CLOSE_ALL: { - enable = false; - BufferList::iterator it = theBufferList().begin(); - BufferList::iterator end = theBufferList().end(); - int visible_buffers = 0; - for (; it != end; ++it) { - if (workArea(**it)) - ++visible_buffers; - if (visible_buffers > 1) { - enable = true; - break; - } - } + case LFUN_BUFFER_CLOSE_ALL: + enable = theBufferList().last() != theBufferList().first(); break; - } case LFUN_SPLIT_VIEW: if (cmd.getArg(0) == "vertical") @@ -1892,8 +1880,14 @@ void GuiView::writeSession() const { bool GuiView::closeBufferAll() { - // First close all workareas. This will make - // sure that dirty buffers are saved. + // Close the workareas in all other views + QList const ids = guiApp->viewIds(); + for (int i = 0; i != ids.size(); ++i) { + if (id_ != ids[i] && !guiApp->view(ids[i]).closeWorkAreaAll()) + return false; + } + + // Close our own workareas if (!closeWorkAreaAll()) return false;