]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCacheItem.C
Quote graphics conversion commands correctly.
[lyx.git] / src / graphics / GraphicsCacheItem.C
index 5071e0d5e0ed6a0259678f75a292d929cb4553a6..0133bd6a06ffa73d532d1eb747cf86fa226ee440 100644 (file)
@@ -17,6 +17,7 @@
 #include "GraphicsImage.h"
 
 #include "debug.h"
+#include "format.h"
 
 #include "support/filetools.h"
 #include "support/FileMonitor.h"
@@ -32,7 +33,6 @@ using support::FileMonitor;
 using support::IsFileReadable;
 using support::MakeDisplayPath;
 using support::OnlyFilename;
-using support::getFormatFromContents;
 using support::tempName;
 using support::unlink;
 using support::unzipFile;
@@ -46,7 +46,8 @@ using std::string;
 namespace lyx {
 namespace graphics {
 
-struct CacheItem::Impl : public boost::signals::trackable {
+class CacheItem::Impl : public boost::signals::trackable {
+public:
 
        ///
        Impl(string const & file);
@@ -401,7 +402,13 @@ void CacheItem::Impl::convertToDisplayFormat()
                << "\n\twith displayed filename: " << displayed_filename
                << endl;
 
-       string from = getFormatFromContents(filename);
+       string const from = formats.getFormatFromFile(filename);
+       if (from.empty()) {
+               setStatus(ErrorConverting);
+               lyxerr[Debug::GRAPHICS]
+                       << "\tCould not determine file format." << endl;
+               return;
+       }
        lyxerr[Debug::GRAPHICS]
                << "\n\tThe file contains " << from << " format data." << endl;
        string const to = findTargetFormat(from);