mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Move saveCheckSum() call to Buffer::readFile(). Also, remove the
argument from that function. We are always saving the checksum for the Buffer's file. The argument is a left-over from a time when we did the wrong thing and saved it for e.g. the emergency file. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35890 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2101b37a0f
commit
e313d3a12b
@ -889,6 +889,7 @@ Buffer::ReadStatus Buffer::readFile(FileName const & fn)
|
||||
lyxvc().file_found_hook(fn);
|
||||
d->read_only = !fname.isWritable();
|
||||
params().compressed = fname.isZippedFile();
|
||||
saveCheckSum();
|
||||
return ReadSuccess;
|
||||
}
|
||||
|
||||
@ -1071,7 +1072,7 @@ bool Buffer::writeFile(FileName const & fname) const
|
||||
// see bug 6587
|
||||
// removeAutosaveFile();
|
||||
|
||||
saveCheckSum(d->filename);
|
||||
saveCheckSum();
|
||||
message(str + _(" done."));
|
||||
|
||||
return true;
|
||||
@ -2369,8 +2370,9 @@ bool Buffer::isExternallyModified(CheckMethod method) const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::saveCheckSum(FileName const & file) const
|
||||
void Buffer::saveCheckSum() const
|
||||
{
|
||||
FileName const & file = d->filename;
|
||||
if (file.exists()) {
|
||||
d->timestamp_ = file.lastModified();
|
||||
d->checksum_ = file.checksum();
|
||||
@ -3635,7 +3637,6 @@ Buffer::ReadStatus Buffer::loadEmergency(FileName const & fn)
|
||||
ReadStatus const ret_llf = loadThisLyXFile(emergencyFile);
|
||||
bool const success = (ret_llf == ReadSuccess);
|
||||
if (success) {
|
||||
saveCheckSum(fn);
|
||||
markDirty();
|
||||
str = _("Document was successfully recovered.");
|
||||
} else
|
||||
@ -3692,7 +3693,6 @@ Buffer::ReadStatus Buffer::loadAutosave(FileName const & fn)
|
||||
// the file is not saved if we load the autosave file.
|
||||
if (ret_llf == ReadSuccess) {
|
||||
markDirty();
|
||||
saveCheckSum(fn);
|
||||
return ReadSuccess;
|
||||
}
|
||||
return ReadAutosaveFailure;
|
||||
@ -4111,7 +4111,7 @@ bool Buffer::reload()
|
||||
changed(true);
|
||||
updateTitles();
|
||||
markClean();
|
||||
saveCheckSum(d->filename);
|
||||
saveCheckSum();
|
||||
message(bformat(_("Document %1$s reloaded."), disp_fn));
|
||||
} else {
|
||||
message(bformat(_("Could not reload document %1$s."), disp_fn));
|
||||
|
@ -329,7 +329,7 @@ public:
|
||||
bool isExternallyModified(CheckMethod method) const;
|
||||
|
||||
/// save timestamp and checksum of the given file.
|
||||
void saveCheckSum(support::FileName const & file) const;
|
||||
void saveCheckSum() const;
|
||||
|
||||
/// mark the main lyx file as not needing saving
|
||||
void markClean() const;
|
||||
|
@ -2246,7 +2246,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
|
||||
b.markDirty();
|
||||
bool unnamed = b.isUnnamed();
|
||||
b.setUnnamed(false);
|
||||
b.saveCheckSum(fname);
|
||||
b.saveCheckSum();
|
||||
|
||||
// bring the autosave file with us, just in case.
|
||||
b.moveAutosaveFile(oldauto);
|
||||
@ -2255,7 +2255,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
|
||||
oldauto = b.getAutosaveFileName();
|
||||
b.setFileName(oldname.absFileName());
|
||||
b.setUnnamed(unnamed);
|
||||
b.saveCheckSum(oldname);
|
||||
b.saveCheckSum();
|
||||
b.moveAutosaveFile(oldauto);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user