From c736659a9088ea471f899955b60383d67248c2bd Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 7 Dec 2009 21:37:48 +0000 Subject: [PATCH] branch: Fix bug #6356: Reloading image does not work for compiling. - Add a FileName::refresh function and replace one call to lastModified which was just meant to refresh the file info. - Refresh the file info, otherwise InsetGraphics::latex might still think that the file does not exist. see r32354 and r32355. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@32415 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/graphics/GraphicsCacheItem.cpp | 3 +-- src/insets/InsetGraphics.cpp | 1 + src/support/FileName.cpp | 6 ++++++ src/support/FileName.h | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 3c91520d26..5c48ea7869 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -349,8 +349,7 @@ static string const findTargetFormat(string const & from) bool CacheItem::Impl::tryDisplayFormat(FileName & filename, string & from) { // First, check that the file exists! - // force a refresh. - filename_.lastModified(); + filename_.refresh(); if (!filename_.isReadableFile()) { if (status_ != ErrorNoFile) { status_ = ErrorNoFile; diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index b6eceb44fd..769d17f841 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -223,6 +223,7 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) break; case LFUN_GRAPHICS_RELOAD: + params_.filename.refresh(); graphic_->reload(); break; diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index ec8c671173..8a3edbdd28 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -474,6 +474,12 @@ FileName FileName::tempPath() } +void FileName::refresh() const +{ + d->refresh(); +} + + time_t FileName::lastModified() const { // QFileInfo caches information about the file. So, in case this file has diff --git a/src/support/FileName.h b/src/support/FileName.h index ebd703bb6a..ee53546c61 100644 --- a/src/support/FileName.h +++ b/src/support/FileName.h @@ -78,6 +78,8 @@ public: /// returns true if the file exists bool exists() const; + /// refreshes the file info + void refresh() const; /// \return true if this object points to a symbolic link. bool isSymLink() const; /// \return true if the file is empty.