Commit 172aa1e0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some qt6 compile error

parent c2182b10
Pipeline #181071 passed with stage
in 2 minutes and 57 seconds
......@@ -14,8 +14,8 @@
#include <QObject>
#include <QQueue>
#include <QStringList>
class QStringList;
class KJob;
namespace KIdentityManagement { class Identity; }
namespace MailTransport { class MessageQueueJob; }
......
......@@ -64,7 +64,7 @@ void AlarmListView::setColumnsVisible(const QList<bool>& show)
const bool useName = Preferences::useAlarmName();
QList<bool> vis{ true, false, true, true, true, !useName };
const int colCount = useName ? 6 : 5;
for (int i = 0, count = std::min(colCount, show.count()); i < count; ++i)
for (int i = 0, count = std::min<int>(colCount, show.count()); i < count; ++i)
vis[i] = show[i];
header()->setSectionHidden(AlarmListModel::TimeColumn, !vis[0]);
header()->setSectionHidden(AlarmListModel::TimeToColumn, !vis[1]);
......
......@@ -43,7 +43,7 @@ private:
static int load();
static void close();
static bool saveCal(const QString& newFile = QString());
static bool isValid() { return mCalendarStorage; }
static bool isValid() { return !mCalendarStorage.isNull(); }
static void updateKAEvents();
static bool mInitialised; // whether the calendar has been initialised
......
......@@ -2879,7 +2879,7 @@ QDateTime fromStr(const QString& string, const QString& format, int& utcOffset,
if (str[s] != QLatin1Char('.'))
{
// If no locale, try comma, it is preferred by ISO8601 as the decimal point symbol
const QChar dpt = QLocale().decimalPoint();
const QString dpt = QLocale().decimalPoint();
if (!QStringView(str).mid(s).startsWith(dpt))
return {};
}
......
......@@ -44,6 +44,7 @@
#include <QUrl>
#include <QTextBrowser>
#include <QTemporaryFile>
#include <QRegExp>
using namespace KAlarmCal;
......
......@@ -63,7 +63,11 @@ void FileResourceConfigManager::createResources(QObject* parent)
std::sort(resourceGroups.begin(), resourceGroups.end(),
[](const QString& g1, const QString& g2)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return g1.midRef(9).toInt() < g2.midRef(9).toInt();
#else
return QStringView(g1).mid(9).toInt() < QStringView(g2).mid(9).toInt();
#endif
});
KConfigGroup general(manager->mConfig, GROUP_GENERAL);
......@@ -71,7 +75,11 @@ void FileResourceConfigManager::createResources(QObject* parent)
for (const QString& resourceGroup : std::as_const(resourceGroups))
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const int groupIndex = resourceGroup.midRef(9).toInt();
#else
const int groupIndex = QStringView(resourceGroup).mid(9).toInt();
#endif
FileResourceSettings::Ptr settings(new FileResourceSettings(manager->mConfig, resourceGroup));
if (!settings->isValid())
{
......
......@@ -22,7 +22,9 @@
#include <KLocalizedString>
#include <KConfig>
#include <KConfigGroup>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Kdelibs4Migration>
#endif
#include <QStandardPaths>
#include <QDirIterator>
......@@ -271,12 +273,15 @@ void FileResourceMigrator::migrateKResources()
QString configFile = QStandardPaths::locate(QStandardPaths::ConfigLocation, kresConfFile);
if (configFile.isEmpty())
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Kdelibs4Migration kde4;
if (!kde4.kdeHomeFound())
return; // can't find $KDEHOME
configFile = kde4.locateLocal("config", kresConfFile);
if (configFile.isEmpty())
return; // can't find KResources config file
#endif
}
qCDebug(KALARM_LOG) << "FileResourceMigrator::migrateKResources";
const KConfig config(configFile, KConfig::SimpleConfig);
......
......@@ -33,6 +33,7 @@
#include <QHBoxLayout>
#include <QBoxLayout>
#include <QResizeEvent>
#include <QMenu>
using namespace KCal;
......
Supports Markdown
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