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);
|
lyxvc().file_found_hook(fn);
|
||||||
d->read_only = !fname.isWritable();
|
d->read_only = !fname.isWritable();
|
||||||
params().compressed = fname.isZippedFile();
|
params().compressed = fname.isZippedFile();
|
||||||
|
saveCheckSum();
|
||||||
return ReadSuccess;
|
return ReadSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1071,7 +1072,7 @@ bool Buffer::writeFile(FileName const & fname) const
|
|||||||
// see bug 6587
|
// see bug 6587
|
||||||
// removeAutosaveFile();
|
// removeAutosaveFile();
|
||||||
|
|
||||||
saveCheckSum(d->filename);
|
saveCheckSum();
|
||||||
message(str + _(" done."));
|
message(str + _(" done."));
|
||||||
|
|
||||||
return true;
|
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()) {
|
if (file.exists()) {
|
||||||
d->timestamp_ = file.lastModified();
|
d->timestamp_ = file.lastModified();
|
||||||
d->checksum_ = file.checksum();
|
d->checksum_ = file.checksum();
|
||||||
@ -3635,7 +3637,6 @@ Buffer::ReadStatus Buffer::loadEmergency(FileName const & fn)
|
|||||||
ReadStatus const ret_llf = loadThisLyXFile(emergencyFile);
|
ReadStatus const ret_llf = loadThisLyXFile(emergencyFile);
|
||||||
bool const success = (ret_llf == ReadSuccess);
|
bool const success = (ret_llf == ReadSuccess);
|
||||||
if (success) {
|
if (success) {
|
||||||
saveCheckSum(fn);
|
|
||||||
markDirty();
|
markDirty();
|
||||||
str = _("Document was successfully recovered.");
|
str = _("Document was successfully recovered.");
|
||||||
} else
|
} else
|
||||||
@ -3692,7 +3693,6 @@ Buffer::ReadStatus Buffer::loadAutosave(FileName const & fn)
|
|||||||
// the file is not saved if we load the autosave file.
|
// the file is not saved if we load the autosave file.
|
||||||
if (ret_llf == ReadSuccess) {
|
if (ret_llf == ReadSuccess) {
|
||||||
markDirty();
|
markDirty();
|
||||||
saveCheckSum(fn);
|
|
||||||
return ReadSuccess;
|
return ReadSuccess;
|
||||||
}
|
}
|
||||||
return ReadAutosaveFailure;
|
return ReadAutosaveFailure;
|
||||||
@ -4111,7 +4111,7 @@ bool Buffer::reload()
|
|||||||
changed(true);
|
changed(true);
|
||||||
updateTitles();
|
updateTitles();
|
||||||
markClean();
|
markClean();
|
||||||
saveCheckSum(d->filename);
|
saveCheckSum();
|
||||||
message(bformat(_("Document %1$s reloaded."), disp_fn));
|
message(bformat(_("Document %1$s reloaded."), disp_fn));
|
||||||
} else {
|
} else {
|
||||||
message(bformat(_("Could not reload document %1$s."), disp_fn));
|
message(bformat(_("Could not reload document %1$s."), disp_fn));
|
||||||
|
@ -329,7 +329,7 @@ public:
|
|||||||
bool isExternallyModified(CheckMethod method) const;
|
bool isExternallyModified(CheckMethod method) const;
|
||||||
|
|
||||||
/// save timestamp and checksum of the given file.
|
/// 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
|
/// mark the main lyx file as not needing saving
|
||||||
void markClean() const;
|
void markClean() const;
|
||||||
|
@ -2246,7 +2246,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
|
|||||||
b.markDirty();
|
b.markDirty();
|
||||||
bool unnamed = b.isUnnamed();
|
bool unnamed = b.isUnnamed();
|
||||||
b.setUnnamed(false);
|
b.setUnnamed(false);
|
||||||
b.saveCheckSum(fname);
|
b.saveCheckSum();
|
||||||
|
|
||||||
// bring the autosave file with us, just in case.
|
// bring the autosave file with us, just in case.
|
||||||
b.moveAutosaveFile(oldauto);
|
b.moveAutosaveFile(oldauto);
|
||||||
@ -2255,7 +2255,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
|
|||||||
oldauto = b.getAutosaveFileName();
|
oldauto = b.getAutosaveFileName();
|
||||||
b.setFileName(oldname.absFileName());
|
b.setFileName(oldname.absFileName());
|
||||||
b.setUnnamed(unnamed);
|
b.setUnnamed(unnamed);
|
||||||
b.saveCheckSum(oldname);
|
b.saveCheckSum();
|
||||||
b.moveAutosaveFile(oldauto);
|
b.moveAutosaveFile(oldauto);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user