mirror of
https://github.com/QRouland/UTPass.git
synced 2025-04-21 21:46:31 +00:00
Compare commits
No commits in common. "2be75f9bd68959dc5f76967dce71b6fe1288e01b" and "884488b9edf01b869e77f594362012c756b03156" have entirely different histories.
2be75f9bd6
...
884488b9ed
@ -41,7 +41,7 @@ bool Git::clone(QString url, QString path, cred_type mode)
|
|||||||
[](const HTTPUserPass & x) { UNUSED(x); return "HTTPAuth"; },
|
[](const HTTPUserPass & x) { UNUSED(x); return "HTTPAuth"; },
|
||||||
[](const SSHKey & x) { UNUSED(x); return "SSHKey"; },
|
[](const SSHKey & x) { UNUSED(x); return "SSHKey"; },
|
||||||
};
|
};
|
||||||
qDebug() << "[Git] Creating clone Job " << url << " " << path << " " << std::visit(v, mode);
|
qDebug() << "Creating clone Job " << url << " " << path << " " << std::visit(v, mode);
|
||||||
CloneJob *clone_job = new CloneJob(url, path, mode);
|
CloneJob *clone_job = new CloneJob(url, path, mode);
|
||||||
connect(clone_job, &CloneJob::resultReady, this, &Git::cloneResult);
|
connect(clone_job, &CloneJob::resultReady, this, &Git::cloneResult);
|
||||||
connect(clone_job, &CloneJob::finished, clone_job, &QObject::deleteLater);
|
connect(clone_job, &CloneJob::finished, clone_job, &QObject::deleteLater);
|
||||||
@ -65,7 +65,7 @@ bool Git::cloneHttpPass(QString url, QString path, QString pass)
|
|||||||
|
|
||||||
bool Git::cloneSshKey(QString url, QString path, QString passphrase)
|
bool Git::cloneSshKey(QString url, QString path, QString passphrase)
|
||||||
{
|
{
|
||||||
qInfo() << "[Git] Call clone command SshKey " << url << " " << path;
|
qInfo() << "[Git] Call clone command HttpPass " << url << " " << path;
|
||||||
|
|
||||||
SSHKey mode = { this->pubKeyPath(), this->privKeyPath(), passphrase };
|
SSHKey mode = { this->pubKeyPath(), this->privKeyPath(), passphrase };
|
||||||
return this->clone(url, path, mode);
|
return this->clone(url, path, mode);
|
||||||
|
@ -56,7 +56,7 @@ private:
|
|||||||
* @brief Clones a repository from a specified URL.
|
* @brief Clones a repository from a specified URL.
|
||||||
*
|
*
|
||||||
* This private method initiates the cloning job. It sets up the repository cloning process based on
|
* This private method initiates the cloning job. It sets up the repository cloning process based on
|
||||||
* the specified URL, destination path, and cloning mode (HTTP, HTTP_AUTH or SSH).
|
* the specified URL, destination path, and cloning mode (HTTP or SSH).
|
||||||
*
|
*
|
||||||
* @param url The URL of the Git repository to clone.
|
* @param url The URL of the Git repository to clone.
|
||||||
* @param path The destination path for the cloned repository.
|
* @param path The destination path for the cloned repository.
|
||||||
@ -90,14 +90,14 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor for the Git class.
|
* @brief Constructor for the Git class.
|
||||||
*
|
*
|
||||||
* Initializes the `Git` class.
|
* Initializes the `Git` class, setting up necessary resources such as the semaphore for concurrent operation management.
|
||||||
*/
|
*/
|
||||||
Git();
|
Git();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destructor for the Git class.
|
* @brief Destructor for the Git class.
|
||||||
*
|
*
|
||||||
* Cleans up any resources used by the `Git` class.
|
* Cleans up any resources used by the `Git` class, ensuring that no ongoing operations or resources are left hanging.
|
||||||
*/
|
*/
|
||||||
~Git() override;
|
~Git() override;
|
||||||
|
|
||||||
@ -108,10 +108,11 @@ public:
|
|||||||
* @brief Clones a repository over HTTP.
|
* @brief Clones a repository over HTTP.
|
||||||
*
|
*
|
||||||
* This method clones a Git repository from the specified HTTP URL and saves it to the given destination path.
|
* This method clones a Git repository from the specified HTTP URL and saves it to the given destination path.
|
||||||
|
* It is a wrapper around the private `clone()` method, specifying the HTTP cloning mode.
|
||||||
*
|
*
|
||||||
* @param url The HTTP URL of the Git repository to clone.
|
* @param url The HTTP URL of the Git repository to clone.
|
||||||
* @param path The destination path for the cloned repository.
|
* @param path The destination path for the cloned repository.
|
||||||
* @return `true` if the clone operation was successfully started, `false` otherwise.
|
* @return `true` if the clone operation was successful, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool cloneHttp(QString url, QString path);
|
Q_INVOKABLE bool cloneHttp(QString url, QString path);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ QDir CloneJob::cloneSetup()
|
|||||||
QDir tmp_dir(QStandardPaths::writableLocation( QStandardPaths::CacheLocation).append("/clone"));
|
QDir tmp_dir(QStandardPaths::writableLocation( QStandardPaths::CacheLocation).append("/clone"));
|
||||||
|
|
||||||
tmp_dir.removeRecursively();
|
tmp_dir.removeRecursively();
|
||||||
qDebug() << "[CloneJob] Temp dir path is " << tmp_dir.absolutePath();
|
qDebug() << "[CloneJob]Temp dir path is " << tmp_dir.absolutePath();
|
||||||
|
|
||||||
return tmp_dir;
|
return tmp_dir;
|
||||||
}
|
}
|
||||||
@ -64,10 +64,9 @@ bool CloneJob::clone(QString url, QString path, cred_type cred, git_cred_acquire
|
|||||||
{
|
{
|
||||||
git_repository *repo = NULL;
|
git_repository *repo = NULL;
|
||||||
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
||||||
PayloadCB payload = PayloadCB(false, cred);
|
|
||||||
|
|
||||||
opts.fetch_opts.callbacks.credentials = cb;
|
opts.fetch_opts.callbacks.credentials = cb;
|
||||||
opts.fetch_opts.callbacks.payload = &payload;
|
opts.fetch_opts.callbacks.payload = &cred;
|
||||||
|
|
||||||
int ret = git_clone(&repo, url.toLocal8Bit().data(), path.toLocal8Bit().data(), &opts);
|
int ret = git_clone(&repo, url.toLocal8Bit().data(), path.toLocal8Bit().data(), &opts);
|
||||||
if (ret == GIT_EUSER ) {
|
if (ret == GIT_EUSER ) {
|
||||||
|
@ -24,32 +24,26 @@ int GitJob::credentialsCB(git_cred **out, const char *url, const char *username_
|
|||||||
unsigned int allowed_types, void *payload)
|
unsigned int allowed_types, void *payload)
|
||||||
{
|
{
|
||||||
UNUSED(url);
|
UNUSED(url);
|
||||||
PayloadCB *p = (PayloadCB *)payload;
|
cred_type *cred = (cred_type *)payload;
|
||||||
|
|
||||||
if (!username_from_url) { // we required here that the username must be provided directly in url (maybe improve later on)
|
if (!username_from_url) {
|
||||||
qWarning() << "[GitJob] credentials_cb : no username provided";
|
qWarning() << "[GitJob] credentials_cb : no username provided ";
|
||||||
return (int) GIT_EUSER;
|
return (int) GIT_EUSER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->called) {
|
|
||||||
qWarning() << "[GitJob] credentials_cb : cb already called, probably invalid creds";
|
|
||||||
return (int) GIT_EUSER;
|
|
||||||
}
|
|
||||||
p->called = true;
|
|
||||||
|
|
||||||
auto v = overload {
|
auto v = overload {
|
||||||
[](const HTTP & x)
|
[](const HTTP & x)
|
||||||
{
|
{
|
||||||
UNUSED(x);
|
UNUSED(x);
|
||||||
qDebug() << "[GitJob] credentialsCB : HTTP ";
|
qDebug() << "[GitJob] credentialsCB : None ";
|
||||||
qWarning() << "[GitJob] credentialsCB : callback should never be call for HTTP";
|
qWarning() << "[GitJob] credentialsCB : callback should never be call for None ";
|
||||||
return (int) GIT_EUSER;
|
return (int) GIT_EUSER;
|
||||||
},
|
},
|
||||||
[allowed_types, &out, &username_from_url](const HTTPUserPass & x)
|
[allowed_types, &out, &username_from_url](const HTTPUserPass & x)
|
||||||
{
|
{
|
||||||
qDebug() << "[GitJob] credentialsCB : HTTPUserPass ";
|
qDebug() << "[GitJob] credentialsCB : HTTPUserPass ";
|
||||||
if (!(allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT)) {
|
if (!(allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT)) {
|
||||||
qWarning() << "[GitJob] credentials_cb : allowed_types is invalid for HTTPUserPass creds";
|
qWarning() << "[GitJob] credentials_cb : allowed_types is invalid for HTTPUserPass ";
|
||||||
return (int) GIT_EUSER;
|
return (int) GIT_EUSER;
|
||||||
}
|
}
|
||||||
return git_cred_userpass_plaintext_new(out, username_from_url, x.pass.toLocal8Bit().constData());
|
return git_cred_userpass_plaintext_new(out, username_from_url, x.pass.toLocal8Bit().constData());
|
||||||
@ -58,17 +52,13 @@ int GitJob::credentialsCB(git_cred **out, const char *url, const char *username_
|
|||||||
{
|
{
|
||||||
qDebug() << "[GitJob] credentialsCB : SSHKey ";
|
qDebug() << "[GitJob] credentialsCB : SSHKey ";
|
||||||
if (!(allowed_types & GIT_CREDTYPE_SSH_KEY)) {
|
if (!(allowed_types & GIT_CREDTYPE_SSH_KEY)) {
|
||||||
qWarning() << "[GitJob] credentials_cb : allowed_types is invalid for SSHKey creds";
|
qWarning() << "[GitJob] credentials_cb : allowed_types is invalid for HTTPUserPass ";
|
||||||
return (int) GIT_EUSER;
|
return (int) GIT_EUSER;
|
||||||
}
|
}
|
||||||
qDebug() << "[GitJob] username_from_url :" << username_from_url;
|
|
||||||
qDebug() << "[GitJob] pub_key :" << x.pub_key.toLocal8Bit().constData();
|
|
||||||
qDebug() << "[GitJob] priv_key :" << x.priv_key.toLocal8Bit().constData();
|
|
||||||
qDebug() << "[GitJob] passphrase :" << x.passphrase.toLocal8Bit().constData();
|
|
||||||
return git_cred_ssh_key_new(out, username_from_url, x.pub_key.toLocal8Bit().constData(),
|
return git_cred_ssh_key_new(out, username_from_url, x.pub_key.toLocal8Bit().constData(),
|
||||||
x.priv_key.toLocal8Bit().constData(), x.passphrase.toLocal8Bit().constData());
|
x.priv_key.toLocal8Bit().constData(), x.passphrase.toLocal8Bit().constData());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto ret = std::visit(v, p->creds);
|
auto error = std::visit(v, *cred);
|
||||||
return ret;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,6 @@ struct SSHKey {
|
|||||||
*/
|
*/
|
||||||
typedef std::variant<HTTP, HTTPUserPass, SSHKey> cred_type;
|
typedef std::variant<HTTP, HTTPUserPass, SSHKey> cred_type;
|
||||||
|
|
||||||
|
|
||||||
struct PayloadCB
|
|
||||||
{
|
|
||||||
bool called;
|
|
||||||
cred_type creds;
|
|
||||||
PayloadCB(bool ca, cred_type cr): called(ca), creds(cr) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class GitJob
|
* @class GitJob
|
||||||
* @brief A class that manages Git-related tasks using libgit2.
|
* @brief A class that manages Git-related tasks using libgit2.
|
||||||
|
@ -7,7 +7,6 @@ set(
|
|||||||
pass.cpp
|
pass.cpp
|
||||||
passkeyringmodel.h
|
passkeyringmodel.h
|
||||||
passphraseprovider.h
|
passphraseprovider.h
|
||||||
error.h
|
|
||||||
jobs/decryptjob.cpp
|
jobs/decryptjob.cpp
|
||||||
jobs/deletekeyjob.cpp
|
jobs/deletekeyjob.cpp
|
||||||
jobs/getkeysjob.cpp
|
jobs/getkeysjob.cpp
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
// error.h
|
|
||||||
#ifndef ERROR_H
|
|
||||||
#define ERROR_H
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "rnp/rnp_err.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class ErrorCodeShow {
|
|
||||||
Success= 0,
|
|
||||||
UnexceptedError,
|
|
||||||
BadPassphrase,
|
|
||||||
NoKeyFound,
|
|
||||||
DecryptFailed
|
|
||||||
};
|
|
||||||
|
|
||||||
int rnpErrorToErrorCodeShow(int rnpErrorCode) {
|
|
||||||
switch (rnpErrorCode) {
|
|
||||||
case RNP_SUCCESS:
|
|
||||||
return static_cast<int>(ErrorCodeShow::Success);
|
|
||||||
case RNP_ERROR_BAD_PASSWORD:
|
|
||||||
return static_cast<int>(ErrorCodeShow::BadPassphrase);
|
|
||||||
case RNP_ERROR_KEY_NOT_FOUND:
|
|
||||||
case RNP_ERROR_NO_SUITABLE_KEY:
|
|
||||||
return static_cast<int>(ErrorCodeShow::NoKeyFound);
|
|
||||||
case RNP_ERROR_DECRYPT_FAILED:
|
|
||||||
return static_cast<int>(ErrorCodeShow::DecryptFailed);
|
|
||||||
default:
|
|
||||||
return static_cast<int>(ErrorCodeShow::UnexceptedError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class ErrorCodeImportKeyFile {
|
|
||||||
Success= 0,
|
|
||||||
UnexceptedError,
|
|
||||||
BadFormat,
|
|
||||||
};
|
|
||||||
|
|
||||||
int rnpErrorToErrorCodeImportKeyFile(int rnpErrorCode) {
|
|
||||||
switch (rnpErrorCode) {
|
|
||||||
case RNP_SUCCESS:
|
|
||||||
return static_cast<int>(ErrorCodeShow::Success);
|
|
||||||
case RNP_ERROR_BAD_FORMAT:
|
|
||||||
return static_cast<int>(ErrorCodeImportKeyFile::BadFormat);
|
|
||||||
default:
|
|
||||||
return static_cast<int>(ErrorCodeImportKeyFile::UnexceptedError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum class ErrorCodeUnexvepted {
|
|
||||||
Success= 0,
|
|
||||||
UnexceptedError,
|
|
||||||
};
|
|
||||||
|
|
||||||
int rnpErrorToErrorCodeGeneric(int rnpErrorCode) {
|
|
||||||
switch (rnpErrorCode) {
|
|
||||||
case RNP_SUCCESS:
|
|
||||||
return static_cast<int>(ErrorCodeShow::Success);
|
|
||||||
default:
|
|
||||||
return static_cast<int>(ErrorCodeImportKeyFile::UnexceptedError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class ErrorCode
|
|
||||||
{
|
|
||||||
Success= 0,
|
|
||||||
Error,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ERROR_H
|
|
@ -42,6 +42,29 @@ void ImportKeyJob::run()
|
|||||||
|
|
||||||
// Save resulting keyring
|
// Save resulting keyring
|
||||||
this->saveFullKeyring();
|
this->saveFullKeyring();
|
||||||
|
// rnp_output_t output = NULL;
|
||||||
|
// qDebug() << "[ImportKeyJob] Writing pubring to " << this->pubringPath();
|
||||||
|
// ret = rnp_output_to_file(&output, this->pubringPath().toLocal8Bit().constData(), RNP_OUTPUT_FILE_OVERWRITE);
|
||||||
|
// if (ret == RNP_SUCCESS) {
|
||||||
|
// qDebug() << "[ImportKeyJob] Saving key pubring ";
|
||||||
|
// ret = rnp_save_keys(this->m_ffi, RNP_KEYSTORE_GPG, output, RNP_LOAD_SAVE_PUBLIC_KEYS);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// if (ret == RNP_SUCCESS) {
|
||||||
|
// ret = rnp_output_finish(output);
|
||||||
|
// }
|
||||||
|
// rnp_output_destroy(output);
|
||||||
|
// terminateOnError(ret);
|
||||||
|
|
||||||
|
// qDebug() << "[ImportKeyJob] Writing secring to " << this->secringPath();
|
||||||
|
// ret = rnp_output_to_file(&output, this->secringPath().toLocal8Bit().constData(), RNP_OUTPUT_FILE_OVERWRITE);
|
||||||
|
// if (ret == RNP_SUCCESS) {
|
||||||
|
// qDebug() << "[ImportKeyJob] Saving key secring ";
|
||||||
|
// ret = rnp_save_keys(this->m_ffi, RNP_KEYSTORE_GPG, output, RNP_LOAD_SAVE_SECRET_KEYS);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// rnp_output_destroy(output);
|
||||||
|
// terminateOnError(ret);
|
||||||
|
|
||||||
// Emit result
|
// Emit result
|
||||||
emit resultSuccess();
|
emit resultSuccess();
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
#include "error.h"
|
|
||||||
#include "jobs/decryptjob.h"
|
#include "jobs/decryptjob.h"
|
||||||
#include "jobs/deletekeyjob.h"
|
#include "jobs/deletekeyjob.h"
|
||||||
#include "jobs/getkeysjob.h"
|
#include "jobs/getkeysjob.h"
|
||||||
@ -109,7 +108,7 @@ bool Pass::show(QUrl url)
|
|||||||
void Pass::slotShowError(rnp_result_t err)
|
void Pass::slotShowError(rnp_result_t err)
|
||||||
{
|
{
|
||||||
qInfo() << "[Pass] Show Failed";
|
qInfo() << "[Pass] Show Failed";
|
||||||
emit showFailed(rnpErrorToErrorCodeShow(err), rnp_result_to_string(err));
|
emit showFailed(rnp_result_to_string(err));
|
||||||
this->m_sem->release(1);
|
this->m_sem->release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,13 +136,13 @@ bool Pass::deletePasswordStore()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Pass::slotDeletePasswordStoreResult(bool err)
|
void Pass::slotDeletePasswordStoreResult(bool err)
|
||||||
{
|
{
|
||||||
|
this->initPasswordStore(); // reinit an empty password-store
|
||||||
if (err) {
|
if (err) {
|
||||||
qInfo() << "[Pass] Delete Password Store Failed";
|
qInfo() << "[Pass] Delete Password Store Failed";
|
||||||
emit deletePasswordStoreFailed(static_cast<int>(ErrorCode::Error), "Failed to delete password store");
|
emit deletePasswordStoreFailed("failed to delete password store");
|
||||||
} else {
|
} else {
|
||||||
qInfo() << "[Pass] Delete Password Store Succeed";
|
qInfo() << "[Pass] Delete Password Store Succeed";
|
||||||
this->initPasswordStore(); // reinit an empty password-store
|
|
||||||
emit deletePasswordStoreSucceed();
|
emit deletePasswordStoreSucceed();
|
||||||
}
|
}
|
||||||
this->m_sem->release(1);
|
this->m_sem->release(1);
|
||||||
@ -168,7 +167,7 @@ bool Pass::deleteGPGKey(PassKeyModel* key)
|
|||||||
void Pass::slotDeleteGPGKeyError(rnp_result_t err)
|
void Pass::slotDeleteGPGKeyError(rnp_result_t err)
|
||||||
{
|
{
|
||||||
qInfo() << "[Pass] Delete GPG key Failed";
|
qInfo() << "[Pass] Delete GPG key Failed";
|
||||||
emit deleteGPGKeyFailed(rnpErrorToErrorCodeGeneric(err), rnp_result_to_string(err));
|
emit deleteGPGKeyFailed(rnp_result_to_string(err));
|
||||||
this->m_sem->release(1);
|
this->m_sem->release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +197,7 @@ bool Pass::importGPGKey(QUrl url)
|
|||||||
void Pass::slotImportGPGKeyError(rnp_result_t err)
|
void Pass::slotImportGPGKeyError(rnp_result_t err)
|
||||||
{
|
{
|
||||||
qInfo() << "[Pass] Import GPG Key Failed";
|
qInfo() << "[Pass] Import GPG Key Failed";
|
||||||
emit importGPGKeyFailed(rnpErrorToErrorCodeImportKeyFile(err), rnp_result_to_string(err));
|
emit importGPGKeyFailed(rnp_result_to_string(err));
|
||||||
this->m_sem->release(1);
|
this->m_sem->release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +228,7 @@ void Pass::slotGetAllGPGKeysError(rnp_result_t err)
|
|||||||
{
|
{
|
||||||
qInfo() << "[Pass] Get all GPG Keys Failed";
|
qInfo() << "[Pass] Get all GPG Keys Failed";
|
||||||
this->m_keyring_model = nullptr;
|
this->m_keyring_model = nullptr;
|
||||||
emit getAllGPGKeysFailed(rnpErrorToErrorCodeGeneric(err), rnp_result_to_string(err));
|
emit getAllGPGKeysFailed(rnp_result_to_string(err));
|
||||||
this->m_sem->release(1);
|
this->m_sem->release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ signals:
|
|||||||
* @brief Emitted when a GPG key deletion fails.
|
* @brief Emitted when a GPG key deletion fails.
|
||||||
* @param message The error message describing the failure.
|
* @param message The error message describing the failure.
|
||||||
*/
|
*/
|
||||||
void deleteGPGKeyFailed(int err, QString message);
|
void deleteGPGKeyFailed(QString message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Emitted when a GPG key is successfully imported.
|
* @brief Emitted when a GPG key is successfully imported.
|
||||||
@ -89,7 +89,7 @@ signals:
|
|||||||
* @brief Emitted when a GPG key import fails.
|
* @brief Emitted when a GPG key import fails.
|
||||||
* @param message The error message describing the failure.
|
* @param message The error message describing the failure.
|
||||||
*/
|
*/
|
||||||
void importGPGKeyFailed(int err, QString message);
|
void importGPGKeyFailed(QString message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Emitted when all GPG keys are successfully retrieved.
|
* @brief Emitted when all GPG keys are successfully retrieved.
|
||||||
@ -101,7 +101,7 @@ signals:
|
|||||||
* @brief Emitted when retrieving GPG keys fails.
|
* @brief Emitted when retrieving GPG keys fails.
|
||||||
* @param message The error message describing the failure.
|
* @param message The error message describing the failure.
|
||||||
*/
|
*/
|
||||||
void getAllGPGKeysFailed(int err, QString message);
|
void getAllGPGKeysFailed(QString message);
|
||||||
|
|
||||||
// Pass-related signals
|
// Pass-related signals
|
||||||
/**
|
/**
|
||||||
@ -125,7 +125,7 @@ signals:
|
|||||||
* @brief Emitted when showing a password fails.
|
* @brief Emitted when showing a password fails.
|
||||||
* @param message The error message describing the failure.
|
* @param message The error message describing the failure.
|
||||||
*/
|
*/
|
||||||
void showFailed(int err, QString message);
|
void showFailed(QString message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Emitted hen showing a password cancelled.
|
* @brief Emitted hen showing a password cancelled.
|
||||||
@ -142,7 +142,7 @@ signals:
|
|||||||
* @brief Emitted when deleting the password store fails.
|
* @brief Emitted when deleting the password store fails.
|
||||||
* @param message The error message describing the failure.
|
* @param message The error message describing the failure.
|
||||||
*/
|
*/
|
||||||
void deletePasswordStoreFailed(int err, QString message);
|
void deletePasswordStoreFailed(QString message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_password_store; /**< The path to the password store. */
|
QString m_password_store; /**< The path to the password store. */
|
||||||
|
@ -59,9 +59,9 @@ bool Utils::rmDir(QUrl dir_url)
|
|||||||
|
|
||||||
bool Utils::fileExists(QUrl path)
|
bool Utils::fileExists(QUrl path)
|
||||||
{
|
{
|
||||||
QString p = path.toString();
|
QString p = path.toLocalFile();
|
||||||
auto ret = QFileInfo::exists(p) && QFileInfo(p).isFile();
|
auto ret = QFileInfo::exists(p) && QFileInfo(p).isFile();
|
||||||
qDebug() << "[Utils]" << path << "existing file :" << ret;
|
qDebug() << "[Utils]" << path << " existing file :" << ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: utpass.qrouland\n"
|
"Project-Id-Version: utpass.qrouland\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2025-03-14 10:08+0100\n"
|
"POT-Creation-Date: 2025-02-21 15:49+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -71,15 +71,15 @@ msgstr ""
|
|||||||
msgid "Import failed !"
|
msgid "Import failed !"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/components/ImportFile.qml:21
|
#: ../qml/components/ImportFile.qml:20
|
||||||
msgid "File Imported"
|
msgid "File Import"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/dialogs/ErrorDialog.qml:13
|
#: ../qml/dialogs/ErrorDialog.qml:12
|
||||||
msgid "Error !"
|
msgid "Error !"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/dialogs/ErrorDialog.qml:17
|
#: ../qml/dialogs/ErrorDialog.qml:16
|
||||||
msgid "Close"
|
msgid "Close"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -137,39 +137,27 @@ msgstr ""
|
|||||||
msgid "Info"
|
msgid "Info"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:58
|
#: ../qml/pages/PasswordList.qml:79
|
||||||
msgid "Bad passphrase"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:61
|
|
||||||
msgid "No valid key found"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:64
|
|
||||||
msgid "Decryption failed"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:98
|
|
||||||
msgid "No password found"
|
msgid "No password found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:111
|
#: ../qml/pages/PasswordList.qml:92
|
||||||
msgid "You can import a password store by cloning or"
|
msgid "You can import a password store by cloning or"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:118
|
#: ../qml/pages/PasswordList.qml:99
|
||||||
msgid "importing a password store zip in the settings"
|
msgid "importing a password store zip in the settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:195
|
#: ../qml/pages/PasswordList.qml:176
|
||||||
msgid "Decryption failed !"
|
msgid "Decryption failed !"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:219
|
#: ../qml/pages/PasswordList.qml:198
|
||||||
msgid "Back"
|
msgid "Back"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:226 ../qml/pages/headers/MainHeader.qml:14
|
#: ../qml/pages/PasswordList.qml:205 ../qml/pages/headers/MainHeader.qml:14
|
||||||
#: ../qml/pages/headers/StackHeader.qml:9 UTPass.desktop.in.h:1
|
#: ../qml/pages/headers/StackHeader.qml:9 UTPass.desktop.in.h:1
|
||||||
msgid "UTPass"
|
msgid "UTPass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -227,22 +215,18 @@ msgstr ""
|
|||||||
msgid "Git Clone Import"
|
msgid "Git Clone Import"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/settings/ImportKeyFile.qml:7
|
#: ../qml/pages/settings/ImportKeyFile.qml:8
|
||||||
msgid "GPG Key Import"
|
msgid "GPG Key Import"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/settings/ImportKeyFile.qml:8
|
#: ../qml/pages/settings/ImportKeyFile.qml:9
|
||||||
msgid "Key successfully imported !"
|
msgid "Key successfully imported !"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/settings/ImportKeyFile.qml:9
|
#: ../qml/pages/settings/ImportKeyFile.qml:10
|
||||||
msgid "Key import failed !"
|
msgid "Key import failed !"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/settings/ImportKeyFile.qml:33
|
|
||||||
msgid "The file is not in a valid key format"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../qml/pages/settings/ImportSSHkey.qml:10
|
#: ../qml/pages/settings/ImportSSHkey.qml:10
|
||||||
msgid "SSH Key Import"
|
msgid "SSH Key Import"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -142,7 +142,7 @@ Column {
|
|||||||
color: theme.palette.normal.positive
|
color: theme.palette.normal.positive
|
||||||
text: i18n.tr('Clone')
|
text: i18n.tr('Clone')
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Git.cloneSshKey(repoUrlInput.text, Pass.password_store, repoPassphraseInput.text);
|
Git.cloneSSHKey(repoUrlInput.text, Pass.Passphrase_store, repoPassphraseInput.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@ Page {
|
|||||||
|
|
||||||
property string headerTitle : i18n.tr("Import succeeded !")
|
property string headerTitle : i18n.tr("Import succeeded !")
|
||||||
property string dialogErrorTxt : i18n.tr("Import failed !")
|
property string dialogErrorTxt : i18n.tr("Import failed !")
|
||||||
property string dialogErrorDescriptionTxt : null
|
property string dialogSuccessTxt : i18n.tr("File Import")
|
||||||
property string dialogSuccessTxt : i18n.tr("File Imported")
|
|
||||||
|
|
||||||
ContentPeerPicker {
|
ContentPeerPicker {
|
||||||
id: contentPicker
|
id: contentPicker
|
||||||
@ -47,7 +46,6 @@ Page {
|
|||||||
|
|
||||||
ErrorDialog {
|
ErrorDialog {
|
||||||
textError: importKeyFilePage.dialogErrorTxt
|
textError: importKeyFilePage.dialogErrorTxt
|
||||||
textErrorDescription: importKeyFilePage.dialogErrorDescriptionTxt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,11 @@ Dialog {
|
|||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
property string textError
|
property string textError
|
||||||
property string textErrorDescription : null
|
|
||||||
|
|
||||||
signal dialogClosed()
|
signal dialogClosed()
|
||||||
|
|
||||||
title: i18n.tr("Error !")
|
title: i18n.tr("Error !")
|
||||||
text: textErrorDescription ? (textError + "<br>" + textErrorDescription) : textError
|
text: textError
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: i18n.tr("Close")
|
text: i18n.tr("Close")
|
||||||
|
@ -12,7 +12,6 @@ Page {
|
|||||||
|
|
||||||
property string __passwordStorePath
|
property string __passwordStorePath
|
||||||
property var __passwords
|
property var __passwords
|
||||||
property string __text_error_description: null
|
|
||||||
|
|
||||||
function __searchPasswords(filter) {
|
function __searchPasswords(filter) {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
@ -49,25 +48,7 @@ Page {
|
|||||||
"title": filename
|
"title": filename
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Pass.onShowFailed.connect(function(code, message) {
|
Pass.onShowFailed.connect(function(message) {
|
||||||
switch (code) {
|
|
||||||
case 1: // UnexceptedError -> use the default (not translate) rnp error
|
|
||||||
__text_error_description = message;
|
|
||||||
break;
|
|
||||||
case 2: // BadPassphrase
|
|
||||||
__text_error_description = i18n.tr("Bad passphrase");
|
|
||||||
break;
|
|
||||||
case 3: // NoKeyFound
|
|
||||||
__text_error_description = i18n.tr("No valid key found");
|
|
||||||
break;
|
|
||||||
case 3: // DecryptFailed
|
|
||||||
__text_error_description = i18n.tr("Decryption failed");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.warn("Unhandled error code");
|
|
||||||
__text_error_description = message;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
PopupUtils.open(passwordPageDecryptError);
|
PopupUtils.open(passwordPageDecryptError);
|
||||||
});
|
});
|
||||||
Pass.onLsSucceed.connect(function(passwords) {
|
Pass.onLsSucceed.connect(function(passwords) {
|
||||||
@ -193,12 +174,10 @@ Page {
|
|||||||
|
|
||||||
ErrorDialog {
|
ErrorDialog {
|
||||||
textError: i18n.tr("Decryption failed !")
|
textError: i18n.tr("Decryption failed !")
|
||||||
textErrorDescription: __text_error_description
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: searchTimer
|
id: searchTimer
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import "../../components"
|
|||||||
import Pass 1.0
|
import Pass 1.0
|
||||||
|
|
||||||
ImportFile {
|
ImportFile {
|
||||||
|
|
||||||
id: importKeyFilePage
|
id: importKeyFilePage
|
||||||
|
|
||||||
headerTitle: i18n.tr("GPG Key Import")
|
headerTitle: i18n.tr("GPG Key Import")
|
||||||
@ -22,21 +23,9 @@ ImportFile {
|
|||||||
importKeyFilePage.activeTransfer = null;
|
importKeyFilePage.activeTransfer = null;
|
||||||
PopupUtils.open(importKeyFilePage.dialogImportKeyPageSucess);
|
PopupUtils.open(importKeyFilePage.dialogImportKeyPageSucess);
|
||||||
});
|
});
|
||||||
Pass.importGPGKeyFailed.connect(function(err, message) {
|
Pass.importGPGKeyFailed.connect(function(message) {
|
||||||
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
|
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
|
||||||
importKeyFilePage.activeTransfer = null;
|
importKeyFilePage.activeTransfer = null;
|
||||||
switch (code) {
|
|
||||||
case 1: // UnexceptedError -> use the default (not translate) rnp error
|
|
||||||
__text_error_description = message;
|
|
||||||
break;
|
|
||||||
case 2: // BadFormat
|
|
||||||
__text_error_description = i18n.tr("The file is not in a valid key format");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.warn("Unhandled error code");
|
|
||||||
__text_error_description = message;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
PopupUtils.open(importKeyFilePage.dialogImportKeyPageError);
|
PopupUtils.open(importKeyFilePage.dialogImportKeyPageError);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user