mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Buffer::setFileName() can now be private. The only way to change the filename of a buffer is to save it as a different file using Buffer::saveAs().
Change its parameter type to support::FileName for convenience. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36375 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4e394eb9c5
commit
1f38406536
@ -189,7 +189,7 @@ public:
|
||||
/// is autosave needed?
|
||||
mutable bool bak_clean;
|
||||
|
||||
/// is this a unnamed file (New...)?
|
||||
/// is this an unnamed file (New...)?
|
||||
bool unnamed;
|
||||
|
||||
/// buffer is r/o
|
||||
@ -642,9 +642,9 @@ void Buffer::setReadonly(bool const flag)
|
||||
}
|
||||
|
||||
|
||||
void Buffer::setFileName(string const & newfile)
|
||||
void Buffer::setFileName(FileName const & fname)
|
||||
{
|
||||
d->filename = makeAbsPath(newfile);
|
||||
d->filename = fname;
|
||||
setReadonly(d->filename.isReadOnly());
|
||||
updateTitles();
|
||||
}
|
||||
@ -4145,7 +4145,7 @@ bool Buffer::saveAs(FileName const & fn)
|
||||
FileName const old_auto = getAutosaveFileName();
|
||||
bool const old_unnamed = isUnnamed();
|
||||
|
||||
setFileName(fn.absFileName());
|
||||
setFileName(fn);
|
||||
markDirty();
|
||||
setUnnamed(false);
|
||||
|
||||
@ -4164,7 +4164,7 @@ bool Buffer::saveAs(FileName const & fn)
|
||||
} else {
|
||||
// save failed
|
||||
// reset the old filename and unnamed state
|
||||
setFileName(old_name.absFileName());
|
||||
setFileName(old_name);
|
||||
setUnnamed(old_unnamed);
|
||||
saveCheckSum();
|
||||
return false;
|
||||
|
@ -365,9 +365,6 @@ public:
|
||||
/// Get the name and type of the log.
|
||||
std::string logName(LogType * type = 0) const;
|
||||
|
||||
/// Change name of buffer. Updates "read-only" flag.
|
||||
void setFileName(std::string const & newfile);
|
||||
|
||||
/// Set document's parent Buffer.
|
||||
void setParent(Buffer const *);
|
||||
Buffer const * parent() const;
|
||||
@ -657,6 +654,8 @@ public:
|
||||
void checkChildBuffers();
|
||||
|
||||
private:
|
||||
/// Change name of buffer. Updates "read-only" flag.
|
||||
void setFileName(support::FileName const & fname);
|
||||
///
|
||||
std::vector<std::string> backends() const;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user