[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdegraphics/kpdf/core
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-02-19 12:23:15
Message-ID: 20050219122315.2E8CB1D537 () office ! kde ! org
[Download RAW message or body]

CVS commit by aacid: 

Implement isAllowed for the pdf generator, Enrico is implementing the use of it in \
pageview etc. IMHO this is not a feaute but a bug-fix as if this is not implemented \
we let the user copy text and print from PDF that are protected against and wether we \
may like it or not is what the spec says and we could get in problems if someone \
copies text from a protected PDF using our tool.


  M +1 -1      generator.h   1.4
  M +10 -0     generator_pdf/generator_pdf.cpp   1.21
  M +3 -0      generator_pdf/generator_pdf.h   1.10


--- kdegraphics/kpdf/core/generator.h  #1.3:1.4
@@ -53,5 +53,5 @@ class Generator : public QObject
         // DRM handling
         enum Permissions { Modify = 1, Copy = 2, Print = 4, AddNotes = 8 };
-        virtual bool isAllowed( int /*permisisons*/ ) { return true; }
+        virtual bool isAllowed( int /*permissions*/ ) { return true; }
 
         // page contents generation

--- kdegraphics/kpdf/core/generator_pdf/generator_pdf.cpp  #1.20:1.21
@@ -210,4 +210,14 @@ const DocumentSynopsis * PDFGenerator::g
 }
 
+bool PDFGenerator::isAllowed( int permissions )
+{
+    bool b = true;
+    if (permissions & Modify) b = b && pdfdoc->okToChange();
+    if (permissions & Copy) b = b && pdfdoc->okToCopy();
+    if (permissions & Print) b = b && pdfdoc->okToPrint();
+    if (permissions & AddNotes) b = b && pdfdoc->okToAddNotes();
+    return b;
+}
+
 bool PDFGenerator::canGeneratePixmap()
 {

--- kdegraphics/kpdf/core/generator_pdf/generator_pdf.h  #1.9:1.10
@@ -55,4 +55,7 @@ class PDFGenerator : public Generator
         const DocumentSynopsis * generateDocumentSynopsis();
 
+        // [INHERITED] document informations
+        bool isAllowed( int permissions );
+
         // [INHERITED] perform actions on document / pages
         bool canGeneratePixmap();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic