mirror of
https://github.com/QRouland/UTPass.git
synced 2025-07-02 10:12:28 +00:00
Fix style command
This commit is contained in:
@ -19,7 +19,7 @@ bool Git::clone(QString url, QString destination_dir_path)
|
||||
qDebug() << "Cloning " << url << " to tmp dir " << tmp_dir.absolutePath();
|
||||
auto ret = LibGit::instance()->clone(url, tmp_dir.absolutePath()); // TODO Better error handling
|
||||
|
||||
if(ret) {
|
||||
if (ret) {
|
||||
qDebug() << "Removing password_store " << destination_dir_path;
|
||||
QDir destination_dir(destination_dir_path);
|
||||
destination_dir.removeRecursively();
|
||||
|
@ -13,12 +13,13 @@ LibGit::LibGit()
|
||||
git_libgit2_init();
|
||||
}
|
||||
|
||||
LibGit::~LibGit() {
|
||||
LibGit::~LibGit()
|
||||
{
|
||||
git_libgit2_shutdown();
|
||||
}
|
||||
|
||||
int LibGit::credentials_cb(git_cred **out, const char *url, const char *username_from_url,
|
||||
unsigned int allowed_types, void *payload)
|
||||
unsigned int allowed_types, void *payload)
|
||||
{
|
||||
int error;
|
||||
const char *user, *pass;
|
||||
@ -38,7 +39,8 @@ int LibGit::credentials_cb(git_cred **out, const char *url, const char *username
|
||||
return GIT_EUSER;
|
||||
}
|
||||
|
||||
bool LibGit::clone(QString url, QString path) {
|
||||
bool LibGit::clone(QString url, QString path)
|
||||
{
|
||||
git_repository *repo = NULL;
|
||||
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
||||
opts.fetch_opts.callbacks.credentials = *credentials_cb;
|
||||
|
@ -13,7 +13,7 @@ class LibGit
|
||||
private:
|
||||
LibGit();
|
||||
static int credentials_cb(git_cred **out, const char *url, const char *username_from_url,
|
||||
unsigned int allowed_types, void *payload);
|
||||
unsigned int allowed_types, void *payload);
|
||||
|
||||
|
||||
public:
|
||||
|
@ -63,7 +63,8 @@ QString Gpg::initGpgHome()
|
||||
}
|
||||
|
||||
|
||||
QString Gpg::findCommandPath(const QString &command) {
|
||||
QString Gpg::findCommandPath(const QString &command)
|
||||
{
|
||||
// Retrieve the PATH environment variable
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
QString pathEnv = env.value("PATH");
|
||||
@ -111,10 +112,10 @@ void Gpg::initGpgConfig()
|
||||
agentConf.close();
|
||||
|
||||
auto err = gpgme_set_engine_info (
|
||||
GPGME_PROTOCOL_OpenPGP,
|
||||
exec.toLocal8Bit().data(),
|
||||
home.toLocal8Bit().data()
|
||||
);
|
||||
GPGME_PROTOCOL_OpenPGP,
|
||||
exec.toLocal8Bit().data(),
|
||||
home.toLocal8Bit().data()
|
||||
);
|
||||
if (err != GPG_ERR_NO_ERROR) {
|
||||
qDebug() << "Error code : " << err;
|
||||
qDebug() << "Error str : " << gpg_strerror(err);
|
||||
@ -198,13 +199,13 @@ Error Gpg::encryptToFile(QString str, QString path, QString uid, bool ascii_armo
|
||||
|
||||
|
||||
QPair<Error, std::vector< GpgME::Key >> Gpg::getAllKeys ( bool remote, const bool include_sigs,
|
||||
bool validate )
|
||||
bool validate )
|
||||
{
|
||||
return getKeys(QString(""), remote, include_sigs, validate);
|
||||
}
|
||||
|
||||
QPair<Error, std::vector<Key>> Gpg::getKeys(QString pattern_uid, bool remote, bool include_sigs,
|
||||
bool validate)
|
||||
QPair<Error, std::vector<Key >> Gpg::getKeys(QString pattern_uid, bool remote, bool include_sigs,
|
||||
bool validate)
|
||||
{
|
||||
qDebug() << "Getting the keys " << pattern_uid;
|
||||
auto job = std::unique_ptr<KeyListJob>(openpgp()->keyListJob(remote, include_sigs, validate));
|
||||
@ -213,7 +214,7 @@ QPair<Error, std::vector<Key>> Gpg::getKeys(QString pattern_uid, bool remote, bo
|
||||
auto result = job->exec(QStringList() << pattern_uid, false, keys);
|
||||
|
||||
qDebug() << "Got the keys " << pattern_uid;
|
||||
return QPair<Error, std::vector< Key >>(result.error(), keys);
|
||||
return QPair<Error, std::vector< Key >> (result.error(), keys);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,10 +42,10 @@ public:
|
||||
|
||||
|
||||
QPair<Error, std::vector<Key >> getAllKeys(bool remote = false, bool include_sigs = {}, bool
|
||||
validate = false);
|
||||
QPair<Error, std::vector<Key>> getKeys( QString pattern_uid, bool remote = false,
|
||||
bool include_sigs = false,
|
||||
bool validate = false);
|
||||
validate = false);
|
||||
QPair<Error, std::vector<Key >> getKeys( QString pattern_uid, bool remote = false,
|
||||
bool include_sigs = false,
|
||||
bool validate = false);
|
||||
QPair<Error, Key> getKey( QString uid, bool remote = false, bool include_sigs = false,
|
||||
bool validate = false);
|
||||
QPair<Error, QString> decrypt( QByteArray cipherText);
|
||||
|
@ -23,7 +23,10 @@ public:
|
||||
Pass();
|
||||
~Pass() override = default;
|
||||
|
||||
QString password_store() const { return m_password_store; }
|
||||
QString password_store() const
|
||||
{
|
||||
return m_password_store;
|
||||
}
|
||||
|
||||
Q_INVOKABLE void init(QObject *window);
|
||||
Q_INVOKABLE void decrypt(QUrl url);
|
||||
|
@ -29,7 +29,7 @@ bool Utils::unzip(QUrl zip_url, QString dir_out_path)
|
||||
|
||||
qDebug() << "Guessing if it should remove a single root folder";
|
||||
QStringList files_in_tmp_dir = tmp_dir.entryList(QDir::AllEntries | QDir::Hidden |
|
||||
QDir::NoDotAndDotDot);
|
||||
QDir::NoDotAndDotDot);
|
||||
|
||||
auto dir_import_path =
|
||||
files_in_tmp_dir.length() == 1 ?
|
||||
|
Reference in New Issue
Block a user