Blame SOURCES/kdelibs-4.7.0-knewstuff2_gpg2.patch

e4fba6
diff -up kdelibs-4.7.0/knewstuff/knewstuff2/core/security.cpp.knewstuff2_gpg2 kdelibs-4.7.0/knewstuff/knewstuff2/core/security.cpp
e4fba6
--- kdelibs-4.7.0/knewstuff/knewstuff2/core/security.cpp.knewstuff2_gpg2	2011-05-20 15:24:54.000000000 -0500
e4fba6
+++ kdelibs-4.7.0/knewstuff/knewstuff2/core/security.cpp	2011-09-06 11:29:18.939251150 -0500
e4fba6
@@ -36,9 +36,20 @@
e4fba6
 #include <kmessagebox.h>
e4fba6
 #include <kpassworddialog.h>
e4fba6
 #include <kprocess.h>
e4fba6
+#include <kstandarddirs.h>
e4fba6
 
e4fba6
 using namespace KNS;
e4fba6
 
e4fba6
+static QString gpgExecutable()
e4fba6
+{
e4fba6
+  QString gpgExe = KStandardDirs::findExe( "gpg" );
e4fba6
+  if ( gpgExe.isEmpty() )
e4fba6
+    gpgExe = KStandardDirs::findExe( "gpg2" );
e4fba6
+  if ( gpgExe.isEmpty() )
e4fba6
+    return QLatin1String( "gpg" );
e4fba6
+  return gpgExe;
e4fba6
+}
e4fba6
+
e4fba6
 Security::Security()
e4fba6
 {
e4fba6
     m_keysRead = false;
e4fba6
@@ -61,7 +72,7 @@ void Security::readKeys()
e4fba6
     m_runMode = List;
e4fba6
     m_keys.clear();
e4fba6
     m_process = new KProcess();
e4fba6
-    *m_process << "gpg"
e4fba6
+    *m_process << gpgExecutable() 
e4fba6
     << "--no-secmem-warning"
e4fba6
     << "--no-tty"
e4fba6
     << "--with-colon"
e4fba6
@@ -87,7 +98,7 @@ void Security::readSecretKeys()
e4fba6
     }
e4fba6
     m_runMode = ListSecret;
e4fba6
     m_process = new KProcess();
e4fba6
-    *m_process << "gpg"
e4fba6
+    *m_process << gpgExecutable() 
e4fba6
     << "--no-secmem-warning"
e4fba6
     << "--no-tty"
e4fba6
     << "--with-colon"
e4fba6
@@ -260,7 +271,7 @@ void Security::slotCheckValidity()
e4fba6
 
e4fba6
     //verify the signature
e4fba6
     m_process = new KProcess();
e4fba6
-    *m_process << "gpg"
e4fba6
+    *m_process << gpgExecutable() 
e4fba6
     << "--no-secmem-warning"
e4fba6
     << "--status-fd=2"
e4fba6
     << "--command-fd=0"
e4fba6
@@ -342,7 +353,7 @@ void Security::slotSignFile()
e4fba6
 
e4fba6
     //verify the signature
e4fba6
     m_process = new KProcess();
e4fba6
-    *m_process << "gpg"
e4fba6
+    *m_process << gpgExecutable() 
e4fba6
     << "--no-secmem-warning"
e4fba6
     << "--status-fd=2"
e4fba6
     << "--command-fd=0"