mirror of
https://github.com/QRouland/UTPass.git
synced 2026-01-10 19:36:57 +00:00
Refactor gpg for more clean job handling
This commit is contained in:
@@ -4,20 +4,44 @@
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <gpgme++/context.h>
|
||||
|
||||
#include "gpg.h"
|
||||
|
||||
using namespace GpgME;
|
||||
|
||||
class Pass : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString password_store READ password_store)
|
||||
Q_PROPERTY(QString password_store READ password_store MEMBER m_password_store CONSTANT)
|
||||
|
||||
private slots:
|
||||
void showResult(Error err, QString plain_text);
|
||||
void deleteGPGKeyResult(Error err);
|
||||
void importGPGKeyResult(Error err);
|
||||
void getAllGPGKeysResult(Error err, std::vector< GpgME::Key > keys_info);
|
||||
|
||||
signals:
|
||||
// GPG
|
||||
void deleteGPGKeySucceed();
|
||||
void deleteGPGKeyFailed(QString message);
|
||||
void importGPGKeySucceed();
|
||||
void importGPGKeyFailed(QString message);
|
||||
void getAllGPGKeysSucceed(QVariant keys_info);
|
||||
void getAllGPGKeysFailed(QString message);
|
||||
void responsePassphraseDialogPropagate(bool cancel, QString passphrase);
|
||||
|
||||
// pass show
|
||||
void showSucceed(QString name, QString text);
|
||||
void showFailed(QString message);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
QString m_password_store;
|
||||
|
||||
signals:
|
||||
void decrypted(QString name, QString text);
|
||||
void decryptCanceled();
|
||||
void decryptFailed();
|
||||
std::unique_ptr<Gpg> m_gpg;
|
||||
std::unique_ptr<QSemaphore> m_sem;
|
||||
QString m_show_filename;
|
||||
|
||||
public:
|
||||
Pass();
|
||||
@@ -29,10 +53,16 @@ public:
|
||||
}
|
||||
|
||||
Q_INVOKABLE void initialize(QObject *window);
|
||||
Q_INVOKABLE void show(QUrl url);
|
||||
Q_INVOKABLE bool deleteGPGKey(QString id);
|
||||
|
||||
// GPG
|
||||
Q_INVOKABLE bool deleteGPGKey(Key key);
|
||||
Q_INVOKABLE bool importGPGKey(QUrl url);
|
||||
Q_INVOKABLE QVariant getAllGPGKeys();
|
||||
Q_INVOKABLE bool getAllGPGKeys();
|
||||
Q_INVOKABLE void responsePassphraseDialog(bool cancel, QString passphrase);
|
||||
|
||||
// PASS
|
||||
Q_INVOKABLE bool show(QUrl url);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user