Commit 4c9badef authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Rolf Eike Beer

fix GnuPG error messages missing if key generation fails

If GnuPG reports the error to the control fd it was not shown to the user.
parent 799ea98a
......@@ -189,7 +189,8 @@ KGpgGenerateKey::nextLine(const QString &line)
result = true;
} else if (line.contains(QLatin1String("KEY_NOT_CREATED"))) {
result = true;
}
} else
m_errorOutput << line;
emit statusMessage(msg);
......@@ -216,18 +217,13 @@ KGpgGenerateKey::finish()
emit statusMessage(i18n("Key %1 generated", getFingerprint()));
break;
default:
{
QStringList errorLines;
while (getProcess()->hasLineStandardError()) {
QByteArray b;
getProcess()->readLineStandardError(&b);
errorLines << QString::fromUtf8(b);
}
m_errorOutput = errorLines.join(QLatin1String("\n"));
emit statusMessage(i18n("gpg process did not finish. Cannot generate a new key pair."));
while (getProcess()->hasLineStandardError()) {
QByteArray b;
getProcess()->readLineStandardError(&b);
m_errorOutput << QString::fromUtf8(b);
}
emit statusMessage(i18n("gpg process did not finish. Cannot generate a new key pair."));
}
}
......@@ -259,5 +255,5 @@ KGpgGenerateKey::getFingerprint() const
QString
KGpgGenerateKey::gpgErrorMessage() const
{
return m_errorOutput;
return m_errorOutput.join(QLatin1Char('\n'));
}
/*
* Copyright (C) 2008,2009,2012,2013 Rolf Eike Beer <kde@opensource.sf-tec.de>
* Copyright (C) 2008,2009,2012,2013,2016 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
......@@ -20,6 +20,7 @@
#include <QObject>
#include <QString>
#include <QStringList>
/**
* @brief generate a new key pair
......@@ -84,7 +85,7 @@ private:
const unsigned int m_expire;
const unsigned int m_expireunit;
QString m_fingerprint;
QString m_errorOutput;
QStringList m_errorOutput;
};
#endif // KGPGGENERATEKEY_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment