Commit 2e33fde3 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

It compiles fine without foreach + deprecated method

parent 038cc6be
......@@ -35,6 +35,11 @@ include(KDECMakeSettings)
include(ECMQtDeclareLoggingCategory)
add_definitions(-DTRANSLATION_DOMAIN="libkmahjongg5")
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
if (${KF5Config_VERSION} STRGREATER "5.56.0")
add_definitions(-DQT_NO_FOREACH)
MESSAGE(STATUS "compile without foreach")
endif()
add_subdirectory(tilesets)
add_subdirectory(backgrounds)
......
......@@ -56,9 +56,9 @@ void KMahjonggBackgroundSelector::setupData(KConfigSkeleton * aconfig)
//Now get our backgrounds into a list
QStringList bgsAvailable;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kmahjongglib/backgrounds"), QStandardPaths::LocateDirectory);
Q_FOREACH (const QString & dir, dirs) {
for (const QString & dir : dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop"));
Q_FOREACH (const QString & file, fileNames) {
for (const QString & file : fileNames) {
bgsAvailable.append(dir + QLatin1Char('/') + file);
}
}
......
......@@ -58,9 +58,9 @@ void KMahjonggTilesetSelector::setupData(KConfigSkeleton * aconfig)
//Now get our tilesets into a list
QStringList tilesAvailable;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kmahjongglib/tilesets"), QStandardPaths::LocateDirectory);
Q_FOREACH (const QString & dir, dirs) {
for (const QString & dir : dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop"));
Q_FOREACH (const QString & file, fileNames) {
for (const QString & file : fileNames) {
tilesAvailable.append(dir + QLatin1Char('/') + file);
}
}
......
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