File indexing completed on 2022-09-27 16:37:28

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 <KJob>
0011 
0012 #include <QPointer>
0013 
0014 #include <gpgme++/interfaces/passphraseprovider.h>
0015 
0016 namespace QGpgME
0017 {
0018 class Job;
0019 }
0020 
0021 namespace Symmy
0022 {
0023 
0024 class Job : public KJob,  public GpgME::PassphraseProvider
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit Job(const QString &passphrase);
0030     ~Job() override;
0031 
0032     char *getPassphrase(const char *, const char *, bool, bool &) override;
0033     void start() override;
0034     virtual QString ciphertextFilename() const = 0;
0035     virtual QString plaintextFilename() const = 0;
0036     QString passphrase() const;
0037 
0038 protected:
0039     bool doKill() override;
0040     void setJob(QGpgME::Job *job);
0041 
0042 private slots:
0043     virtual void doWork() = 0;
0044 
0045 private:
0046     QPointer<QGpgME::Job> m_job;
0047     QString m_passphrase;
0048 };
0049 
0050 }