]> git.lyx.org Git - features.git/commitdiff
Dissect closeBuffer() and saveBufferIfNeeded().
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 12 Aug 2009 18:50:09 +0000 (18:50 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 12 Aug 2009 18:50:09 +0000 (18:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30992 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h

index 5e767b8c92601c8e769f1523d0e6514e465d496a..77e916b518af49488c41b41b6e9b0a105babe3d8 100644 (file)
@@ -1937,7 +1937,7 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
        for (size_t i = 0; i < theSession().bookmarks().size(); ++i)
                theLyXFunc().gotoBookmark(i+1, false, false);
 
-       if (buf.isClean() || buf.paragraphs().empty()) {
+       if (saveBufferIfNeeded(buf)) {
                // save in sessions if requested
                // do not save childs if their master
                // is opened as well
@@ -1950,6 +1950,15 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
                        theBufferList().release(&buf);
                return true;
        }
+       return false;
+}
+
+
+bool GuiView::saveBufferIfNeeded(Buffer & buf)
+{
+       if (buf.isClean() || buf.paragraphs().empty())
+               return true;
+
        // Switch to this Buffer.
        setBuffer(&buf);
 
@@ -1983,17 +1992,6 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
        case 2:
                return false;
        }
-
-       // save file names to .lyx/session
-       if (tolastopened)
-               theSession().lastOpened().add(buf.fileName(), mark_active);
-
-       if (buf.parent())
-               // Don't close child documents.
-               removeWorkArea(currentMainWorkArea());
-       else
-               theBufferList().release(&buf);
-
        return true;
 }
 
index c2fb794d11655abea962d3f88f39b2de040d2911..260f9e8ce6eb1c6fb2af63c182e51bd349e8d01d 100644 (file)
@@ -297,6 +297,8 @@ private:
        bool closeBuffer(Buffer & buf, bool tolastopened = false,
                bool mark_active = false);
        ///
+       bool saveBufferIfNeeded(Buffer & buf);
+       ///
        bool closeBufferAll(bool tolastopened = false);
        ///
        enum NextOrPrevious {