Blob Blame History Raw
diff -up kdeutils-4.7.1/kgpg/kgpgoptions.cpp.gpg2 kdeutils-4.7.1/kgpg/kgpgoptions.cpp
--- kdeutils-4.7.1/kgpg/kgpgoptions.cpp.gpg2	2011-09-01 16:22:36.000000000 -0500
+++ kdeutils-4.7.1/kgpg/kgpgoptions.cpp	2011-09-28 13:50:06.679879225 -0500
@@ -32,6 +32,7 @@
 #include <KProcess>
 #include <kdefakes.h>
 #include <KFontChooser>
+#include <kstandarddirs.h>
 
 #include "images.h"
 #include "kgpgsettings.h"
@@ -136,6 +137,16 @@ kgpgOptions::~kgpgOptions()
 	delete m_page7;
 }
 
+static QString gpgExecutable()
+{
+  QString gpgExe = KStandardDirs::findExe( "gpg" );
+  if ( gpgExe.isEmpty() )
+    gpgExe = KStandardDirs::findExe( "gpg2" );
+  if ( gpgExe.isEmpty() )
+    return QLatin1String( "gpg" );
+  return gpgExe;
+}
+
 void kgpgOptions::slotChangeHome()
 {
 	QString gpgHome = KFileDialog::getExistingDirectory(m_page4->gpg_home_path->text(), this, i18n("New GnuPG Home Location"));
@@ -158,7 +169,7 @@ void kgpgOptions::slotChangeHome()
 				// start GnuPG so that it will create a config file
 				QString gpgbin = m_page4->kcfg_GpgBinaryPath->text();
 				if (!QFile::exists(gpgbin))
-					gpgbin = QLatin1String( "gpg" );
+					gpgbin = gpgExecutable(); 
 
 				KProcess p;
 				p << gpgbin << QLatin1String( "--homedir" ) << gpgHome << QLatin1String( "--no-tty" ) << QLatin1String( "--list-secret-keys" );