1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-06-30 01:02:29 +00:00
This commit is contained in:
2019-03-22 00:11:36 +01:00
parent 7dc320f8ce
commit 2390cc983b
20 changed files with 67 additions and 135 deletions

View File

@ -43,7 +43,7 @@ Gpg::Gpg()
qDebug() << "GpgME Engine Version :" << engineInfo(OpenPGP).version();
}
void Gpg::list_dir()
void Gpg::listDir()
{
qDebug() << "hello world!";
}
@ -64,7 +64,7 @@ QString Gpg::decrypt(const QByteArray cipherText)
return QString::fromUtf8(plainText);*/
}
QString Gpg::decrypt_file(const QString path)
QString Gpg::decryptFile(QString path)
{
/*QFile file(path);
if (!file.open(QIODevice::ReadOnly)) {
@ -91,7 +91,7 @@ QByteArray Gpg::encrypt(const QString str)
return cipherText;*/
}
bool Gpg::encrypt_file(const QString str, const QString path)
bool Gpg::encryptFile(QString str, QString path)
{
/*QFile file(path);
if (!file.open(QIODevice::WriteOnly)) {
@ -102,7 +102,7 @@ bool Gpg::encrypt_file(const QString str, const QString path)
return true;*/
}
QString Gpg::get_key_id(QString uid)
QString Gpg::getKeyId(QString uid)
{
qDebug() << "Getting the key id " << uid;
auto *job = openpgp()->keyListJob(false, false, false);
@ -119,7 +119,7 @@ QString Gpg::get_key_id(QString uid)
return kId;
}
QStringList Gpg::get_all_keys_id()
QStringList Gpg::getAllKeysId()
{
qDebug() << "Show all available key";
auto job = openpgp()->keyListJob(false, false, false);
@ -140,7 +140,7 @@ QStringList Gpg::get_all_keys_id()
return r;
}
bool Gpg::import_key(QString path)
bool Gpg::importKey(QString path)
{
qDebug() << "Importing the key file" << path;
QFile file(path);

View File

@ -9,16 +9,16 @@ class Gpg : public QObject
public:
Gpg();
~Gpg() = default;
~Gpg() override = default;
Q_INVOKABLE void list_dir();
Q_INVOKABLE QString get_key_id(QString uid);
Q_INVOKABLE QStringList get_all_keys_id();
Q_INVOKABLE bool import_key(QString path);
Q_INVOKABLE void listDir();
Q_INVOKABLE QString getKeyId(QString uid);
Q_INVOKABLE QStringList getAllKeysId();
Q_INVOKABLE bool importKey(QString path);
Q_INVOKABLE QString decrypt(QByteArray plainText);
Q_INVOKABLE QString decrypt_file(QString path);
Q_INVOKABLE QString decryptFile(QString path);
Q_INVOKABLE QByteArray encrypt(QString str);
Q_INVOKABLE bool encrypt_file(QString str, QString path);
Q_INVOKABLE bool encryptFile(QString str, QString path);
};
#endif

View File

@ -3,7 +3,7 @@
#include "plugin.h"
#include "gpg.h"
void FileSystemPlugin::registerTypes(const char *uri)
void GpgPlugin::registerTypes(const char *uri)
{
//@uri Pass
qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; });

View File

@ -1,9 +1,9 @@
#ifndef PASSPLUGIN_H
#define PASSPLUGIN_H
#ifndef GPGPLUGIN_H
#define GPGPLUGIN_H
#include <QQmlExtensionPlugin>
class FileSystemPlugin : public QQmlExtensionPlugin
class GpgPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID

View File

@ -1,17 +1,20 @@
#include <QDebug>
#include <QFile>
#include <QtCore/QStandardPaths>
#include <QtCore/QDir>
#include "pass.h"
Pass::Pass()
{
Pass::Pass(){
pass_store = QStandardPaths::writableLocation(
QStandardPaths::AppDataLocation).append("/.password-store");
QDir dir(pass_store);
if (!dir.exists())
dir.mkpath(".");
qDebug() << "Password Store is :" << pass_store;
}
void Pass::speak()
{
qDebug() << "Starting app from main.cpp";
}

View File

@ -6,7 +6,7 @@
class Pass : public QObject
{
Q_OBJECT
QString gpgHome;
QString pass_store;
public:
Pass();