mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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.
This commit is contained in:
parent
cd691081b4
commit
5279d5a8a5
@ -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;
|
||||
|
||||
@ -355,11 +358,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),
|
||||
preview_loader_(0), cloned_buffer_(cloned_buffer), clone_list_(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), preview_loader_(0),
|
||||
cloned_buffer_(cloned_buffer), clone_list_(0),
|
||||
doing_export(false), parent_buffer(0)
|
||||
{
|
||||
if (!cloned_buffer_) {
|
||||
@ -379,6 +383,7 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_,
|
||||
bibfile_status_ = cloned_buffer_->d->bibfile_status_;
|
||||
cite_labels_valid_ = cloned_buffer_->d->cite_labels_valid_;
|
||||
unnamed = cloned_buffer_->d->unnamed;
|
||||
internal_buffer = cloned_buffer_->d->internal_buffer;
|
||||
}
|
||||
|
||||
|
||||
@ -2668,7 +2673,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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,6 +379,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();
|
||||
|
||||
|
@ -472,6 +472,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);
|
||||
|
@ -1416,6 +1416,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_);
|
||||
|
Loading…
Reference in New Issue
Block a user