[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeutils/kgpg
From: Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date: 2010-12-05 11:07:29
Message-ID: 20101205110729.1C006AC8A4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1203734 by dakon:
Check the GnuPG version first before setting the default arguments. GnuPG 1.x doesn't \
know about --debug-level which will cause it to fail.
BUG:250348
M +26 -7 gpgproc.cpp
--- trunk/KDE/kdeutils/kgpg/gpgproc.cpp #1203733:1203734
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2007,2010 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
@@ -13,11 +13,14 @@
#include "gpgproc.h"
-#include <ctype.h>
+#include "kgpgsettings.h"
+#include "kgpginterface.h"
+#include <KDebug>
#include <QTextCodec>
-#include "kgpgsettings.h"
+static QString lastBinary;
+static unsigned int lastVersion;
GPGProc::GPGProc(QObject *parent, const QString &binary)
: KLineBufferedProcess(parent)
@@ -32,12 +35,28 @@
void
GPGProc::resetProcess(const QString &binary)
{
- QStringList args;
- args << QLatin1String( "--no-secmem-warning" ) << QLatin1String( "--no-tty" ) << \
QLatin1String( "--debug-level" ) << QLatin1String( "none" ); + QString executable;
if (binary.isEmpty())
- setProgram(KGpgSettings::gpgBinaryPath(), args);
+ executable = KGpgSettings::gpgBinaryPath();
else
- setProgram(binary, args);
+ executable = binary;
+
+ if (lastBinary != executable) {
+ kDebug(2100) << "checking version of GnuPG executable" << executable;
+ // must be set first as KgpgInterface uses GPGProc to parse the output
+ lastBinary = executable;
+ const QString verstr = KgpgInterface::gpgVersionString(executable);
+ lastVersion = KgpgInterface::gpgVersion(verstr);
+ kDebug(2100) << "version is" << verstr << lastVersion;
+ }
+
+ QStringList args;
+ args << QLatin1String( "--no-secmem-warning" ) << QLatin1String( "--no-tty" );
+ if (lastVersion > 0x20000)
+ args << QLatin1String( "--debug-level" ) << QLatin1String( "none" );
+
+ setProgram(executable, args);
+
setOutputChannelMode(OnlyStdoutChannel);
disconnect(SIGNAL(finished(int, QProcess::ExitStatus)));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic