1 /*
2     SPDX-FileCopyrightText: 2011, 2012, 2013 Rolf Eike Beer <kde@opensource.sf-tec.de>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #ifndef FOLDERCOMPRESSJOB_H
7 #define FOLDERCOMPRESSJOB_H
8 
9 #include <KJob>
10 #include <QUrl>
11 
12 class QTemporaryFile;
13 class QString;
14 class QStringList;
15 
16 #include "transactions/kgpgencrypt.h"
17 
18 class FolderCompressJobPrivate;
19 
20 /**
21  * @brief Create an encrypted archive of the given folders
22  *
23  * @author Rolf Eike Beer
24  */
25 class FolderCompressJob : public KJob {
26 	Q_OBJECT
27 
28 	Q_DISABLE_COPY(FolderCompressJob)
29 	FolderCompressJob() = delete;
30 
31 	FolderCompressJobPrivate * const d_ptr;
32 	Q_DECLARE_PRIVATE(FolderCompressJob)
33 
34 public:
35 	/**
36 	 * @brief create a new KJob to compress and encrypt a folder
37 	 * @param parent object owning this job
38 	 * @param sources the source directories to include
39 	 * @param dest the name of the encrypted file
40 	 * @param tempfile the temporary file that should be used for archiving
41 	 * @param keys the public key ids to encrypt to
42 	 * @param options special options to pass to the GnuPG process
43 	 * @param encOptions special options to pass to the GnuPG process
44 	 * @param archive the archive type to use
45 	 */
46 	FolderCompressJob(QObject *parent, const QList<QUrl> &sources, const QUrl &dest, QTemporaryFile *tempfile, const QStringList &keys, const QStringList &options, const KGpgEncrypt::EncryptOptions encOptions, const int archive);
47 
48 	/**
49 	 * @brief FolderCompressJob destructor
50 	 */
51         ~FolderCompressJob() override;
52 
53 	/**
54 	 * @brief shows the progress indicator
55 	 */
56         void start() override;
57 
58 	/**
59 	 * @brief query extension for archive type
60 	 * @param archive the archive type
61 	 * @return the extension including leading dot
62 	 */
63 	static QString extensionForArchive(const int archive);
64 
65 	/**
66 	 * @brief get list of supported archive names
67 	 * @return list of archive names
68 	 */
69 	static const QStringList &archiveNames();
70 
71 private Q_SLOTS:
72 	void doWork();
73 	void slotEncryptionDone(int result);
74 };
75 
76 #endif /* FOLDERCOMPRESSJOB_H */
77