Web lists-archives.com

Do not enforce copy and paste restrictions in Okular




Hello,

KDE is under no legal obligation to distribute source code or software
that enforces PDF's copy&paste restriction flags. In fact, not even
Google Drive's Android PDF viewer enforces this. The Okular source
code calls this, 'DRM'. Put this way, the current situation appears
even more dubious. It's a shame to watch KDE follow this path, and I'm
perplexed to see this 'DRM' logic embedded inside free software.

The attached patch removes these needless restrictions. It works perfectly.

Thanks,
Jason
diff -ru okular-17.08.2/ui/pageview.cpp okular-17.08.2-fixed/ui/pageview.cpp
--- okular-17.08.2/ui/pageview.cpp	2017-10-08 11:45:01.000000000 +0900
+++ okular-17.08.2-fixed/ui/pageview.cpp	2017-11-12 12:54:43.904374693 +0900
@@ -2749,20 +2749,11 @@
             {
                 menu.addAction( new OKMenuTitle( &menu, i18np( "Text (1 character)", "Text (%1 characters)", selectedText.length() ) ) );
                 textToClipboard = menu.addAction( QIcon::fromTheme(QStringLiteral("edit-copy")), i18n( "Copy to Clipboard" ) );
-                bool copyAllowed = d->document->isAllowed( Okular::AllowCopy );
-                if ( !copyAllowed )
-                {
-                    textToClipboard->setEnabled( false );
-                    textToClipboard->setText( i18n("Copy forbidden by DRM") );
-                }
 #ifdef HAVE_SPEECH
                 if ( Okular::Settings::useTTS() )
                     speakText = menu.addAction( QIcon::fromTheme(QStringLiteral("text-speak")), i18n( "Speak Text" ) );
 #endif
-                if ( copyAllowed )
-                {
-                    addWebShortcutsMenu( &menu, selectedText );
-                }
+                addWebShortcutsMenu( &menu, selectedText );
             }
             menu.addAction( new OKMenuTitle( &menu, i18n( "Image (%1 by %2 pixels)", selectionRect.width(), selectionRect.height() ) ) );
             imageToClipboard = menu.addAction( QIcon::fromTheme(QStringLiteral("image-x-generic")), i18n( "Copy to Clipboard" ) );
@@ -2907,11 +2898,6 @@
                 viewport()->update( updatedRect );
             }
 
-            if ( !d->document->isAllowed( Okular::AllowCopy ) ) {
-                d->messageWindow->display( i18n("Copy forbidden by DRM"), QString(), PageViewMessage::Info, -1 );
-                break;
-            }
-
             QString selText;
             QString selHtml;
             QList<double> xs = d->tableSelectionCols;
@@ -3014,15 +3000,7 @@
                         if ( Okular::Settings::useTTS() )
                             speakText = menu.addAction( QIcon::fromTheme( QStringLiteral("text-speak") ), i18n( "Speak Text" ) );
 #endif
-                        if ( !d->document->isAllowed( Okular::AllowCopy ) )
-                        {
-                            textToClipboard->setEnabled( false );
-                            textToClipboard->setText( i18n("Copy forbidden by DRM") );
-                        }
-                        else
-                        {
-                            addWebShortcutsMenu( &menu, d->selectedText() );
-                        }
+                        addWebShortcutsMenu( &menu, d->selectedText() );
                         const QString url = UrlUtils::getUrl( d->selectedText() );
                         if ( !url.isEmpty() )
                         {