Commit 085bdae8 authored by Pino Toscano's avatar Pino Toscano

specify better file names for TIFFClientOpen

svn path=/trunk/KDE/kdegraphics/okular/; revision=855852
parent 3709ecd7
......@@ -9,6 +9,7 @@
#include "generator_tiff.h"
#include <qabstractfileengine.h>
#include <qbuffer.h>
#include <qdatetime.h>
#include <qfile.h>
......@@ -202,7 +203,17 @@ bool TIFFGenerator::loadDocument( const QString & fileName, QVector<Okular::Page
QFile* qfile = new QFile( fileName );
qfile->open( QIODevice::ReadOnly );
d->dev = qfile;
d->tiff = TIFFClientOpen( "okular.tiff", "r", d->dev,
QAbstractFileEngine *fileEngine = QAbstractFileEngine::create( fileName );
if ( fileEngine )
{
d->data = QFile::encodeName( fileEngine->fileName( QAbstractFileEngine::BaseName ) );
delete fileEngine;
}
else
{
d->data = QByteArray( "okular.tiff" );
}
d->tiff = TIFFClientOpen( d->data.constData(), "r", d->dev,
okular_tiffReadProc, okular_tiffWriteProc, okular_tiffSeekProc,
okular_tiffCloseProc, okular_tiffSizeProc,
okular_tiffMapProc, okular_tiffUnmapProc );
......@@ -210,6 +221,7 @@ bool TIFFGenerator::loadDocument( const QString & fileName, QVector<Okular::Page
{
delete d->dev;
d->dev = 0;
d->data.clear();
return false;
}
......@@ -224,7 +236,7 @@ bool TIFFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector<
QBuffer* qbuffer = new QBuffer( &d->data );
qbuffer->open( QIODevice::ReadOnly );
d->dev = qbuffer;
d->tiff = TIFFClientOpen( "okular.tiff", "r", d->dev,
d->tiff = TIFFClientOpen( "<stdin>", "r", d->dev,
okular_tiffReadProc, okular_tiffWriteProc, okular_tiffSeekProc,
okular_tiffCloseProc, okular_tiffSizeProc,
okular_tiffMapProc, okular_tiffUnmapProc );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment