diff --git a/autotests/libs/entitytreemodeltest.cpp b/autotests/libs/entitytreemodeltest.cpp --- a/autotests/libs/entitytreemodeltest.cpp +++ b/autotests/libs/entitytreemodeltest.cpp @@ -30,7 +30,7 @@ #include #include -static const QString serverContent1 = QStringLiteral( +static const char serverContent1[] = // The format of these lines are first a type, either 'C' or 'I' for Item and collection. // The dashes show the depth in the hierarchy // Collections have a list of mimetypes they can contain, followed by an optional @@ -59,7 +59,7 @@ "- - - I text/directory 'Item 12'" "- - - I text/directory 'Item 13'" "- - - I message/rfc822 'Item 14'" - "- - - I message/rfc822 'Item 15'"); + "- - - I message/rfc822 'Item 15'"; /** * This test verifies that the ETM reacts as expected to signals from the monitor. @@ -153,7 +153,7 @@ const auto model = new EntityTreeModel(fakeMonitor, this); const auto serverData = new FakeServerData(model, m_fakeSession, fakeMonitor); - serverData->setCommands(FakeJobResponse::interpret(serverData, serverContent1)); + serverData->setCommands(FakeJobResponse::interpret(serverData, QString::fromLatin1(serverContent1))); m_modelSpy = new ModelSpy(model, this); m_modelSpy->startSpying(); @@ -375,7 +375,7 @@ { QFETCH(QString, serverContent); QFETCH(QString, collectionName); - QFETCH(QString, monitoredMimeType); + QFETCH(QString, monitoredMimeType); // ##### TODO: this is unused. Is this test correct? const auto testDrivers = populateModel(serverContent); const auto serverData = testDrivers.first; diff --git a/src/core/connection.cpp b/src/core/connection.cpp --- a/src/core/connection.cpp +++ b/src/core/connection.cpp @@ -54,10 +54,10 @@ const QByteArray sessionLogFile = qgetenv("AKONADI_SESSION_LOGFILE"); if (!sessionLogFile.isEmpty()) { mLogFile = new QFile(QStringLiteral("%1.%2.%3.%4-%5").arg(QString::fromLatin1(sessionLogFile)) - .arg(QString::number(QApplication::applicationPid())) - .arg(QString::number(reinterpret_cast(this), 16)) - .arg(QString::fromLatin1(mSessionId.replace('/', '_'))) - .arg(connType == CommandConnection ? QStringLiteral("Cmd") : QStringLiteral("Ntf"))); + .arg(QApplication::applicationPid()) + .arg(QString::number(reinterpret_cast(this), 16), + QString::fromLatin1(mSessionId.replace('/', '_')), + connType == CommandConnection ? QStringLiteral("Cmd") : QStringLiteral("Ntf"))); if (!mLogFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { qCWarning(AKONADICORE_LOG) << "Failed to open Akonadi Session log file" << mLogFile->fileName(); delete mLogFile; diff --git a/src/core/monitor_p.h b/src/core/monitor_p.h --- a/src/core/monitor_p.h +++ b/src/core/monitor_p.h @@ -371,7 +371,7 @@ void fetchStatistics(Collection::Id colId) { CollectionStatisticsJob *job = new CollectionStatisticsJob(Collection(colId), session); - QObject::connect(job, SIGNAL(result(KJob *)), q_ptr, SLOT(slotStatisticsChangedFinished(KJob *))); + QObject::connect(job, SIGNAL(result(KJob*)), q_ptr, SLOT(slotStatisticsChangedFinished(KJob*))); } void notifyCollectionStatisticsWatchers(Collection::Id collection, const QByteArray &resource); diff --git a/src/core/protocolhelper.cpp b/src/core/protocolhelper.cpp --- a/src/core/protocolhelper.cpp +++ b/src/core/protocolhelper.cpp @@ -134,7 +134,6 @@ void ProtocolHelper::parseAncestors(const QVector &ancestors, Collection *collection) { static const Collection::Id rootCollectionId = Collection::root().id(); - QList parentIds; Collection *current = collection; for (const Protocol::Ancestor &ancestor : ancestors) { @@ -544,7 +543,7 @@ if (cfs.ancestorRetrieval() != CollectionFetchScope::None) { cfs.ancestorFetchScope().setFetchIdOnly(fetchScope.ancestorFetchIdOnly()); const auto attrs = fetchScope.ancestorAttributes(); - for (const auto attr : attrs) { + for (const auto &attr : attrs) { cfs.ancestorFetchScope().fetchAttribute(attr, true); } } diff --git a/src/private/protocol.cpp b/src/private/protocol.cpp --- a/src/private/protocol.cpp +++ b/src/private/protocol.cpp @@ -547,7 +547,6 @@ void ItemFetchScope::toJson(QJsonObject &json) const { json[QStringLiteral("flags")] = static_cast(mFlags); - QJsonArray tagFetchArray; json[QStringLiteral("ChangedSince")] = mChangedSince.toString(); json[QStringLiteral("AncestorDepth")] = static_cast::type>(mAncestorDepth); diff --git a/src/private/protocolgen/cppgenerator.cpp b/src/private/protocolgen/cppgenerator.cpp --- a/src/private/protocolgen/cppgenerator.cpp +++ b/src/private/protocolgen/cppgenerator.cpp @@ -447,7 +447,6 @@ startChar = ':'; } for (auto prop : properties) { - const auto defaultValue = prop->defaultValue(); auto arg = std::find_if(args.cbegin(), args.cend(), [prop](const CtorNode::Argument &arg) { return arg.name == prop->name(); @@ -507,7 +506,6 @@ writeImplPropertyDependencies(prop); mImpl << "}\n\n"; } else if (!prop->dependencies().isEmpty()) { - QString varType; if (TypeHelper::isNumericType(prop->type()) || TypeHelper::isBoolType(prop->type())) { mImpl << "void " << node->className() << "::" << prop->setterName() << "(" << prop->type() << " val)\n" diff --git a/src/server/connection.cpp b/src/server/connection.cpp --- a/src/server/connection.cpp +++ b/src/server/connection.cpp @@ -134,7 +134,7 @@ void Connection::slotSendHello() { - SchemaVersion version = SchemaVersion::retrieveAll().first(); + SchemaVersion version = SchemaVersion::retrieveAll().at(0); Protocol::HelloResponse hello; hello.setServerName(QStringLiteral("Akonadi")); diff --git a/src/server/handler/itemcreatehandler.cpp b/src/server/handler/itemcreatehandler.cpp --- a/src/server/handler/itemcreatehandler.cpp +++ b/src/server/handler/itemcreatehandler.cpp @@ -37,12 +37,6 @@ using namespace Akonadi; using namespace Akonadi::Server; -static QVector localFlagsToPreserve = QVector() << "$ATTACHMENT" - << "$INVITATION" - << "$ENCRYPTED" - << "$SIGNED" - << "$WATCHED"; - bool ItemCreateHandler::buildPimItem(const Protocol::CreateItemCommand &cmd, PimItem &item, Collection &parentCol) { @@ -206,6 +200,13 @@ bool flagsChanged = false; QSet flagNames = cmd.flags(); + static QVector localFlagsToPreserve = { + "$ATTACHMENT", + "$INVITATION", + "$ENCRYPTED", + "$SIGNED", + "$WATCHED" }; + // Make sure we don't overwrite some local-only flags that can't come // through from Resource during ItemSync, like $ATTACHMENT, because the // resource is not aware of them (they are usually assigned by client diff --git a/src/server/storage/datastore.cpp b/src/server/storage/datastore.cpp --- a/src/server/storage/datastore.cpp +++ b/src/server/storage/datastore.cpp @@ -305,10 +305,10 @@ if (!silent && (!addedFlags.isEmpty() || !removedFlags.isEmpty())) { QSet addedFlagsBa, removedFlagsBa; - for (const auto &addedFlag : addedFlags) { + for (const auto &addedFlag : qAsConst(addedFlags)) { addedFlagsBa.insert(addedFlag.toLatin1()); } - for (const auto &removedFlag : removedFlags) { + for (const auto &removedFlag : qAsConst(removedFlags)) { removedFlagsBa.insert(removedFlag.toLatin1()); } notificationCollector()->itemsFlagsChanged(items, addedFlagsBa, removedFlagsBa, col); @@ -460,7 +460,7 @@ setBoolPtr(flagsChanged, true); if (!silent) { QSet removedFlagsBa; - for (const auto &remoteFlag : removedFlags) { + for (const auto &remoteFlag : qAsConst(removedFlags)) { removedFlagsBa.insert(remoteFlag.toLatin1()); } notificationCollector()->itemsFlagsChanged(items, {}, removedFlagsBa, col); diff --git a/src/server/storage/dbinitializer.cpp b/src/server/storage/dbinitializer.cpp --- a/src/server/storage/dbinitializer.cpp +++ b/src/server/storage/dbinitializer.cpp @@ -88,7 +88,7 @@ #ifndef DBINITIALIZER_UNITTEST // Now finally check and set the generation identifier if necessary - SchemaVersion version = SchemaVersion::retrieveAll().first(); + SchemaVersion version = SchemaVersion::retrieveAll().at(0); if (version.generation() == 0) { version.setGeneration(QDateTime::currentDateTimeUtc().toTime_t()); version.update();