Fix compilation against a karchive that doesn't have lzma

Fixes one of the problems with building for Android.
Note LZMA is an optional dependency for KArchive.
remotes/origin/hidpi
Aleix Pol 7 years ago
parent 8ca6b85c24
commit 40d32ae9a4
  1. 5
      generators/comicbook/CMakeLists.txt
  2. 4
      generators/comicbook/document.cpp

@ -5,7 +5,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../..
)
########### next target ###############
set( okularGenerator_comicbook_PART_SRCS
@ -25,6 +24,10 @@ if (UNIX AND NOT ANDROID)
target_link_libraries(okularGenerator_comicbook KF5::Pty)
endif ()
if (KArchive_HAVE_LZMA)
target_compile_definitions(okularGenerator_comicbook PRIVATE -DWITH_K7ZIP=1)
endif()
########### install files ###############
install( FILES okularComicbook.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( PROGRAMS okularApplication_comicbook.desktop org.kde.mobile.okular_comicbook.desktop DESTINATION ${KDE_INSTALL_APPDIR} )

@ -18,7 +18,9 @@
#include <QMimeDatabase>
#include <kzip.h>
#include <ktar.h>
#if WITH_K7ZIP
#include <k7zip.h>
#endif
#include <memory>
@ -79,6 +81,7 @@ bool Document::open( const QString &fileName )
if ( !processArchive() ) {
return false;
}
#ifdef WITH_K7ZIP
/**
* We have a 7z archive
*/
@ -88,6 +91,7 @@ bool Document::open( const QString &fileName )
if ( !processArchive() ) {
return false;
}
#endif
} else if ( mime.inherits( QStringLiteral("application/x-cbr") ) || mime.inherits( QStringLiteral("application/x-rar") ) || mime.inherits( QStringLiteral("application/vnd.rar") ) ) {
if ( !Unrar::isAvailable() ) {
mLastErrorString = i18n( "Cannot open document, neither unrar nor unarchiver were found." );

Loading…
Cancel
Save