File indexing completed on 2024-04-21 16:35:04

0001 /*
0002  * SPDX-FileCopyrightText: 2017 Elvis Angelaccio <elvis.angelaccio@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  *
0006  */
0007 
0008 #pragma once
0009 
0010 #include "job.h"
0011 
0012 #include <gpgme++/error.h>
0013 #include <gpgme++/encryptionresult.h>
0014 
0015 class QFile;
0016 class QTemporaryFile;
0017 
0018 namespace Symmy
0019 {
0020 
0021 class EncryptJob : public Job
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit EncryptJob(const QString &passphrase, const QString &plaintextFilename);
0027     ~EncryptJob() override;
0028 
0029     QString ciphertextFilename() const override;
0030     QString plaintextFilename() const override;
0031 
0032 private slots:
0033     void doWork() override;
0034     void slotResult(const GpgME::EncryptionResult &, const QByteArray &, const QString & = {}, const GpgME::Error & = {});
0035 
0036 private:
0037     std::shared_ptr<QFile> m_plaintext;
0038     std::shared_ptr<QTemporaryFile> m_ciphertext;
0039 };
0040 
0041 }