File indexing completed on 2024-05-05 05:50:39
0001 /* 0002 SPDX-FileCopyrightText: 2016 Elvis Angelaccio <elvis.angelaccio@kde.org> 0003 0004 SPDX-License-Identifier: BSD-2-Clause 0005 */ 0006 0007 #ifndef ARCHIVEFORMAT_H 0008 #define ARCHIVEFORMAT_H 0009 0010 #include "archive_kerfuffle.h" 0011 0012 #include <KPluginMetaData> 0013 0014 namespace Kerfuffle 0015 { 0016 class KERFUFFLE_EXPORT ArchiveFormat 0017 { 0018 public: 0019 explicit ArchiveFormat(); 0020 explicit ArchiveFormat(const QMimeType &mimeType, 0021 Kerfuffle::Archive::EncryptionType encryptionType, 0022 int minCompLevel, 0023 int maxCompLevel, 0024 int defaultCompLevel, 0025 bool supportsWriteComment, 0026 bool supportsTesting, 0027 bool suppportsMultiVolume, 0028 const QVariantMap &compressionMethods, 0029 const QString &defaultCompressionMethod, 0030 const QStringList &encryptionMethods, 0031 const QString &defaultEncryptionMethod); 0032 0033 /** 0034 * @return The archive format of the given @p mimeType, according to the given @p metadata. 0035 */ 0036 static ArchiveFormat fromMetadata(const QMimeType &mimeType, const KPluginMetaData &metadata); 0037 0038 /** 0039 * @return Whether the format is associated to a valid mimetype. 0040 */ 0041 bool isValid() const; 0042 0043 /** 0044 * @return The encryption type supported by the archive format. 0045 */ 0046 Kerfuffle::Archive::EncryptionType encryptionType() const; 0047 0048 int minCompressionLevel() const; 0049 int maxCompressionLevel() const; 0050 int defaultCompressionLevel() const; 0051 bool supportsWriteComment() const; 0052 bool supportsTesting() const; 0053 bool supportsMultiVolume() const; 0054 QVariantMap compressionMethods() const; 0055 QString defaultCompressionMethod() const; 0056 QStringList encryptionMethods() const; 0057 QString defaultEncryptionMethod() const; 0058 0059 private: 0060 QMimeType m_mimeType; 0061 Kerfuffle::Archive::EncryptionType m_encryptionType = Kerfuffle::Archive::Unencrypted; 0062 int m_minCompressionLevel = -1; 0063 int m_maxCompressionLevel = 0; 0064 int m_defaultCompressionLevel = 0; 0065 bool m_supportsWriteComment = false; 0066 bool m_supportsTesting = false; 0067 bool m_supportsMultiVolume = false; 0068 QVariantMap m_compressionMethods; 0069 QString m_defaultCompressionMethod; 0070 QStringList m_encryptionMethods; 0071 QString m_defaultEncryptionMethod; 0072 }; 0073 0074 } 0075 0076 #endif // ARCHIVEFORMAT_H