2025-01-29 16:42:37 +01:00
|
|
|
#ifndef DECRYPTJOB_H
|
|
|
|
#define DECRYPTJOB_H
|
|
|
|
|
2025-02-01 13:45:55 +01:00
|
|
|
#include "rnpjob.h"
|
2025-01-29 16:42:37 +01:00
|
|
|
#include <QThread>
|
|
|
|
#include <QDir>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class DecryptJob
|
2025-02-01 13:45:55 +01:00
|
|
|
* @brief A job to handle the decryption of a file in a separate thread.
|
2025-01-29 16:42:37 +01:00
|
|
|
*
|
|
|
|
*/
|
2025-02-01 13:45:55 +01:00
|
|
|
class DecryptJob : public RnpJob
|
2025-01-29 16:42:37 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
/**
|
2025-02-01 13:45:55 +01:00
|
|
|
* @brief Executes the decryption operation.
|
2025-01-29 16:42:37 +01:00
|
|
|
*
|
2025-02-01 13:45:55 +01:00
|
|
|
* This method performs the actual decryption of the encrypted file specified during
|
|
|
|
* object construction. The operation is carried out in a separate background thread
|
|
|
|
* to prevent blocking the main application thread.
|
2025-01-29 16:42:37 +01:00
|
|
|
*/
|
|
|
|
void run() override;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
/**
|
2025-02-01 13:45:55 +01:00
|
|
|
* @brief Emitted when the decryption operation is complete.
|
2025-01-29 16:42:37 +01:00
|
|
|
*
|
2025-02-01 13:45:55 +01:00
|
|
|
* This signal is emitted once the decryption operation finishes, providing the results.
|
|
|
|
* It indicates whether the decryption was successful and provides the clear-text output
|
|
|
|
* if the decryption was successful.
|
|
|
|
*
|
|
|
|
* @param encrypted_file_path The path to the encrypted file that was decrypted.
|
|
|
|
* @param clear_txt The decrypted content in clear-text. If an error occurs, this may be empty.
|
2025-01-29 16:42:37 +01:00
|
|
|
*/
|
2025-02-03 17:48:30 +01:00
|
|
|
void resultSuccess(QString encrypted_file_path, QString clear_txt);
|
2025-01-29 16:42:37 +01:00
|
|
|
|
|
|
|
private:
|
2025-02-01 13:45:55 +01:00
|
|
|
QString m_encrypted_file_path; /**< The path to the encrypted file that is to be decrypted. */
|
2025-01-29 16:42:37 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
2025-02-01 13:45:55 +01:00
|
|
|
* @brief Constructs a DecryptJob object with the specified encrypted file.
|
2025-01-29 16:42:37 +01:00
|
|
|
*
|
2025-02-01 13:45:55 +01:00
|
|
|
* This constructor initializes the DecryptJob with the encrypted file path. The decryption
|
|
|
|
* operation will be executed in a background thread when the job is started.
|
2025-01-29 16:42:37 +01:00
|
|
|
*
|
2025-02-03 17:48:30 +01:00
|
|
|
* @param rnp_homedir The directory containing the keyrings.
|
2025-02-01 13:45:55 +01:00
|
|
|
* @param path The path to the encrypted file that needs to be decrypted.
|
2025-01-29 16:42:37 +01:00
|
|
|
*/
|
2025-02-03 17:48:30 +01:00
|
|
|
DecryptJob(QDir rnp_homedir, QString path);
|
2025-01-29 16:42:37 +01:00
|
|
|
};
|
|
|
|
|
2025-02-01 13:45:55 +01:00
|
|
|
#endif // DECRYPTJOB_H
|