Commit d276989c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

USe KDEFrameworkCompilerSettings

parent 68641cf5
......@@ -15,19 +15,14 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modul
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(GenerateExportHeader)
include(FeatureSummary)
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
add_definitions(-DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
ecm_setup_version(PROJECT
VARIABLE_PREFIX ARK
......
......@@ -181,7 +181,7 @@ public:
*/
void setPreservePaths(bool value);
private slots:
private Q_SLOTS:
/**
* Updates the percentage of the job that has been completed.
*/
......
......@@ -30,7 +30,7 @@ class ExtractHereDndPlugin : public KIO::DndPopupMenuPlugin
{
Q_OBJECT
private slots:
private Q_SLOTS:
void slotTriggered();
public:
......
......@@ -44,14 +44,14 @@ public:
void dropEvent(class QDropEvent * event) override;
void dragMoveEvent(class QDragMoveEvent * event) override;
public slots:
public Q_SLOTS:
void openUrl(const QUrl &url);
void setShowExtractDialog(bool);
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
private Q_SLOTS:
void updateActions();
void newArchive();
void openArchive();
......
......@@ -487,7 +487,7 @@ void ExtractTest::testPreservePermissions_data()
const auto mime = QMimeDatabase().mimeTypeForFile(filename, QMimeDatabase::MatchExtension);
const auto plugins = m_pluginManager.preferredWritePluginsFor(mime);
foreach (const auto plugin, plugins) {
QTest::newRow(QStringLiteral("test preserve 0755 permissions (%1, %2)").arg(format, plugin->metaData().pluginId()).toUtf8())
QTest::newRow(QStringLiteral("test preserve 0755 permissions (%1, %2)").arg(format, plugin->metaData().pluginId()).toUtf8().constData())
<< filename
<< plugin
<< QStringLiteral("0755.sh")
......
......@@ -67,8 +67,8 @@ JSONParser::JSONArchive JSONParser::createJSONArchive(const QVariant &json)
QVariantMap::const_iterator entryIterator = entryMap.constBegin();
for (; entryIterator != entryMap.constEnd(); ++entryIterator) {
const QByteArray key = entryIterator.key().toUtf8();
if (e->property(key).isValid()) {
e->setProperty(key, entryIterator.value());
if (e->property(key.constData()).isValid()) {
e->setProperty(key.constData(), entryIterator.value());
} else {
qDebug() << entryIterator.key() << "is not a valid entry key";
}
......
......@@ -54,7 +54,7 @@ void AbstractAddTest::setupRows(const QString &testName, const QString &archiveN
const auto plugins = m_pluginManager.preferredWritePluginsFor(mime);
foreach (const auto plugin, plugins) {
QTest::newRow(QStringLiteral("%1 (%2, %3)").arg(testName, format, plugin->metaData().pluginId()).toUtf8())
QTest::newRow(QStringLiteral("%1 (%2, %3)").arg(testName, format, plugin->metaData().pluginId()).toUtf8().constData())
<< filename
<< plugin
<< targetEntries
......
......@@ -39,6 +39,6 @@ namespace TestHelper
* @return List of format extensions (without the leading dot) to be used in tests.
*/
QStringList testFormats();
};
}
#endif //TESTHELPER_H
......@@ -60,7 +60,7 @@ private:
QMimeType m_mimeType;
CompressionOptions m_compOptions;
public slots:
public Q_SLOTS:
void slotOpenOptions();
};
}
......
......@@ -63,7 +63,7 @@ public:
void setChangeToFirstPath(bool value);
QString detectBaseName(const QVector<Archive::Entry*> &entries) const;
public slots:
public Q_SLOTS:
bool addInput(const QUrl &url);
void setAutoFilenameSuffix(const QString& suffix);
void setFilename(const QUrl &path);
......@@ -75,7 +75,7 @@ public slots:
protected:
bool doKill() override;
private slots:
private Q_SLOTS:
void slotFinished(KJob*);
void slotStartJob();
......
......@@ -209,7 +209,7 @@ public:
*/
void encrypt(const QString &password, bool encryptHeader);
private slots:
private Q_SLOTS:
void onAddFinished(KJob*);
void onUserQuery(Kerfuffle::Query*);
void onCompressionMethodFound(const QString &method);
......
......@@ -168,7 +168,7 @@ public:
*/
virtual bool hasBatchExtractionProgress() const;
signals:
Q_SIGNALS:
/**
* Emitted when the user cancels the operation. Examples:
......@@ -214,7 +214,7 @@ private:
bool m_isCorrupt;
bool m_isMultiVolume;
private slots:
private Q_SLOTS:
void onEntry(Archive::Entry *archiveEntry);
};
......@@ -246,10 +246,10 @@ public:
virtual bool deleteFiles(const QVector<Archive::Entry*> &files) = 0;
virtual bool addComment(const QString &comment) = 0;
signals:
Q_SIGNALS:
void entryRemoved(const QString &path);
private slots:
private Q_SLOTS:
void onEntryRemoved(const QString &path);
};
......
......@@ -154,7 +154,7 @@ protected:
bool m_abortingOperation = false;
protected slots:
protected Q_SLOTS:
virtual void readStdout(bool handleAll = false);
private:
......@@ -217,10 +217,10 @@ private:
qulonglong m_archiveSizeOnDisk = 0;
qulonglong m_listedSize = 0;
protected slots:
protected Q_SLOTS:
virtual void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
private slots:
private Q_SLOTS:
void extractProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void continueCopying(bool result);
void onEntry(Archive::Entry *archiveEntry);
......
......@@ -65,7 +65,7 @@ private:
QMimeType m_mimetype;
CompressionOptions m_opts;
private slots:
private Q_SLOTS:
void slotMultiVolumeChecked(int state);
void slotCompMethodChanged(const QString &value);
void slotEncryptionMethodChanged(const QString &value);
......
......@@ -83,7 +83,7 @@ public:
*/
bool isHeaderEncryptionEnabled() const;
public slots:
public Q_SLOTS:
void accept() override;
private:
......@@ -95,7 +95,7 @@ private:
QStringList m_supportedMimeTypes;
PluginManager m_pluginManger;
private slots:
private Q_SLOTS:
void slotFileNameEdited(const QString &text);
void slotUpdateWidgets(int index);
void slotUpdateDefaultMimeType();
......
......@@ -68,10 +68,10 @@ protected:
void connectToArchiveInterfaceSignals();
public slots:
public Q_SLOTS:
virtual void doWork() = 0;
protected slots:
protected Q_SLOTS:
virtual void onCancelled();
virtual void onError(const QString &message, const QString &details);
virtual void onInfo(const QString &info);
......@@ -81,7 +81,7 @@ protected slots:
virtual void onFinished(bool result);
virtual void onUserQuery(Query *query);
signals:
Q_SIGNALS:
void entryRemoved(const QString & entry);
void newEntry(Archive::Entry*);
void userQuery(Kerfuffle::Query*);
......@@ -125,10 +125,10 @@ public:
bool isSingleFolderArchive() const;
QString subfolderName() const;
public slots:
public Q_SLOTS:
void doWork() override;
protected slots:
protected Q_SLOTS:
void onFinished(bool result) override;
private:
......@@ -142,7 +142,7 @@ private:
qlonglong m_dirCount;
qlonglong m_filesCount;
private slots:
private Q_SLOTS:
void onNewEntry(const Archive::Entry*);
};
......@@ -158,13 +158,13 @@ class KERFUFFLE_EXPORT BatchExtractJob : public Job
public:
explicit BatchExtractJob(LoadJob *loadJob, const QString &destination, bool autoSubfolder, bool preservePaths);
public slots:
public Q_SLOTS:
void doWork() override;
protected:
bool doKill() override;
private slots:
private Q_SLOTS:
void slotLoadingProgress(double progress);
void slotExtractProgress(double progress);
void slotLoadingFinished(KJob *job);
......@@ -208,7 +208,7 @@ public:
*/
void setMultiVolume(bool isMultiVolume);
public slots:
public Q_SLOTS:
void doWork() override;
protected:
......@@ -230,7 +230,7 @@ public:
QString destinationDirectory() const;
ExtractionOptions extractionOptions() const;
public slots:
public Q_SLOTS:
void doWork() override;
private:
......@@ -266,7 +266,7 @@ public:
*/
QTemporaryDir *tempDir() const;
public slots:
public Q_SLOTS:
void doWork() override;
private:
......@@ -316,10 +316,10 @@ class KERFUFFLE_EXPORT AddJob : public Job
public:
AddJob(const QVector<Archive::Entry*> &files, const Archive::Entry *destination, const CompressionOptions& options, ReadWriteArchiveInterface *interface);
public slots:
public Q_SLOTS:
void doWork() override;
protected slots:
protected Q_SLOTS:
void onFinished(bool result) override;
private:
......@@ -340,10 +340,10 @@ Q_OBJECT
public:
MoveJob(const QVector<Archive::Entry*> &files, Archive::Entry *destination, const CompressionOptions& options, ReadWriteArchiveInterface *interface);
public slots:
public Q_SLOTS:
void doWork() override;
protected slots:
protected Q_SLOTS:
void onFinished(bool result) override;
private:
......@@ -364,10 +364,10 @@ Q_OBJECT
public:
CopyJob(const QVector<Archive::Entry*> &entries, Archive::Entry *destination, const CompressionOptions& options, ReadWriteArchiveInterface *interface);
public slots:
public Q_SLOTS:
void doWork() override;
protected slots:
protected Q_SLOTS:
void onFinished(bool result) override;
private:
......@@ -384,7 +384,7 @@ class KERFUFFLE_EXPORT DeleteJob : public Job
public:
DeleteJob(const QVector<Archive::Entry*> &files, ReadWriteArchiveInterface *interface);
public slots:
public Q_SLOTS:
void doWork() override;
private:
......@@ -398,7 +398,7 @@ class KERFUFFLE_EXPORT CommentJob : public Job
public:
CommentJob(const QString& comment, ReadWriteArchiveInterface *interface);
public slots:
public Q_SLOTS:
void doWork() override;
private:
......@@ -413,10 +413,10 @@ public:
explicit TestJob(ReadOnlyArchiveInterface *interface);
bool testSucceeded();
public slots:
public Q_SLOTS:
void doWork() override;
private slots:
private Q_SLOTS:
virtual void onTestSuccess();
private:
......
......@@ -98,7 +98,7 @@ public:
*/
bool isValid() const;
signals:
Q_SIGNALS:
void enabledChanged();
private:
......
......@@ -43,11 +43,11 @@ class KERFUFFLE_EXPORT PluginSettingsPage : public SettingsPage, public Ui::Plug
public:
explicit PluginSettingsPage(QWidget *parent = nullptr, const QString &name = QString(), const QString &iconName = QString());
public slots:
public Q_SLOTS:
void slotSettingsChanged() override;
void slotDefaultsButtonClicked() override;
private slots:
private Q_SLOTS:
void slotItemChanged(QTreeWidgetItem *item);
private:
......
......@@ -40,7 +40,7 @@ class KERFUFFLE_EXPORT PreviewSettingsPage : public SettingsPage, public Ui::Pre
public:
explicit PreviewSettingsPage(QWidget *parent = nullptr, const QString &name = QString(), const QString &iconName = QString());
private slots:
private Q_SLOTS:
void slotToggled(bool enabled);
};
}
......
......@@ -45,10 +45,10 @@ class KERFUFFLE_EXPORT SettingsDialog : public KConfigDialog
public:
explicit SettingsDialog(QWidget *parent, const QString &name, KCoreConfigSkeleton *config);
signals:
Q_SIGNALS:
void defaultsButtonClicked();
protected slots:
protected Q_SLOTS:
void updateWidgetsDefault() override;
};
......
......@@ -44,7 +44,7 @@ public:
QString name() const;
QString iconName() const;
public slots:
public Q_SLOTS:
virtual void slotSettingsChanged();
virtual void slotDefaultsButtonClicked();
......
......@@ -122,7 +122,7 @@ QVariant ArchiveModel::data(const QModelIndex &index, int role) const
}
default:
return entry->property(m_propertiesMap[column]);
return entry->property(m_propertiesMap[column].constData());
}
}
case Qt::DecorationRole:
......@@ -475,7 +475,7 @@ void ArchiveModel::newEntry(Archive::Entry *receivedEntry, InsertBehaviour behav
if (i.key() == Size && size == 0 && compressedSize > 0) {
continue;
}
if (!receivedEntry->property(i.value()).toString().isEmpty()) {
if (!receivedEntry->property(i.value().constData()).toString().isEmpty()) {
if (i.key() != CompressedSize || receivedEntry->compressedSizeIsSet) {
toInsert << i.key();
}
......
......@@ -138,7 +138,7 @@ public:
QMap<QString, Kerfuffle::Archive::Entry*> filesToMove;
QMap<QString, Kerfuffle::Archive::Entry*> filesToCopy;
signals:
Q_SIGNALS:
void loadingStarted();
void loadingFinished(KJob *);
void extractionFinished(bool success);
......@@ -146,7 +146,7 @@ signals:
void droppedFiles(const QStringList& files, const Archive::Entry*);
void messageWidget(KMessageWidget::MessageType type, const QString& msg);
private slots:
private Q_SLOTS:
void slotNewEntry(Archive::Entry *entry);
void slotListEntry(Archive::Entry *entry);
void slotLoadingFinished(KJob *job);
......
......@@ -52,12 +52,12 @@ bool ArchiveSortFilterModel::lessThan(const QModelIndex &leftIndex,
switch (col) {
case Size:
case CompressedSize:
if (left->property(property).toULongLong() < right->property(property).toULongLong()) {
if (left->property(property.constData()).toULongLong() < right->property(property.constData()).toULongLong()) {
return true;
}
break;
default:
if (left->property(property).toString() < right->property(property).toString()) {
if (left->property(property.constData()).toString() < right->property(property.constData()).toString()) {
return true;
}
}
......
......@@ -49,7 +49,7 @@ public:
*/
void setDropsEnabled(bool enabled);
public slots:
public Q_SLOTS:
void renameSelectedEntry();
protected:
......@@ -57,7 +57,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
signals:
Q_SIGNALS:
void entryChanged(const QString &name);
private:
......
......@@ -46,18 +46,18 @@ public:
QWidget *widget(KJob *) override;
public slots:
public Q_SLOTS:
void registerJob(KJob *job) override;
void unregisterJob(KJob *job) override;
protected slots:
protected Q_SLOTS:
void description(KJob *job, const QString &title, const QPair< QString, QString > &f1, const QPair< QString, QString > &f2) override;
void infoMessage(KJob *job, const QString &plain, const QString &rich) override;
void warning(KJob *job, const QString &plain, const QString &rich) override;
void percent(KJob *job, unsigned long percent) override;
private slots:
private Q_SLOTS:
void resetUi();
private:
......
......@@ -93,13 +93,13 @@ public:
*/
bool confirmAndDelete(const QString& targetFile);
public slots:
public Q_SLOTS:
void extractSelectedFilesTo(const QString& localPath);
protected:
void guiActivateEvent(KParts::GUIActivateEvent *event) override;
private slots:
private Q_SLOTS:
void slotCompleted();
void slotLoadingStarted();
void slotLoadingFinished(KJob *job);
......@@ -164,7 +164,7 @@ private slots:
void displayMsgWidget(KMessageWidget::MessageType type, const QString& msg);
void searchEdited(const QString &text);
signals:
Q_SIGNALS:
void busy();
void ready();
void quit();
......
......@@ -44,14 +44,14 @@ public:
*/
void setJsonOutput(const QString &jsonOutput);
protected slots:
protected Q_SLOTS:
void readStdout(bool handleAll = false) override;
protected:
bool handleLine(const QString& line) override;
private slots:
private Q_SLOTS:
void processFinished(int exitCode, QProcess::ExitStatus exitStatus) override;
private:
......
......@@ -42,7 +42,7 @@ public:
bool moveFiles(const QVector<Archive::Entry*> &files, Archive::Entry *destination, const CompressionOptions& options) override;
int moveRequiredSignals() const override;
private slots:
private Q_SLOTS:
void continueMoving(bool result);
private:
......
......@@ -422,7 +422,7 @@ bool LibarchivePlugin::initializeReader()
return false;
}
if (archive_read_open_filename(m_archiveReader.data(), QFile::encodeName(filename()), 10240) != ARCHIVE_OK) {
if (archive_read_open_filename(m_archiveReader.data(), QFile::encodeName(filename()).constData(), 10240) != ARCHIVE_OK) {
qCWarning(ARK) << "Could not open the archive:" << archive_error_string(m_archiveReader.data());
emit error(i18nc("@info", "Archive corrupted or insufficient permissions."));
return false;
......
......@@ -88,7 +88,7 @@ protected:
ArchiveRead m_archiveReader;
ArchiveRead m_archiveReadDisk;
private slots:
private Q_SLOTS:
void slotRestoreWorkingDir();
private:
......
......@@ -365,7 +365,7 @@ bool ReadWriteLibarchivePlugin::initializeNewFileWriterFilters(const Compression
// Set compression level if passed in CompressionOptions.
if (options.isCompressionLevelSet()) {
qCDebug(ARK) << "Using compression level:" << options.compressionLevel();
ret = archive_write_set_filter_option(m_archiveWriter.data(), nullptr, "compression-level", QString::number(options.compressionLevel()).toUtf8());
ret = archive_write_set_filter_option(m_archiveWriter.data(), nullptr, "compression-level", QString::number(options.compressionLevel()).toUtf8().constData());
if (ret != ARCHIVE_OK) {
qCWarning(ARK) << "Failed to set compression level" << archive_error_string(m_archiveWriter.data());
emit error(i18nc("@info", "Could not set the compression level."));
......@@ -425,7 +425,7 @@ bool ReadWriteLibarchivePlugin::processOldEntries(uint &entriesCounter, Operatio
iteratedEntries--;
// Change entry path.
archive_entry_set_pathname(entry, newPathname.toUtf8());
archive_entry_set_pathname(entry, newPathname.toUtf8().constData());
emitEntryFromArchiveEntry(entry);
}
} else if (m_filesPaths