mirror of
https://github.com/QRouland/UTPass.git
synced 2025-07-04 03:02:28 +00:00
Fix delete gpg key
This commit is contained in:
@ -234,7 +234,7 @@ void Gpg::getKeysJobResultSlot(const GpgME::KeyListResult &result, const std::ve
|
||||
const QString &auditLogAsHtml, const GpgME::Error &auditLogError)
|
||||
{
|
||||
if (result.error()) {
|
||||
qWarning() << "Something gone wrong on decrypt";
|
||||
qWarning() << "Something gone wrong on getKeys";
|
||||
qDebug() << "Code Error : " << result.error().code();
|
||||
qDebug() << "Error str : " << result.error().asString();
|
||||
}
|
||||
@ -287,14 +287,13 @@ Error Gpg::deleteKey(const Key key)
|
||||
QObject::connect(job, &DeleteJob::result,
|
||||
this, &Gpg::deleteKeySlot);
|
||||
|
||||
return openpgp()->deleteJob()->start(key, true);
|
||||
return job->start(key, true);
|
||||
}
|
||||
|
||||
void Gpg::deleteKeySlot(const GpgME::Error &error, const QString &auditLogAsHtml, const GpgME::Error &auditLogError)
|
||||
{
|
||||
|
||||
if (error) {
|
||||
qWarning() << "Something gone wrong on decrypt";
|
||||
qWarning() << "Something gone wrong on deleteKey";
|
||||
qDebug() << "Code Error : " << error.code();
|
||||
qDebug() << "Error str : " << error.asString();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ bool Pass::show(QUrl url)
|
||||
return false;
|
||||
}
|
||||
auto path = url.toLocalFile();
|
||||
qInfo() << "Staring decrypting job for " << path;
|
||||
qInfo() << "Pass show " << path;
|
||||
QFileInfo file_info(path);
|
||||
this->m_show_filename = file_info.completeBaseName();
|
||||
return this->m_gpg->decryptFromFile(path);
|
||||
@ -51,36 +51,39 @@ bool Pass::show(QUrl url)
|
||||
|
||||
void Pass::showResult(Error err, QString plain_text)
|
||||
{
|
||||
qInfo() << "Result for decrypting job";
|
||||
qDebug() << "Pass show Result";
|
||||
if (err) {
|
||||
qInfo() << "Decrypt Failed";
|
||||
qInfo() << "Pass show Failed";
|
||||
emit showFailed(err.asString());
|
||||
|
||||
} else if (err.isCanceled()){
|
||||
qInfo() << "Decrypt Cancelled";
|
||||
emit showCancelled();
|
||||
} else if (err.isCanceled()) {
|
||||
qInfo() << "Pass show Cancelled";
|
||||
emit showCancelled();
|
||||
} else {
|
||||
qInfo() << "Decrypt OK";
|
||||
qInfo() << "Pass show Succeed";
|
||||
emit showSucceed(this->m_show_filename, plain_text);
|
||||
}
|
||||
this->m_show_filename = QString();
|
||||
this->m_sem->release(1);
|
||||
}
|
||||
|
||||
bool Pass::deleteGPGKey(Key key)
|
||||
bool Pass::deleteGPGKey(PassKeyModel* key)
|
||||
{
|
||||
if (!this->m_sem->tryAcquire(1, 500)) {
|
||||
return false;
|
||||
}
|
||||
qInfo() << "Deleting Key";
|
||||
return this->m_gpg->deleteKey(key);
|
||||
qInfo() << "Delete Key " << key->uid();
|
||||
return this->m_gpg->deleteKey(key->key());
|
||||
}
|
||||
|
||||
void Pass::deleteGPGKeyResult(Error err)
|
||||
{
|
||||
qDebug() << "Delete Ke yResult";
|
||||
if (err) {
|
||||
qInfo() << "Delete Key Failed";
|
||||
emit deleteGPGKeyFailed(err.asString());
|
||||
} else {
|
||||
qInfo() << "Delete Key Succeed";
|
||||
emit deleteGPGKeySucceed();
|
||||
}
|
||||
this->m_sem->release(1);
|
||||
@ -91,15 +94,18 @@ bool Pass::importGPGKey(QUrl url)
|
||||
if (!this->m_sem->tryAcquire(1, 500)) {
|
||||
return false;
|
||||
}
|
||||
qInfo() << "Importing Key from " << url;
|
||||
qInfo() << "Import GPG Key from " << url;
|
||||
return this->m_gpg->importKeysFromFile(url.toLocalFile());
|
||||
}
|
||||
|
||||
void Pass::importGPGKeyResult(Error err)
|
||||
{
|
||||
qDebug() << "Import GPG Key Result";
|
||||
if (err) {
|
||||
qInfo() << "Delete Key Failed";
|
||||
emit importGPGKeyFailed(err.asString());
|
||||
} else {
|
||||
qInfo() << "Delete Key Succeed";
|
||||
emit importGPGKeySucceed();
|
||||
}
|
||||
this->m_sem->release(1);
|
||||
@ -110,15 +116,18 @@ bool Pass::getAllGPGKeys()
|
||||
if (!this->m_sem->tryAcquire(1, 500)) {
|
||||
return false;
|
||||
}
|
||||
qInfo() << "Getting all key form gpg ";
|
||||
qInfo() << "Get GPG keys";
|
||||
return this->m_gpg->getAllKeys();
|
||||
}
|
||||
|
||||
void Pass::getAllGPGKeysResult(Error err, std::vector<GpgME::Key> keys_info)
|
||||
{
|
||||
qDebug() << "Get GPG keys Result";
|
||||
if (err) {
|
||||
qInfo() << "Get GPG Failed";
|
||||
emit getAllGPGKeysFailed(err.asString());
|
||||
} else {
|
||||
qInfo() << "Get GPG Succeed";
|
||||
emit getAllGPGKeysSucceed(QVariant::fromValue(PassKeyModel::keysToPassKey(keys_info)));
|
||||
}
|
||||
this->m_sem->release(1);
|
||||
@ -126,6 +135,6 @@ void Pass::getAllGPGKeysResult(Error err, std::vector<GpgME::Key> keys_info)
|
||||
|
||||
void Pass::responsePassphraseDialog(bool cancel, QString passphrase)
|
||||
{
|
||||
qDebug() << "responsePassphraseDialog";
|
||||
qDebug() << "Propagate responsePassphraseDialog";
|
||||
emit responsePassphraseDialogPropagate(cancel, passphrase);
|
||||
}
|
||||
|
@ -79,8 +79,6 @@ signals:
|
||||
*/
|
||||
void getAllGPGKeysSucceed(QVariant keys_info);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Emitted when retrieving GPG keys fails.
|
||||
* @param message The error message describing the failure.
|
||||
@ -144,10 +142,10 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Deletes the specified GPG key.
|
||||
* @param key The GPG key to delete.
|
||||
* @param key The PassKeyModel to delete.
|
||||
* @return True if the operation was successful, false otherwise.
|
||||
*/
|
||||
Q_INVOKABLE bool deleteGPGKey(Key key);
|
||||
Q_INVOKABLE bool deleteGPGKey(PassKeyModel* key);
|
||||
|
||||
/**
|
||||
* @brief Imports a GPG key from the given URL.
|
||||
|
Reference in New Issue
Block a user