Commit c17feb9f authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

PackageKit: Make it possible to add new signatures in response to the error

BUG: 377645
BUG: 386935
parent 12906bbf
......@@ -92,6 +92,7 @@ void PKTransaction::trigger(PackageKit::Transaction::TransactionFlags flags)
connect(m_trans.data(), &PackageKit::Transaction::errorCode, this, &PKTransaction::errorFound);
connect(m_trans.data(), &PackageKit::Transaction::mediaChangeRequired, this, &PKTransaction::mediaChange);
connect(m_trans.data(), &PackageKit::Transaction::requireRestart, this, &PKTransaction::requireRestart);
connect(m_trans.data(), &PackageKit::Transaction::repoSignatureRequired, this, &PKTransaction::repoSignatureRequired);
connect(m_trans.data(), &PackageKit::Transaction::itemProgress, this, &PKTransaction::progressChanged);
connect(m_trans.data(), &PackageKit::Transaction::eulaRequired, this, &PKTransaction::eulaRequired);
connect(m_trans.data(), &PackageKit::Transaction::allowCancelChanged, this, &PKTransaction::cancellableChanged);
......@@ -253,3 +254,16 @@ void PKTransaction::requireRestart(PackageKit::Transaction::Restart restart, con
{
Q_EMIT passiveMessage(PackageKitMessages::restartMessage(restart, pkgid));
}
void PKTransaction::repoSignatureRequired(const QString& packageID, const QString& repoName, const QString& keyUrl,
const QString& keyUserid, const QString& keyId, const QString& keyFingerprint,
const QString& keyTimestamp, PackageKit::Transaction::SigType type)
{
Q_EMIT proceedRequest(i18n("Missing signature for %1 in %2", packageID, repoName),
i18n("Do you trust the following key?\n\nUrl: %1\nUser: %2\nKey: %3\nFingerprint: %4\nTimestamp: %4\n",
keyUrl, keyUserid, keyFingerprint, keyTimestamp));
m_proceedFunctions << [type, keyId, packageID](){
return PackageKit::Daemon::installSignature(type, keyId, packageID);
};
}
......@@ -51,6 +51,14 @@ class PKTransaction : public Transaction
void cancellableChanged();
void packageResolved(PackageKit::Transaction::Info info, const QString& packageId);
void submitResolve();
void repoSignatureRequired(const QString &packageID,
const QString &repoName,
const QString &keyUrl,
const QString &keyUserid,
const QString &keyId,
const QString &keyFingerprint,
const QString &keyTimestamp,
PackageKit::Transaction::SigType type);
void trigger(PackageKit::Transaction::TransactionFlags flags);
QPointer<PackageKit::Transaction> m_trans;
......
......@@ -85,6 +85,7 @@ void PackageKitUpdater::setupTransaction(PackageKit::Transaction::TransactionFla
connect(m_transaction.data(), &PackageKit::Transaction::mediaChangeRequired, this, &PackageKitUpdater::mediaChange);
connect(m_transaction.data(), &PackageKit::Transaction::requireRestart, this, &PackageKitUpdater::requireRestart);
connect(m_transaction.data(), &PackageKit::Transaction::eulaRequired, this, &PackageKitUpdater::eulaRequired);
connect(m_transaction.data(), &PackageKit::Transaction::repoSignatureRequired, this, &PackageKitUpdater::repoSignatureRequired);
connect(m_transaction.data(), &PackageKit::Transaction::statusChanged, this, &PackageKitUpdater::statusChanged);
connect(m_transaction.data(), &PackageKit::Transaction::allowCancelChanged, this, &PackageKitUpdater::cancellableChanged);
connect(m_transaction.data(), &PackageKit::Transaction::percentageChanged, this, &PackageKitUpdater::percentageChanged);
......@@ -362,3 +363,16 @@ void PackageKitUpdater::packageResolved(PackageKit::Transaction::Info info, cons
if (info == PackageKit::Transaction::InfoRemoving)
m_packagesRemoved << packageId;
}
void PackageKitUpdater::repoSignatureRequired(const QString& packageID, const QString& repoName, const QString& keyUrl,
const QString& keyUserid, const QString& keyId, const QString& keyFingerprint,
const QString& keyTimestamp, PackageKit::Transaction::SigType type)
{
Q_EMIT proceedRequest(i18n("Missing signature for %1 in %2", packageID, repoName),
i18n("Do you trust the following key?\n\nUrl: %1\nUser: %2\nKey: %3\nFingerprint: %4\nTimestamp: %4\n",
keyUrl, keyUserid, keyFingerprint, keyTimestamp));
m_proceedFunctions << [type, keyId, packageID](){
return PackageKit::Daemon::installSignature(type, keyId, packageID);
};
}
......@@ -68,6 +68,14 @@ class PackageKitUpdater : public AbstractBackendUpdater
const QStringList& bugzillaUrls, const QStringList& cveUrls, PackageKit::Transaction::Restart restart, const QString& updateText,
const QString& changelog, PackageKit::Transaction::UpdateState state, const QDateTime& issued, const QDateTime& updated);
void packageResolved(PackageKit::Transaction::Info info, const QString& packageId);
void repoSignatureRequired(const QString &packageID,
const QString &repoName,
const QString &keyUrl,
const QString &keyUserid,
const QString &keyId,
const QString &keyFingerprint,
const QString &keyTimestamp,
PackageKit::Transaction::SigType type);
private:
void processProceedFunction();
......
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