Backport: hack around the fact that CBR or CBZ documents can ahve the wrong extension.

CCBUG: 174701

svn path=/branches/KDE/4.1/kdegraphics/okular/; revision=882010
remotes/origin/KDE/4.1
Pino Toscano 18 years ago
parent af576529d1
commit f213bb1d0d
  1. 7
      generators/comicbook/document.cpp

@ -12,6 +12,7 @@
#include <QtGui/QImage>
#include <klocale.h>
#include <kmimetype.h>
#include <kzip.h>
#include "unrar.h"
@ -32,10 +33,12 @@ bool Document::open( const QString &fileName )
{
close();
const KMimeType::Ptr mime = KMimeType::findByFileContent( fileName );
/**
* We have a zip archive
*/
if ( fileName.toLower().endsWith( ".cbz" ) ) {
if ( mime->is( "application/x-cbz" ) || mime->name() == "application/zip" ) {
mZip = new KZip( fileName );
if ( !mZip->open( QIODevice::ReadOnly ) ) {
@ -66,7 +69,7 @@ bool Document::open( const QString &fileName )
extractImageFiles( entries );
} else {
} if ( mime->is( "application/x-cbr" ) || mime->name() == "application/x-rar" ) {
if ( !Unrar::isAvailable() ) {
mLastErrorString = i18n( "Cannot open document, unrar was not found." );
return false;

Loading…
Cancel
Save