summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD24
-rwxr-xr-xdecryptpdf39
-rw-r--r--decryptpdf.desktop12
-rw-r--r--encryptpdf.desktop33
5 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..474647cbcaff
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = kde-servicemenus-pdf-encrypt-decrypt
+ pkgdesc = KDE service menus for encrypting/decrypting PDF documents from dolphin
+ pkgver = 1
+ pkgrel = 1
+ arch = any
+ license = GPL
+ depends = dolphin
+ depends = kdialog
+ depends = pdftk
+ depends = qpdf
+ source = decryptpdf.desktop
+ source = encryptpdf.desktop
+ source = decryptpdf
+ sha256sums = a0dcfc6795da6fd46e8b570b8d0104b2eba19c585c0dc85056541531ecd963d7
+ sha256sums = 694547f614248e8912a6ae1cde9ddcc1f21a233b3e92370025899b8e89b9cbc6
+ sha256sums = 6a4f364983db986fb1142e640d02586940cfb3cd589508931e1609e61a3b332d
+
+pkgname = kde-servicemenus-pdf-encrypt-decrypt
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..fa5e4e7d0ace
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,24 @@
+# Maintainer: librewish <librewish@gmail.com>
+
+pkgname=kde-servicemenus-pdf-encrypt-decrypt
+pkgver=1
+pkgrel=1
+pkgdesc="KDE service menus for encrypting/decrypting PDF documents from dolphin"
+arch=('any')
+license=('GPL')
+depends=('dolphin' 'kdialog' 'pdftk' 'qpdf')
+source=("decryptpdf.desktop"
+ "encryptpdf.desktop"
+ "decryptpdf")
+sha256sums=('a0dcfc6795da6fd46e8b570b8d0104b2eba19c585c0dc85056541531ecd963d7'
+ '694547f614248e8912a6ae1cde9ddcc1f21a233b3e92370025899b8e89b9cbc6'
+ '6a4f364983db986fb1142e640d02586940cfb3cd589508931e1609e61a3b332d')
+
+package() {
+ install -dm 755 ${pkgdir}/usr/share/kservices5/ServiceMenus/
+ install -m 644 *.desktop ${pkgdir}/usr/share/kservices5/ServiceMenus/
+
+ install -dm 755 ${pkgdir}/usr/bin/
+ install -m 755 decryptpdf ${pkgdir}/usr/bin/
+}
+
diff --git a/decryptpdf b/decryptpdf
new file mode 100755
index 000000000000..da0978ae9f34
--- /dev/null
+++ b/decryptpdf
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# AUTHOR: (c) Glutanimate 2012 (http://askubuntu.com/users/81372/), namron 2017
+# NAME: PDFdecrypt 0.4
+# DESCRIPTION: A script to batch decrypt PDF files.
+# DEPENDENCIES: qpdf kdialog libnotify-bin
+# (install via sudo apt-get install qpdf libnotify-bin)
+# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
+# CHANGELOG: 0.3 - added notifications and basic error checking
+# 0.2 - replaced obsolete gdialog with zenity
+# 0.4 - replaced zenity with kdialog
+
+password=`kdialog --password "PDF Password required"`
+
+RET=$?
+
+if [[ $RET = 0 ]]; then
+
+ while [ $# -gt 0 ]; do
+ ENCRYP=$1
+ DECRYP=$(echo "$ENCRYP" | sed 's/\.\w*$/_decrypted.pdf/')
+ qpdf --password=$password --decrypt "$ENCRYP" "$DECRYP"
+ RET=$?
+ if [[ $RET != 0 ]]; then
+ ERR=1
+ fi
+ shift
+ done
+
+ if [[ $ERR = 1 ]]
+ then
+ notify-send -i application-pdf "PDFdecrypt" "All documents processed.There were some errors"
+ else
+ notify-send -i application-pdf "PDFdecrypt" "All documents decrypted."
+ fi
+
+else
+ exit
+fi
diff --git a/decryptpdf.desktop b/decryptpdf.desktop
new file mode 100644
index 000000000000..4181f35573b6
--- /dev/null
+++ b/decryptpdf.desktop
@@ -0,0 +1,12 @@
+#dir: ~/.local/share/kservices5/ServiceMenus/
+[Desktop Entry]
+Type=Service
+ServiceTypes=KonqPopupMenu/Plugin
+MimeType=application/pdf
+Actions=decryptPdf
+
+[Desktop Action decryptPdf]
+
+Name=Decrypt Password-Protected PDF-File
+Icon=application-pdf
+Exec=/usr/bin/pdfdecrypt %U;
diff --git a/encryptpdf.desktop b/encryptpdf.desktop
new file mode 100644
index 000000000000..c79234dbc728
--- /dev/null
+++ b/encryptpdf.desktop
@@ -0,0 +1,33 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KonqPopupMenu/Plugin
+MimeType=application/pdf;
+Actions=encryptPdf
+
+[Desktop Action encryptPdf]
+Name=Encrypt PDF-File to make it Password-Protected
+Icon=application-pdf
+Exec=/bin/bash -c 'Confirmation="1"; InputFile="$0"; TmpFile="/tmp/ServiceMenu_addPDFPasswd.pdf"; Program="pdftk"; if command -v $Program > /dev/null 2>&1 ; then Passwd=`kdialog --password "Set password for the PDF:"`; $Program "$InputFile" output "$TmpFile" user_pw "$Passwd"; mv "$InputFile" "$InputFile.org"; mv "$TmpFile" "$InputFile"; if [ "$Confirmation" -eq 1 ] ; then kdialog --msgbox "Password added to selected File\nOriginal was was renamed to .org"; fi else kdialog --error "$Program could not be found. Please install $Program"; fi' %u
+
+
+
+########################################### The actual script shown nicely #######################################
+#
+#
+#Confirmation="1";
+#InputFile="$0";
+#TmpFile="/tmp/ServiceMenu_addPDFPasswd.pdf";
+#Program="pdftk";
+#if command -v $Program > /dev/null 2>&1 ;
+#then
+# Passwd=`kdialog --password "Set password for the PDF:"`;
+# $Program "$InputFile" output "$TmpFile" user_pw "$Passwd";
+# mv "$InputFile" "$InputFile.org";
+# mv "$TmpFile" "$InputFile";
+# if [ "$Confirmation" -eq 1 ] ;
+# then
+# kdialog --msgbox "Password added to selected File\nOriginal was was renamed to .org";
+# fi
+#else
+# kdialog --error "$Program could not be found. Please install $Program";
+#fi' %u