1
0
mirror of https://github.com/QRouland/UTPass.git synced 2026-01-10 19:36:57 +00:00

Rewrite get all key with rnp

This commit is contained in:
2025-02-01 13:45:55 +01:00
parent 74a001eefc
commit b9b038b1ae
13 changed files with 327 additions and 240 deletions

View File

@@ -2,13 +2,11 @@
#define GETKEYSJOB_H
#include <QJsonDocument>
#include "rnpjob.h"
/**
* @class GetKeysJob
* @brief A class to handle get all gpg keys from rings in a separate thread.
* @brief A job to retrieve all GPG keys from keyrings in a separate thread.
*
*/
class GetKeysJob : public RnpJob
@@ -16,21 +14,44 @@ class GetKeysJob : public RnpJob
Q_OBJECT
/**
* @brief The main function that performs the get all keys operation.
* @brief Executes the process of fetching all GPG keys.
*
* Handles the process of removing recursively a target path.
* This function performs the task of retrieving all keys from the keyrings. It is executed
* in a separate thread to avoid blocking the main application thread.
*/
void run() override;
signals:
void resultError(const rnp_result_t err);
void resultSuccess(const QSet<QString> result);
/**
* @brief Emitted when the key retrieval operation completes successfully.
*
* This signal is emitted when the keys are successfully fetched. It passes a list of
* JSON documents representing the retrieved keys.
*
* @param result A list of QJsonDocument objects containing the key information.
*/
void resultSuccess(const QList<QJsonDocument> result);
private:
/**
* @brief Retrieves key information for a specific key fingerprint.
*
* This helper function fetches the key data corresponding to the given fingerprint.
* The returned information is packaged in a JSON document.
*
* @param fingerprint The fingerprint of the key to fetch information for.
* @return A QJsonDocument containing the key's information.
*/
QJsonDocument fingerprint_map_key_info(const QString fingerprint);
public:
/**
* @brief Constructor for the GetKeysJob class.
* @brief Constructs a GetKeysJob object with the specified keyring directory.
*
* @param rnp_homedir Rnp home dir that contains the keyrings.
* This constructor initializes the job with the directory containing the keyrings to
* search for GPG keys.
*
* @param rnp_homedir The directory that contains the keyrings.
*/
GetKeysJob(QDir rnp_homedir);
};