From: Richard Heck Date: Thu, 28 Oct 2010 22:12:29 +0000 (+0000) Subject: Move saveCheckSum() call to Buffer::readFile(). Also, remove the X-Git-Tag: 2.0.0~2203 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e313d3a12bfb3abfcc7595a4f099e21b22fb0f97;p=features.git 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 --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 017a11cf73..f03df4df21 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -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)); diff --git a/src/Buffer.h b/src/Buffer.h index ec20f33f2d..39c386ca42 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -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; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index c02c529ddd..3d88ca36e3 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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; }