mirror of
https://github.com/QRouland/UTPass.git
synced 2026-01-10 03:26:57 +00:00
Add delete password store feature
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <QtCore/QStandardPaths>
|
||||
#include <QtCore/QDir>
|
||||
|
||||
#include "jobs/rmjob.h"
|
||||
#include "pass.h"
|
||||
#include "gpg.h"
|
||||
#include "passkeymodel.h"
|
||||
@@ -49,6 +50,7 @@ bool Pass::show(QUrl url)
|
||||
return this->m_gpg->decryptFromFile(path);
|
||||
}
|
||||
|
||||
|
||||
void Pass::showResult(Error err, QString plain_text)
|
||||
{
|
||||
qDebug() << "Pass show Result";
|
||||
@@ -67,6 +69,31 @@ void Pass::showResult(Error err, QString plain_text)
|
||||
this->m_sem->release(1);
|
||||
}
|
||||
|
||||
bool Pass::deletePasswordStore()
|
||||
{
|
||||
qInfo() << "Pass delete Password Store";
|
||||
auto job = new RmJob(this->password_store());
|
||||
qDebug() << "Delete Password Store at " << this->password_store();
|
||||
connect(job, &RmJob::resultReady, this, &Pass::deletePasswordStoreResult);
|
||||
connect(job, &RmJob::finished, job, &QObject::deleteLater);
|
||||
job->start();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Pass::deletePasswordStoreResult(bool err)
|
||||
{
|
||||
qDebug() << "Pass delete Password StoreResult";
|
||||
if (err) { //dir.removeRecursively()) {
|
||||
qInfo() << "Pass delete Password Store Failed";
|
||||
emit deletePasswordStoreFailed("failed to delete password store");
|
||||
|
||||
} else {
|
||||
qInfo() << "Pass delete Password Store Succeed";
|
||||
emit deletePasswordStoreSucceed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Pass::deleteGPGKey(PassKeyModel* key)
|
||||
{
|
||||
if (!this->m_sem->tryAcquire(1, 500)) {
|
||||
|
||||
Reference in New Issue
Block a user