2019-09-20 21:29:39 +02:00
|
|
|
#ifndef PASS_H
|
|
|
|
#define PASS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QVariant>
|
2025-01-15 23:15:00 +01:00
|
|
|
#include <gpgme++/context.h>
|
2019-09-20 21:29:39 +02:00
|
|
|
|
2025-01-15 23:15:00 +01:00
|
|
|
#include "gpg.h"
|
|
|
|
|
|
|
|
using namespace GpgME;
|
2019-09-20 21:29:39 +02:00
|
|
|
|
|
|
|
class Pass : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2025-01-15 23:15:00 +01:00
|
|
|
Q_PROPERTY(QString password_store READ password_store MEMBER m_password_store CONSTANT)
|
2025-01-10 13:48:38 +01:00
|
|
|
|
2025-01-15 23:15:00 +01:00
|
|
|
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);
|
2019-09-20 21:29:39 +02:00
|
|
|
|
|
|
|
signals:
|
2025-01-15 23:15:00 +01:00
|
|
|
// 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;
|
|
|
|
std::unique_ptr<Gpg> m_gpg;
|
|
|
|
std::unique_ptr<QSemaphore> m_sem;
|
|
|
|
QString m_show_filename;
|
2019-09-20 21:29:39 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Pass();
|
|
|
|
~Pass() override = default;
|
|
|
|
|
2025-01-10 15:28:42 +01:00
|
|
|
QString password_store() const
|
|
|
|
{
|
|
|
|
return m_password_store;
|
|
|
|
}
|
2025-01-10 13:48:38 +01:00
|
|
|
|
2025-01-14 08:15:03 +01:00
|
|
|
Q_INVOKABLE void initialize(QObject *window);
|
2025-01-15 23:15:00 +01:00
|
|
|
|
|
|
|
// GPG
|
|
|
|
Q_INVOKABLE bool deleteGPGKey(Key key);
|
2025-01-14 08:15:03 +01:00
|
|
|
Q_INVOKABLE bool importGPGKey(QUrl url);
|
2025-01-15 23:15:00 +01:00
|
|
|
Q_INVOKABLE bool getAllGPGKeys();
|
|
|
|
Q_INVOKABLE void responsePassphraseDialog(bool cancel, QString passphrase);
|
|
|
|
|
|
|
|
// PASS
|
|
|
|
Q_INVOKABLE bool show(QUrl url);
|
|
|
|
|
2019-09-20 21:29:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|