diff --git a/CMakeLists.txt b/CMakeLists.txt index c81defa03..d516e403a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,21 @@ project(oKular) +OPTION( + OKULAR_FORCE_DRM + "Forces oKular to check for DRM to decide if you can copy/print protected pdf. (default=no)" + OFF +) +if(OKULAR_FORCE_DRM STREQUAL "ON") + set(_OKULAR_FORCE_DRM 1) +else(OKULAR_FORCE_DRM STREQUAL "ON") + set(_OKULAR_FORCE_DRM 0) +endif(OKULAR_FORCE_DRM STREQUAL "ON") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config-okular.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config-okular.h +) + add_subdirectory( conf ) add_subdirectory( core ) add_subdirectory( ui ) diff --git a/conf/dlggeneral.cpp b/conf/dlggeneral.cpp index 214d07ebe..1ecdc9f3f 100644 --- a/conf/dlggeneral.cpp +++ b/conf/dlggeneral.cpp @@ -10,6 +10,7 @@ #include #include +#include #include "ui_dlggeneralbase.h" @@ -24,7 +25,7 @@ DlgGeneral::DlgGeneral( QWidget * parent ) void DlgGeneral::showEvent( QShowEvent * ) { -#if KPDF_FORCE_DRM +#if OKULAR_FORCE_DRM m_dlg->kcfg_ObeyDRM->hide(); #else if ( KAuthorized::authorize( "skip_drm" ) ) diff --git a/config-okular.h.cmake b/config-okular.h.cmake new file mode 100644 index 000000000..6b6a7adc1 --- /dev/null +++ b/config-okular.h.cmake @@ -0,0 +1,3 @@ +/* Defines if force the use DRM in oKular */ +#define OKULAR_FORCE_DRM ${_OKULAR_FORCE_DRM} + diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index 74d78120f..1e60d2b86 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -29,6 +29,7 @@ #include "settings.h" #include +#include // id for DATA_READY PDFPixmapGeneratorThread Event #define TGE_DATAREADY_ID 6969 @@ -491,7 +492,7 @@ const DocumentFonts * PDFGenerator::generateDocumentFonts() bool PDFGenerator::isAllowed( int permissions ) { -#if !KPDF_FORCE_DRM +#if !OKULAR_FORCE_DRM if (KAuthorized::authorize("skip_drm") && !KpdfSettings::obeyDRM()) return true; #endif