File indexing completed on 2024-04-21 05:50:44
0001 /* 0002 SPDX-FileCopyrightText: 2011, 2012, 2013 Rolf Eike Beer <kde@opensource.sf-tec.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef FOLDERCOMPRESSJOB_H 0007 #define FOLDERCOMPRESSJOB_H 0008 0009 #include <KJob> 0010 #include <QUrl> 0011 #include <QStringList> 0012 0013 class QTemporaryFile; 0014 class QString; 0015 0016 #include "transactions/kgpgencrypt.h" 0017 0018 class FolderCompressJobPrivate; 0019 0020 /** 0021 * @brief Create an encrypted archive of the given folders 0022 * 0023 * @author Rolf Eike Beer 0024 */ 0025 class FolderCompressJob : public KJob { 0026 Q_OBJECT 0027 0028 Q_DISABLE_COPY(FolderCompressJob) 0029 FolderCompressJob() = delete; 0030 0031 FolderCompressJobPrivate * const d_ptr; 0032 Q_DECLARE_PRIVATE(FolderCompressJob) 0033 0034 public: 0035 /** 0036 * @brief create a new KJob to compress and encrypt a folder 0037 * @param parent object owning this job 0038 * @param sources the source directories to include 0039 * @param dest the name of the encrypted file 0040 * @param tempfile the temporary file that should be used for archiving 0041 * @param keys the public key ids to encrypt to 0042 * @param options special options to pass to the GnuPG process 0043 * @param encOptions special options to pass to the GnuPG process 0044 * @param archive the archive type to use 0045 */ 0046 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); 0047 0048 /** 0049 * @brief FolderCompressJob destructor 0050 */ 0051 ~FolderCompressJob() override; 0052 0053 /** 0054 * @brief shows the progress indicator 0055 */ 0056 void start() override; 0057 0058 /** 0059 * @brief query extension for archive type 0060 * @param archive the archive type 0061 * @return the extension including leading dot 0062 */ 0063 static QString extensionForArchive(const int archive); 0064 0065 /** 0066 * @brief get list of supported archive names 0067 * @return list of archive names 0068 */ 0069 static const QStringList &archiveNames(); 0070 0071 private Q_SLOTS: 0072 void doWork(); 0073 void slotEncryptionDone(int result); 0074 }; 0075 0076 #endif /* FOLDERCOMPRESSJOB_H */