Commit cb010aa1 authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent 7b1fe272
...@@ -58,7 +58,7 @@ JSONParser::JSONArchive JSONParser::createJSONArchive(const QVariant &json) ...@@ -58,7 +58,7 @@ JSONParser::JSONArchive JSONParser::createJSONArchive(const QVariant &json)
for (const QVariant &entry : jsonList) { for (const QVariant &entry : jsonList) {
const QVariantMap entryMap = entry.toMap(); const QVariantMap entryMap = entry.toMap();
if (!entryMap.contains(QLatin1String("fullPath"))) { if (!entryMap.contains(QStringLiteral("fullPath"))) {
continue; continue;
} }
......
...@@ -452,7 +452,7 @@ CopyJob* Archive::copyFiles(const QVector<Archive::Entry*> &files, Archive::Entr ...@@ -452,7 +452,7 @@ CopyJob* Archive::copyFiles(const QVector<Archive::Entry*> &files, Archive::Entr
return newJob; return newJob;
} }
ExtractJob* Archive::extractFiles(const QVector<Archive::Entry*> &files, const QString &destinationDir, const ExtractionOptions &options) ExtractJob* Archive::extractFiles(const QVector<Archive::Entry*> &files, const QString &destinationDir, ExtractionOptions options)
{ {
if (!isValid()) { if (!isValid()) {
return nullptr; return nullptr;
......
...@@ -197,7 +197,7 @@ public: ...@@ -197,7 +197,7 @@ public:
*/ */
CopyJob* copyFiles(const QVector<Archive::Entry*> &files, Archive::Entry *destination, const CompressionOptions& options = CompressionOptions()); CopyJob* copyFiles(const QVector<Archive::Entry*> &files, Archive::Entry *destination, const CompressionOptions& options = CompressionOptions());
ExtractJob* extractFiles(const QVector<Archive::Entry*> &files, const QString &destinationDir, const ExtractionOptions &options = ExtractionOptions()); ExtractJob* extractFiles(const QVector<Archive::Entry*> &files, const QString &destinationDir, ExtractionOptions options = ExtractionOptions());
PreviewJob* preview(Archive::Entry *entry); PreviewJob* preview(Archive::Entry *entry);
OpenJob* open(Archive::Entry *entry); OpenJob* open(Archive::Entry *entry);
......
...@@ -503,7 +503,7 @@ bool CreateJob::doKill() ...@@ -503,7 +503,7 @@ bool CreateJob::doKill()
return m_addJob && m_addJob->kill(); return m_addJob && m_addJob->kill();
} }
ExtractJob::ExtractJob(const QVector<Archive::Entry*> &entries, const QString &destinationDir, const ExtractionOptions &options, ReadOnlyArchiveInterface *interface) ExtractJob::ExtractJob(const QVector<Archive::Entry*> &entries, const QString &destinationDir, ExtractionOptions options, ReadOnlyArchiveInterface *interface)
: Job(interface) : Job(interface)
, m_entries(entries) , m_entries(entries)
, m_destinationDir(destinationDir) , m_destinationDir(destinationDir)
......
...@@ -225,7 +225,7 @@ class KERFUFFLE_EXPORT ExtractJob : public Job ...@@ -225,7 +225,7 @@ class KERFUFFLE_EXPORT ExtractJob : public Job
Q_OBJECT Q_OBJECT
public: public:
ExtractJob(const QVector<Archive::Entry*> &entries, const QString& destinationDir, const ExtractionOptions& options, ReadOnlyArchiveInterface *interface); ExtractJob(const QVector<Archive::Entry*> &entries, const QString& destinationDir, ExtractionOptions options, ReadOnlyArchiveInterface *interface);
QString destinationDirectory() const; QString destinationDirectory() const;
ExtractionOptions extractionOptions() const; ExtractionOptions extractionOptions() const;
......
...@@ -148,7 +148,7 @@ QDebug operator<<(QDebug d, const CompressionOptions &options) ...@@ -148,7 +148,7 @@ QDebug operator<<(QDebug d, const CompressionOptions &options)
return d.space(); return d.space();
} }
QDebug operator<<(QDebug d, const ExtractionOptions &options) QDebug operator<<(QDebug d, ExtractionOptions options)
{ {
d.nospace() << "(encryption hint: " << options.encryptedArchiveHint(); d.nospace() << "(encryption hint: " << options.encryptedArchiveHint();
d.nospace() << ", preserve paths: " << options.preservePaths(); d.nospace() << ", preserve paths: " << options.preservePaths();
......
...@@ -113,7 +113,7 @@ private: ...@@ -113,7 +113,7 @@ private:
}; };
QDebug KERFUFFLE_EXPORT operator<<(QDebug d, const CompressionOptions &options); QDebug KERFUFFLE_EXPORT operator<<(QDebug d, const CompressionOptions &options);
QDebug KERFUFFLE_EXPORT operator<<(QDebug d, const ExtractionOptions &options); QDebug KERFUFFLE_EXPORT operator<<(QDebug d, ExtractionOptions options);
} }
......
...@@ -628,13 +628,13 @@ KJob *ArchiveModel::loadArchive(const QString &path, const QString &mimeType, QO ...@@ -628,13 +628,13 @@ KJob *ArchiveModel::loadArchive(const QString &path, const QString &mimeType, QO
return loadJob; return loadJob;
} }
ExtractJob* ArchiveModel::extractFile(Archive::Entry *file, const QString& destinationDir, const Kerfuffle::ExtractionOptions& options) const ExtractJob* ArchiveModel::extractFile(Archive::Entry *file, const QString& destinationDir, Kerfuffle::ExtractionOptions options) const
{ {
QVector<Archive::Entry*> files({file}); QVector<Archive::Entry*> files({file});
return extractFiles(files, destinationDir, options); return extractFiles(files, destinationDir, options);
} }
ExtractJob* ArchiveModel::extractFiles(const QVector<Archive::Entry*>& files, const QString& destinationDir, const Kerfuffle::ExtractionOptions& options) const ExtractJob* ArchiveModel::extractFiles(const QVector<Archive::Entry*>& files, const QString& destinationDir, Kerfuffle::ExtractionOptions options) const
{ {
Q_ASSERT(m_archive); Q_ASSERT(m_archive);
ExtractJob *newJob = m_archive->extractFiles(files, destinationDir, options); ExtractJob *newJob = m_archive->extractFiles(files, destinationDir, options);
......
...@@ -91,8 +91,8 @@ public: ...@@ -91,8 +91,8 @@ public:
Archive::Entry *entryForIndex(const QModelIndex &index); Archive::Entry *entryForIndex(const QModelIndex &index);
Kerfuffle::ExtractJob* extractFile(Archive::Entry *file, const QString& destinationDir, const Kerfuffle::ExtractionOptions& options = Kerfuffle::ExtractionOptions()) const; Kerfuffle::ExtractJob* extractFile(Archive::Entry *file, const QString& destinationDir, Kerfuffle::ExtractionOptions options = Kerfuffle::ExtractionOptions()) const;
Kerfuffle::ExtractJob* extractFiles(const QVector<Archive::Entry*>& files, const QString& destinationDir, const Kerfuffle::ExtractionOptions& options = Kerfuffle::ExtractionOptions()) const; Kerfuffle::ExtractJob* extractFiles(const QVector<Archive::Entry*>& files, const QString& destinationDir, Kerfuffle::ExtractionOptions options = Kerfuffle::ExtractionOptions()) const;
Kerfuffle::PreviewJob* preview(Archive::Entry *file) const; Kerfuffle::PreviewJob* preview(Archive::Entry *file) const;
Kerfuffle::OpenJob* open(Archive::Entry *file) const; Kerfuffle::OpenJob* open(Archive::Entry *file) const;
......
...@@ -594,7 +594,7 @@ void Part::createArchive() ...@@ -594,7 +594,7 @@ void Part::createArchive()
const QString fixedMimeType = arguments().metaData()[QStringLiteral("fixedMimeType")]; const QString fixedMimeType = arguments().metaData()[QStringLiteral("fixedMimeType")];
m_model->createEmptyArchive(localFilePath(), fixedMimeType, m_model); m_model->createEmptyArchive(localFilePath(), fixedMimeType, m_model);
if (arguments().metaData().contains(QLatin1String("volumeSize"))) { if (arguments().metaData().contains(QStringLiteral("volumeSize"))) {
m_model->archive()->setMultiVolume(true); m_model->archive()->setMultiVolume(true);
} }
...@@ -750,16 +750,16 @@ QModelIndexList Part::getSelectedIndexes() ...@@ -750,16 +750,16 @@ QModelIndexList Part::getSelectedIndexes()
void Part::readCompressionOptions() void Part::readCompressionOptions()
{ {
// Store options from CreateDialog if they are set. // Store options from CreateDialog if they are set.
if (!m_compressionOptions.isCompressionLevelSet() && arguments().metaData().contains(QLatin1String("compressionLevel"))) { if (!m_compressionOptions.isCompressionLevelSet() && arguments().metaData().contains(QStringLiteral("compressionLevel"))) {
m_compressionOptions.setCompressionLevel(arguments().metaData()[QStringLiteral("compressionLevel")].toInt()); m_compressionOptions.setCompressionLevel(arguments().metaData()[QStringLiteral("compressionLevel")].toInt());
} }
if (m_compressionOptions.compressionMethod().isEmpty() && arguments().metaData().contains(QLatin1String("compressionMethod"))) { if (m_compressionOptions.compressionMethod().isEmpty() && arguments().metaData().contains(QStringLiteral("compressionMethod"))) {
m_compressionOptions.setCompressionMethod(arguments().metaData()[QStringLiteral("compressionMethod")]); m_compressionOptions.setCompressionMethod(arguments().metaData()[QStringLiteral("compressionMethod")]);
} }
if (m_compressionOptions.encryptionMethod().isEmpty() && arguments().metaData().contains(QLatin1String("encryptionMethod"))) { if (m_compressionOptions.encryptionMethod().isEmpty() && arguments().metaData().contains(QStringLiteral("encryptionMethod"))) {
m_compressionOptions.setEncryptionMethod(arguments().metaData()[QStringLiteral("encryptionMethod")]); m_compressionOptions.setEncryptionMethod(arguments().metaData()[QStringLiteral("encryptionMethod")]);
} }
if (!m_compressionOptions.isVolumeSizeSet() && arguments().metaData().contains(QLatin1String("volumeSize"))) { if (!m_compressionOptions.isVolumeSizeSet() && arguments().metaData().contains(QStringLiteral("volumeSize"))) {
m_compressionOptions.setVolumeSize(arguments().metaData()[QStringLiteral("volumeSize")].toULong()); m_compressionOptions.setVolumeSize(arguments().metaData()[QStringLiteral("volumeSize")].toULong());
} }
......
...@@ -912,7 +912,7 @@ bool LibzipPlugin::copyFiles(const QVector<Archive::Entry*> &files, Archive::Ent ...@@ -912,7 +912,7 @@ bool LibzipPlugin::copyFiles(const QVector<Archive::Entry*> &files, Archive::Ent
return true; return true;
} }
QString LibzipPlugin::permissionsToString(const mode_t &perm) QString LibzipPlugin::permissionsToString(mode_t perm)
{ {
QString modeval; QString modeval;
if ((perm & S_IFMT) == S_IFDIR) { if ((perm & S_IFMT) == S_IFDIR) {
......
...@@ -58,7 +58,7 @@ private: ...@@ -58,7 +58,7 @@ private:
bool writeEntry(zip_t *archive, const QString &entry, const Archive::Entry* destination, const CompressionOptions& options, bool isDir = false); bool writeEntry(zip_t *archive, const QString &entry, const Archive::Entry* destination, const CompressionOptions& options, bool isDir = false);
bool emitEntryForIndex(zip_t *archive, qlonglong index); bool emitEntryForIndex(zip_t *archive, qlonglong index);
void emitProgress(double percentage); void emitProgress(double percentage);
QString permissionsToString(const mode_t &perm); QString permissionsToString(mode_t perm);
static void progressCallback(zip_t *, double progress, void *that); static void progressCallback(zip_t *, double progress, void *that);
QVector<Archive::Entry*> m_emittedEntries; QVector<Archive::Entry*> m_emittedEntries;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment