summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2012-03-11 10:08:22 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2012-03-13 22:58:00 (GMT)
commit954c7c3e8a1b8313bae8d717c557df8b7eafba12 (patch)
tree60a687426df34ed1857e9976c73fcf37d1dde7f0
parent7eb5ed3e439edf06fe4da36a12bb435a7e38905e (diff)
improve selection of GnuPG binary
Search for the full path of the binary, this will avoid scanning through the path on every invocation. Also prefer the "gpg2" binary over the "gpg" one as it has the more modern interface. (cherry picked from commit 7d58ee47f10f6457b3ca4a1f3ec4c1cebacec0e2)
-rw-r--r--kgpgfirstassistant.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/kgpgfirstassistant.cpp b/kgpgfirstassistant.cpp
index 41c15e9..c2122ce 100644
--- a/kgpgfirstassistant.cpp
+++ b/kgpgfirstassistant.cpp
@@ -19,6 +19,15 @@
#include "kgpgfirstassistant.h"
+#include "gpgproc.h"
+#include "kgpginterface.h"
+#include "core/kgpgkey.h"
+
+#include <KComboBox>
+#include <KLocale>
+#include <KMessageBox>
+#include <KStandardDirs>
+#include <KUrlRequester>
#include <QCheckBox>
#include <QGridLayout>
#include <QHBoxLayout>
@@ -27,14 +36,6 @@
#include <QTextStream>
#include <QWidget>
-#include <KComboBox>
-#include <KLocale>
-#include <KMessageBox>
-#include <KUrlRequester>
-
-#include "kgpginterface.h"
-#include "kgpgkey.h"
-
using namespace KgpgCore;
KGpgFirstAssistant::KGpgFirstAssistant(QWidget *parent)
@@ -107,10 +108,15 @@ KGpgFirstAssistant::KGpgFirstAssistant(QWidget *parent)
binURL = new KUrlRequester(page);
binURL->setFilter(i18nc("search filter for gpg binary", "gpg|GnuPG binary\n*|All files"));
- binURL->setUrl(KUrl("gpg"));
+ QString gpgBin = KStandardDirs::findExe(QLatin1String("gpg2"));
+ if (gpgBin.isEmpty())
+ gpgBin = KStandardDirs::findExe(QLatin1String("gpg"));
+ if (gpgBin.isEmpty())
+ gpgBin = QLatin1String("gpg");
+ binURL->setUrl(KUrl::fromPath(gpgBin));
connect(binURL, SIGNAL(textChanged(QString)), SLOT(slotBinaryChanged(QString)));
- slotBinaryChanged(QLatin1String( "gpg" ));
+ slotBinaryChanged(gpgBin);
gridLayout->addWidget(binURL, 2, 1, 1, 1);