move the DRM skip checks to the Document

svn path=/trunk/playground/graphics/okular/; revision=628208
This commit is contained in:
Pino Toscano 2007-01-29 14:28:58 +00:00
parent baf1fb2870
commit 23d666cf7f
2 changed files with 8 additions and 5 deletions

View file

@ -19,6 +19,7 @@
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <kauthorized.h>
#include <kconfigdialog.h>
#include <kdebug.h>
#include <klibloader.h>
@ -45,6 +46,8 @@
#include "settings.h"
#include "sourcereference.h"
#include <config-okular.h>
using namespace Okular;
struct AllocatedPixmap
@ -1118,6 +1121,11 @@ KUrl Document::currentDocument() const
bool Document::isAllowed( Permissions flags ) const
{
#if !OKULAR_FORCE_DRM
if ( KAuthorized::authorize( "skip_drm" ) && !Okular::Settings::obeyDRM() )
return true;
#endif
return d->m_generator ? d->m_generator->isAllowed( flags ) : false;
}

View file

@ -13,7 +13,6 @@
#include <qimage.h>
#include <qregexp.h>
#include <qtextstream.h>
#include <kauthorized.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kpassworddialog.h>
@ -585,10 +584,6 @@ const QList<Okular::EmbeddedFile*> *PDFGenerator::embeddedFiles() const
bool PDFGenerator::isAllowed( Okular::Permissions permissions ) const
{
#if !OKULAR_FORCE_DRM
if (KAuthorized::authorize("skip_drm") && !Okular::Settings::obeyDRM()) return true;
#endif
bool b = true;
if (permissions & Okular::AllowModify) b = b && pdfdoc->okToChange();
if (permissions & Okular::AllowCopy) b = b && pdfdoc->okToCopy();