The branch, 2.0.x, has been updated.

- Log -----------------------------------------------------------------

commit b59496c70dbd482ee3ea6e0bb46e19757d6b2193
Author: Vincent van Ravesteijn <[email protected]>
Date:   Sun May 6 20:06:28 2012 +0200

    Properly mark a buffer as internal
    
    Checking the extension of the temporary filename doesn't work anymore
    since the naming of temporary files was corrected.
    
    (cherry picked from commit 5279d5a8a58b9e59442b9f3f504ea397274e2b19)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index e863ce3..8dbf9b1 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -195,6 +195,9 @@ public:
        /// is this an unnamed file (New...)?
        bool unnamed;
 
+       /// is this an internal bufffer?
+       bool internal_buffer;
+
        /// buffer is r/o
        bool read_only;
 
@@ -352,12 +355,12 @@ static FileName createBufferTmpDir()
 Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_,
        Buffer const * cloned_buffer)
        : owner_(owner), lyx_clean(true), bak_clean(true), unnamed(false),
-         read_only(readonly_), filename(file), file_fully_loaded(false),
-         toc_backend(owner), macro_lock(false), timestamp_(0),
-         checksum_(0), wa_(0), gui_(0), undo_(*owner), 
bibinfo_cache_valid_(false),
-         bibfile_cache_valid_(false), cite_labels_valid_(false),
-         cloned_buffer_(cloned_buffer), clone_list_(0), doing_export(false),
-         parent_buffer(0)
+         internal_buffer(false), read_only(readonly_), filename(file),
+         file_fully_loaded(false), toc_backend(owner), macro_lock(false),
+         timestamp_(0), checksum_(0), wa_(0), gui_(0), undo_(*owner),
+         bibinfo_cache_valid_(false), bibfile_cache_valid_(false), 
+         cite_labels_valid_(false), cloned_buffer_(cloned_buffer),
+         clone_list_(0), doing_export(false), parent_buffer(0)
 {
        if (!cloned_buffer_) {
                temppath = createBufferTmpDir();
@@ -376,6 +379,7 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, 
bool readonly_,
        bibfile_status_ = cloned_buffer_->d->bibfile_status_;
        unnamed = cloned_buffer_->d->unnamed;
        cite_labels_valid_ = cloned_buffer_->d->cite_labels_valid_;
+       internal_buffer = cloned_buffer_->d->internal_buffer;
 }
 
 
@@ -2580,7 +2584,13 @@ bool Buffer::isUnnamed() const
 /// retrieving fileName() nor for checking if it is unnamed or not.
 bool Buffer::isInternal() const
 {
-       return fileName().extension() == "internal";
+       return d->internal_buffer;
+}
+
+
+void Buffer::setInternal(bool flag)
+{
+       d->internal_buffer = flag;
 }
 
 
diff --git a/src/Buffer.h b/src/Buffer.h
index 66b9b28..9cba73c 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -364,6 +364,8 @@ public:
        /// automatically saved, nor it needs to trigger any "do you want to 
save ?" question.
        bool isInternal() const;
 
+       void setInternal(bool flag);
+
        /// Mark this buffer as dirty.
        void markDirty();
 
diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index d31af1b..6ded894 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -471,6 +471,7 @@ void putClipboard(ParagraphList const & paragraphs,
        // would not be needed.
        static Buffer * buffer = theBufferList().newBuffer(
                FileName::tempName("clipboard.internal").absFileName());
+       buffer->setInternal(true);
        buffer->setUnnamed(true);
        buffer->paragraphs() = paragraphs;
        buffer->inset().setBuffer(*buffer);
diff --git a/src/frontends/qt4/GuiWorkArea.cpp 
b/src/frontends/qt4/GuiWorkArea.cpp
index ac45494..0b6b5a7 100644
--- a/src/frontends/qt4/GuiWorkArea.cpp
+++ b/src/frontends/qt4/GuiWorkArea.cpp
@@ -1371,6 +1371,7 @@ EmbeddedWorkArea::EmbeddedWorkArea(QWidget * w): 
GuiWorkArea(w)
 {
        buffer_ = theBufferList().newBuffer(
                support::FileName::tempName("embedded.internal").absFileName());
+       buffer_->setInternal(true);
        buffer_->setUnnamed(true);
        buffer_->setFullyLoaded(true);
        setBuffer(*buffer_);

-----------------------------------------------------------------------

Summary of changes:
 src/Buffer.cpp                    |   24 +++++++++++++++++-------
 src/Buffer.h                      |    2 ++
 src/CutAndPaste.cpp               |    1 +
 src/frontends/qt4/GuiWorkArea.cpp |    1 +
 4 files changed, 21 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to