diff --git a/src/gpgcardgui/gpgcard.cpp b/src/gpgcardgui/gpgcard.cpp index 8809e6a..8c023a7 100644 --- a/src/gpgcardgui/gpgcard.cpp +++ b/src/gpgcardgui/gpgcard.cpp @@ -1,85 +1,85 @@ /* Copyright (C) 2020 by g10 Code GmbH * * This file is Free Software under the GNU GPL (v>=2) * and comes with ABSOLUTELY NO WARRANTY! * See LICENSE.txt for details. */ #include "gpgcard.h" #include #include #include #include #include GpgCard::GpgCard(QObject *parent): QObject(parent), mValid(false) { const QFileInfo gpgInfo(Kleo::gpgPath()); QStringList paths; paths << gpgInfo.absoluteDir().absolutePath(); QString gpgCardPath = QStandardPaths::findExecutable(QStringLiteral("gpg-card"), paths); if (gpgCardPath.isEmpty()) { qDebug() << "Failed to find gpg-card in: " << paths; } gpgCardPath = QStandardPaths::findExecutable(QStringLiteral("gpg-card")); if (gpgCardPath.isEmpty()) { qDebug() << "Failed to find gpg-card in system paths"; } else { qDebug() << "Using: " << gpgCardPath; } if (QFileInfo(gpgCardPath).isExecutable()) { mValid = true; } connect(&mProc, QOverload::of(&QProcess::finished), [=] (int exitCode, QProcess::ExitStatus exitStatus) { /* Guranteed to be utf-8 by using --with-colons */ mStdout = QString::fromUtf8 (mProc.readAllStandardOutput()); mStderr = QString::fromUtf8 (mProc.readAllStandardError()); Q_EMIT finished (); }); mProc.setProgram(gpgCardPath); } void GpgCard::start(const QStringList &commands) { mStderr = QString(); mStdout = QString(); if (!mValid) { return; } QStringList args; -// args << QStringLiteral("--with-colons"); + args << QStringLiteral("--with-colons"); args += commands; mProc.setArguments(args); mProc.start(); } QString GpgCard::stdOut() const { return mStdout; } QString GpgCard::stdErr() const { return mStderr; } int GpgCard::exitCode() const { return mExitCode; }