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

Port some qt6 compile error

parent 99ad93ff
Pipeline #177170 passed with stage
in 22 minutes and 5 seconds
......@@ -9,6 +9,8 @@
#include <Akonadi/CollectionCreateJob>
#include <Akonadi/ItemCreateJob>
#include <QVariant>
#include "migration_debug.h"
using namespace Akonadi;
......
......@@ -123,7 +123,7 @@ EwsItemPrivate::EwsItemPrivate()
bool EwsItemPrivate::bodyReader(QXmlStreamReader &reader, QVariant &val)
{
QVariantList vl;
QStringRef bodyType = reader.attributes().value(QStringLiteral("BodyType"));
auto bodyType = reader.attributes().value(QStringLiteral("BodyType"));
if (bodyType.isNull()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - missing %2 attribute").arg(QStringLiteral("Body"), QStringLiteral("BodyType"));
return false;
......@@ -158,7 +158,7 @@ bool EwsItemPrivate::messageHeadersReader(QXmlStreamReader &reader, QVariant &va
}
if (reader.name() == QLatin1String("InternetMessageHeader")) {
QStringRef nameRef = reader.attributes().value(QStringLiteral("HeaderName"));
auto nameRef = reader.attributes().value(QStringLiteral("HeaderName"));
if (nameRef.isNull()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Missing HeaderName attribute in InternetMessageHeader element.");
return false;
......@@ -229,7 +229,7 @@ bool EwsItemPrivate::mailboxReader(QXmlStreamReader &reader, QVariant &val)
bool EwsItemPrivate::timezoneReader(QXmlStreamReader &reader, QVariant &val)
{
// TODO: This only reads the timezone identifier.
QStringRef idRef = reader.attributes().value(QStringLiteral("Id"));
auto idRef = reader.attributes().value(QStringLiteral("Id"));
if (idRef.isNull()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading %1 element - missing %2 attribute").arg(reader.name().toString(), QStringLiteral("Id"));
reader.skipCurrentElement();
......@@ -384,13 +384,13 @@ EwsItem::EwsItem(QXmlStreamReader &reader)
auto d = reinterpret_cast<EwsItemPrivate *>(this->d.data());
// Check what item type are we
const QStringRef elmName = reader.name();
const auto elmName = reader.name();
if (elmName == QLatin1String("Item")) {
d->mType = EwsItemTypeItem;
const QStringRef subtype = reader.attributes().value(QStringLiteral("xsi:type"));
const auto subtype = reader.attributes().value(QStringLiteral("xsi:type"));
if (!subtype.isEmpty()) {
auto tokens = subtype.split(QLatin1Char(':'));
const QStringRef type = tokens.size() == 1 ? tokens[0] : tokens[1];
const auto type = tokens.size() == 1 ? tokens[0] : tokens[1];
if (type == QLatin1String("AbchPersonItemType")) {
d->mType = EwsItemTypeAbchPerson;
}
......
......@@ -383,7 +383,11 @@ bool EwsPropertyField::read(QXmlStreamReader &reader)
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading property field - malformed %1 attribute.").arg(QStringLiteral("FieldIndex"));
return false;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
unsigned index = indexStr.midRef(tokens[1].size()).toUInt(&ok, 0);
#else
unsigned index = QStringView(indexStr).mid(tokens[1].size()).toUInt(&ok, 0);
#endif
if (!ok) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading property field - error reading %1 attribute.").arg(QStringLiteral("FieldIndex"));
return false;
......@@ -396,7 +400,7 @@ bool EwsPropertyField::read(QXmlStreamReader &reader)
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading property field - missing %1 attribute.").arg(QStringLiteral("PropertyType"));
return false;
}
QStringRef propTypeText = attrs.value(QStringLiteral("PropertyType"));
auto propTypeText = attrs.value(QStringLiteral("PropertyType"));
unsigned i;
EwsPropertyType propType;
for (i = 0; i < sizeof(propertyTypeNames) / sizeof(propertyTypeNames[0]); ++i) {
......@@ -443,7 +447,7 @@ bool EwsPropertyField::read(QXmlStreamReader &reader)
}
if (attrs.hasAttribute(QStringLiteral("DistinguishedPropertySetId"))) {
QStringRef didText = attrs.value(QStringLiteral("DistinguishedPropertySetId"));
auto didText = attrs.value(QStringLiteral("DistinguishedPropertySetId"));
unsigned i;
for (i = 0; i < sizeof(distinguishedPropSetIdNames) / sizeof(distinguishedPropSetIdNames[0]); ++i) {
if (didText == distinguishedPropSetIdNames[i]) {
......
......@@ -194,14 +194,20 @@ bool EwsRequest::readSoapBody(QXmlStreamReader &reader)
}
return true;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QPair<QStringRef, QString> EwsRequest::parseNamespacedString(const QString &str, const QXmlStreamNamespaceDeclarations &namespaces)
#else
QPair<QStringView, QString> EwsRequest::parseNamespacedString(const QString &str, const QXmlStreamNamespaceDeclarations &namespaces)
#endif
{
const auto tokens = str.split(QLatin1Char(':'));
switch (tokens.count()) {
case 1:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return {QStringRef(), str};
break;
#else
return {QStringView(), str};
#endif
case 2:
for (const auto &ns : namespaces) {
if (ns.prefix() == tokens[0]) {
......@@ -213,8 +219,11 @@ QPair<QStringRef, QString> EwsRequest::parseNamespacedString(const QString &str,
return {};
}
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
EwsResponseCode EwsRequest::parseEwsResponseCode(const QPair<QStringRef, QString> &code)
#else
EwsResponseCode EwsRequest::parseEwsResponseCode(const QPair<QStringView, QString> &code)
#endif
{
if (code.first == ewsTypeNsUri) {
return decodeEwsResponseCode(code.second);
......@@ -299,7 +308,7 @@ EwsRequest::Response::Response(QXmlStreamReader &reader)
QStringLiteral("Error"),
};
QStringRef respClassRef = reader.attributes().value(QStringLiteral("ResponseClass"));
auto respClassRef = reader.attributes().value(QStringLiteral("ResponseClass"));
if (respClassRef.isNull()) {
mClass = EwsResponseParseError;
qCWarning(EWSCLI_LOG) << "ResponseClass attribute not found in response element";
......
......@@ -95,8 +95,13 @@ private:
bool readHeader(QXmlStreamReader &reader);
bool readResponseAttr(const QXmlStreamAttributes &attrs, EwsResponseClass &responseClass);
QString getOAuthToken();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QPair<QStringRef, QString> parseNamespacedString(const QString &str, const QXmlStreamNamespaceDeclarations &namespaces);
EwsResponseCode parseEwsResponseCode(const QPair<QStringRef, QString> &code);
#else
QPair<QStringView, QString> parseNamespacedString(const QString &str, const QXmlStreamNamespaceDeclarations &namespaces);
EwsResponseCode parseEwsResponseCode(const QPair<QStringView, QString> &code);
#endif
QString mBody;
EwsClient &mClient;
......
......@@ -33,11 +33,11 @@ EwsServerVersion::EwsServerVersion(QXmlStreamReader &reader)
// MinorBuildNumber=\"2\" Version=\"Exchange2010_SP2\" />
QXmlStreamAttributes attrs = reader.attributes();
QStringRef majorRef = attrs.value(QStringLiteral("MajorVersion"));
QStringRef minorRef = attrs.value(QStringLiteral("MinorVersion"));
QStringRef majorBuildRef = attrs.value(QStringLiteral("MajorBuildNumber"));
QStringRef minorBuildRef = attrs.value(QStringLiteral("MinorBuildNumber"));
QStringRef nameRef = attrs.value(QStringLiteral("Version"));
auto majorRef = attrs.value(QStringLiteral("MajorVersion"));
auto minorRef = attrs.value(QStringLiteral("MinorVersion"));
auto majorBuildRef = attrs.value(QStringLiteral("MajorBuildNumber"));
auto minorBuildRef = attrs.value(QStringLiteral("MinorBuildNumber"));
auto nameRef = attrs.value(QStringLiteral("Version"));
if (majorRef.isNull() || minorRef.isNull()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading server version info - missing attribute.");
......
......@@ -7,7 +7,9 @@
#include "dummyresourcestate.h"
Q_DECLARE_METATYPE(QList<qint64>)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_DECLARE_METATYPE(QVector<qint64>)
#endif
Q_DECLARE_METATYPE(QString)
Q_DECLARE_METATYPE(TagListAndMembers)
......
......@@ -222,7 +222,7 @@ void MoveItemsTask::onPreSearchSelectDone(KJob *job)
// by the server.
static const int batchSize = 250;
for (int batchIdx = 0; batchIdx < m_messageIds.size(); batchIdx += batchSize) {
const auto count = std::min(batchSize, m_messageIds.size() - batchIdx);
const auto count = std::min<int>(batchSize, m_messageIds.size() - batchIdx);
auto search = new KIMAP::SearchJob(select->session());
search->setUidBased(true);
......
......@@ -54,7 +54,7 @@ QDebug ErrorHandler::debugStream(ErrorHandler::Severity severity, int line, cons
QMutexLocker locker(&mutex);
ErrorHandler::instance().m_debugStream->m_location = QString(QLatin1String(file) + QLatin1Char('(') + QString::number(line) + QLatin1Char(')'));
ErrorHandler::instance().m_debugStream->m_severity = severity;
return {ErrorHandler::instance().m_debugStream.data()};
return QDebug(ErrorHandler::instance().m_debugStream.data());
}
void ErrorHandler::addError(ErrorHandler::Severity s, const QString &message, const QString &location)
......
......@@ -9,6 +9,7 @@
#include "kolab_export.h"
#include <QDebug>
#include <QIODevice>
#include <QList>
#include <QString>
......
......@@ -29,7 +29,7 @@ extern "C" {
#include <QThread>
#include <cstring>
#include <KIOCore/KSslErrorUiData>
#include <KSslErrorUiData>
#define GREETING_BUF_LEN 1024
#define MAX_RESPONSE_LEN 512
......
......@@ -8,6 +8,7 @@
#include "entitycompactchangeattribute.h"
#include <QDataStream>
#include <QIODevice>
using namespace Akonadi;
......
......@@ -4,6 +4,7 @@
#include "debug.h"
#include <QDataStream>
#include <QIODevice>
#include "o2/o0baseauth.h"
#include "o2/o0globals.h"
......
......@@ -10,6 +10,7 @@
#include <QCryptographicHash>
#include <QDataStream>
#include <QDateTime>
#include <QIODevice>
#include <QRandomGenerator>
O0SimpleCrypt::O0SimpleCrypt()
......
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