File indexing completed on 2024-04-21 05:54:08

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 <KCompositeJob>
0011 
0012 #include <QDialog>
0013 #include <QPointer>
0014 
0015 namespace Symmy
0016 {
0017 
0018 class CompositeJob : public KCompositeJob
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023 
0024     enum class Task
0025     {
0026         Encryption,
0027         Decryption
0028     };
0029 
0030     explicit CompositeJob(const QStringList &filenames, Task task);
0031     ~CompositeJob() override;
0032 
0033     void start() override;
0034 
0035 protected:
0036     bool doKill() override;
0037 
0038 protected slots:
0039     void slotResult(KJob *job) override;
0040 
0041 private slots:
0042     void slotAccepted();
0043     void slotRejected();
0044     void slotStart();
0045     void slotPercent(KJob *, unsigned long percent);
0046 
0047 private:
0048     void startSubjob();
0049     QStringList filenames() const;
0050     Task task() const;
0051 
0052     QStringList m_filenames;
0053     QStringList m_failedDecryptions;
0054     Task m_task;
0055     QPointer<QDialog> m_passwordDialog;
0056 };
0057 
0058 }