Verified Commit d807b017 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Port away from foreach

parent ad398e71
......@@ -406,6 +406,13 @@ private Q_SLOTS:
QVERIFY(vals | Actions::any([](int v) { return v % 2 == 1; }));
QVERIFY(!(vals | Actions::any([](int v) { return v % 2 == 0; })));
}
void testNone()
{
const QList<int> vals = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
QVERIFY(vals | Views::filter([](int i) { return i % 2 == 0; }) | Actions::none([](int i) { return i % 2 == 1; }));
QVERIFY(!(vals | Views::filter([](int i) { return i % 2 == 0; }) | Actions::none([](int i) { return i % 2 == 0; })));
}
};
QList<int> AkRangesTest::ForEachCallable::sOut;
......
......@@ -646,9 +646,8 @@ void Akonadi::ResourceScheduler::cancelQueues()
for (int i = 0; i < NQueueCount; ++i) {
TaskList &queue = mTaskList[i];
if (s_resourcetracker) {
foreach (const Task &t, queue) {
QList<QVariant> argumentList;
argumentList << QString::number(t.serial) << QString();
for (const Task &t : queue) {
QList<QVariant> argumentList{QString::number(t.serial), QString()};
s_resourcetracker->asyncCallWithArgumentList(QStringLiteral("jobEnded"), argumentList);
}
}
......
......@@ -70,7 +70,7 @@ namespace Akonadi
* const QStringList leftEmails = contact1.emails();
* const QStringList rightEmails = contact2.emails();
*
* foreach ( const QString &leftEmail, leftEmails ) {
* for ( const QString &leftEmail : leftEmails ) {
* if ( rightEmails.contains( leftEmail ) )
* reporter->addProperty( AbstractDifferencesReporter::NormalMode, i18n( "Email" ),
* leftEmail, leftEmail );
......@@ -79,7 +79,7 @@ namespace Akonadi
* leftEmail, QString() );
* }
*
* foreach ( const QString &rightEmail, rightEmails ) {
* for( const QString &rightEmail : rightEmails ) {
* if ( !leftEmails.contains( rightEmail ) )
* reporter->addProperty( AbstractDifferencesReporter::AdditionalRightMode, i18n( "Email" ),
* QString(), rightEmail );
......
......@@ -45,7 +45,7 @@ class AgentType;
* @code
*
* Akonadi::AgentInstance::List instances = Akonadi::AgentManager::self()->instances();
* foreach ( const Akonadi::AgentInstance &instance, instances ) {
* for( const Akonadi::AgentInstance &instance : instances ) {
* qDebug() << "Name:" << instance.name() << "(" << instance.identifier() << ")";
* }
*
......
......@@ -45,7 +45,7 @@ class Collection;
* Akonadi::AgentManager *manager = Akonadi::AgentManager::self();
*
* Akonadi::AgentType::List types = manager->types();
* foreach ( const Akonadi::AgentType& type, types ) {
* for ( const Akonadi::AgentType& type : types ) {
* qDebug() << "Type:" << type.name() << type.description();
* }
*
......
......@@ -46,7 +46,7 @@ namespace Akonadi
* @code
*
* Akonadi::AgentType::List types = Akonadi::AgentManager::self()->types();
* foreach ( const Akonadi::AgentType &type, types ) {
* for ( const Akonadi::AgentType &type : types ) {
* qDebug() << "Name:" << type.name() << "(" << type.identifier() << ")";
* }
*
......
......@@ -64,7 +64,7 @@ class CollectionStatistics;
* CollectionFetchJob *fetchJob = qobject_cast<CollectionFetchJob*>( job );
*
* const Collection::List collections = fetchJob->collections();
* foreach ( const Collection &collection, collections ) {
* for ( const Collection &collection : collections ) {
* qDebug() << "Name:" << collection.name();
* }
* }
......
......@@ -72,7 +72,7 @@ class ItemFetchScope;
* Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>(job);
*
* const Akonadi::Item::List items = fetchJob->items();
* foreach (const Akonadi::Item &item, items) {
* for (const Akonadi::Item &item : items) {
* qDebug() << "Item ID:" << item.id();
* }
* }
......
......@@ -56,7 +56,7 @@ class SearchQuery;
* {
* Akonadi::ItemSearchJob *searchJob = qobject_cast<Akonadi::ItemSearchJob*>( job );
* const Akonadi::Item::List items = searchJob->items();
* foreach ( const Akonadi::Item &item, items ) {
* for ( const Akonadi::Item &item : items ) {
* // extract the payload and do further stuff
* }
* }
......
......@@ -272,7 +272,8 @@ void JobPrivate::itemRevisionChanged(Akonadi::Item::Id itemId, int oldRevision,
void JobPrivate::updateItemRevision(Akonadi::Item::Id itemId, int oldRevision, int newRevision)
{
Q_Q(Job);
foreach (KJob *j, q->subjobs()) {
const auto subjobs = q->subjobs();
for (KJob *j : subjobs) {
Akonadi::Job *job = qobject_cast<Akonadi::Job *>(j);
if (job) {
job->d_ptr->updateItemRevision(itemId, oldRevision, newRevision);
......
......@@ -143,7 +143,8 @@ void TransactionSequence::slotResult(KJob *job)
removeSubjob(job);
// cancel all subjobs in case someone else is listening (such as ItemSync)
foreach (KJob *job, subjobs()) {
const auto subjobs = this->subjobs();
for (KJob *job : subjobs) {
job->kill(KJob::EmitResult);
}
clearSubjobs();
......
......@@ -48,7 +48,7 @@ class TransactionSequencePrivate;
*
* const Akonadi::Item::List items = ...
*
* foreach ( const Akonadi::Item &item, items ) {
* for( const Akonadi::Item &item : items ) {
* new Akonadi::ItemDeleteJob( item, transaction );
* }
*
......
......@@ -176,10 +176,11 @@ QModelIndexList EntityMimeTypeFilterModel::match(const QModelIndex &start, int r
QModelIndexList list;
QModelIndex proxyIndex;
foreach (const QModelIndex &idx, sourceModel()->match(mapToSource(start), role, value, hits, flags)) {
const auto matches = sourceModel()->match(mapToSource(start), role, value, hits, flags);
for (const auto &idx: matches) {
proxyIndex = mapFromSource(idx);
if (proxyIndex.isValid()) {
list << proxyIndex;
list.push_back(proxyIndex);
}
}
......
......@@ -240,10 +240,11 @@ QModelIndexList EntityOrderProxyModel::match(const QModelIndex &start, int role,
QModelIndexList list;
QModelIndex proxyIndex;
foreach (const QModelIndex &idx, sourceModel()->match(mapToSource(start), role, value, hits, flags)) {
const auto matches = sourceModel()->match(mapToSource(start), role, value, hits, flags);
for (const auto &idx : matches) {
proxyIndex = mapFromSource(idx);
if (proxyIndex.isValid()) {
list << proxyIndex;
list.push_back(proxyIndex);
}
}
......
......@@ -121,10 +121,11 @@ QModelIndexList EntityRightsFilterModel::match(const QModelIndex &start, int rol
QModelIndexList list;
QModelIndex proxyIndex;
foreach (const QModelIndex &idx, sourceModel()->match(mapToSource(start), role, value, hits, flags)) {
const auto matches = sourceModel()->match(mapToSource(start), role, value, hits, flags);
for (const auto &idx : matches) {
proxyIndex = mapFromSource(idx);
if (proxyIndex.isValid()) {
list << proxyIndex;
list.push_back(proxyIndex);
}
}
......
......@@ -51,6 +51,7 @@
#include <QMessageBox>
#include <QIcon>
#include <QElapsedTimer>
#include <unordered_map>
QHash<KJob *, QElapsedTimer> jobTimeTracker;
......@@ -198,7 +199,8 @@ void EntityTreeModelPrivate::agentInstanceRemoved(const Akonadi::AgentInstance &
}
return;
}
foreach (Node *node, m_childEntities[Collection::root().id()]) {
const auto &children = m_childEntities[Collection::root().id()];
for (const Node *node : children) {
Q_ASSERT(node->type == Node::Collection);
const Collection collection = m_collections[node->id];
......@@ -394,11 +396,11 @@ void EntityTreeModelPrivate::collectionsFetched(const Akonadi::Collection::List
}
//Build a list of subtrees to insert, with the root of the subtree on the left, and the complete subtree including root on the right
QHash<Collection::Id, QSet<Collection::Id> > subTreesToInsert;
std::unordered_map<Collection::Id, QSet<Collection::Id> > subTreesToInsert;
{
//Build a child-parent map that allows us to build the subtrees afterwards
QHash<Collection::Id, Collection::Id> childParentMap;
Q_FOREACH (const Collection &col, collectionsToInsert) {
for (const auto &col : collectionsToInsert) {
childParentMap.insert(col.id(), col.parentCollection().id());
//Complete the subtree up to the last known parent
......@@ -425,23 +427,19 @@ void EntityTreeModelPrivate::collectionsFetched(const Akonadi::Collection::List
}
//Find children of each subtree
Q_FOREACH (Collection::Id p, parents) {
for (const auto parentId : parents) {
QSet<Collection::Id> children;
//We add the parent itself as well so it can be inserted below as part of the same loop
children << p;
children += getChildren(p, childParentMap);
subTreesToInsert[p] = children;
children << parentId;
children += getChildren(parentId, childParentMap);
subTreesToInsert.insert_or_assign(parentId, std::move(children));
}
}
const int row = 0;
QHashIterator<Collection::Id, QSet<Collection::Id> > collectionIt(subTreesToInsert);
while (collectionIt.hasNext()) {
collectionIt.next();
const Collection::Id topCollectionId = collectionIt.key();
qCDebug(DebugETM) << "Subtree: " << topCollectionId << collectionIt.value();
for (const auto &[topCollectionId, subtree] : subTreesToInsert) {
qCDebug(DebugETM) << "Subtree: " << topCollectionId << subtree;
Q_ASSERT(!m_collections.contains(topCollectionId));
Collection topCollection = collectionsToInsert.value(topCollectionId);
......@@ -452,9 +450,9 @@ void EntityTreeModelPrivate::collectionsFetched(const Akonadi::Collection::List
const QModelIndex parentIndex = indexForCollection(topCollection.parentCollection());
q->beginInsertRows(parentIndex, row, row);
Q_ASSERT(!collectionIt.value().isEmpty());
Q_ASSERT(!subtree.empty());
foreach (Collection::Id collectionId, collectionIt.value()) {
for (const auto collectionId : subtree) {
const Collection collection = collectionsToInsert.take(collectionId);
Q_ASSERT(collection.isValid());
......@@ -466,7 +464,7 @@ void EntityTreeModelPrivate::collectionsFetched(const Akonadi::Collection::List
q->endInsertRows();
if (m_itemPopulation == EntityTreeModel::ImmediatePopulation) {
foreach (const Collection::Id &collectionId, collectionIt.value()) {
for (const auto collectionId : subtree) {
const auto col = m_collections.value(collectionId);
if (!m_mimeChecker.hasWantedMimeTypes() || m_mimeChecker.isWantedCollection(col)) {
fetchItems(col);
......@@ -512,8 +510,7 @@ void EntityTreeModelPrivate::itemsFetched(const Collection::Id collectionId, con
m_collectionsWithoutItems.remove(collectionId);
}
foreach (const Item &item, items) {
for (const auto &item : items) {
if (isHidden(item)) {
continue;
}
......@@ -733,7 +730,8 @@ void EntityTreeModelPrivate::insertCollection(const Akonadi::Collection &collect
bool EntityTreeModelPrivate::hasChildCollection(const Collection &collection) const
{
foreach (Node *node, m_childEntities[collection.id()]) {
const auto &children = m_childEntities[collection.id()];
for (const Node *node : children) {
if (node->type == Node::Collection) {
const Collection subcol = m_collections[node->id];
if (shouldBePartOfModel(subcol)) {
......@@ -935,15 +933,10 @@ void EntityTreeModelPrivate::removeChildEntities(Collection::Id collectionId)
QStringList EntityTreeModelPrivate::childCollectionNames(const Collection &collection) const
{
QStringList names;
foreach (Node *node, m_childEntities[collection.id()]) {
if (node->type == Node::Collection) {
names << m_collections.value(node->id).name();
}
}
return names;
return m_childEntities[collection.id()]
| Views::filter([](const Node *node) { return node->type == Node::Collection; })
| Views::transform([this](const Node *node) { return m_collections.value(node->id).name(); })
| Actions::toQList;
}
void EntityTreeModelPrivate::monitoredCollectionMoved(const Akonadi::Collection &collection,
......@@ -1798,7 +1791,7 @@ void EntityTreeModelPrivate::beginResetModel()
void EntityTreeModelPrivate::endResetModel()
{
Q_Q(EntityTreeModel);
foreach (Akonadi::Job *job, m_session->findChildren<Akonadi::Job *>()) {
for (Akonadi::Job *job : m_session->findChildren<Akonadi::Job *>()) {
job->disconnect(q);
}
m_collections.clear();
......@@ -1809,7 +1802,7 @@ void EntityTreeModelPrivate::endResetModel()
m_pendingCollectionRetrieveJobs.clear();
m_collectionTreeFetched = false;
foreach (const QList<Node *> &list, m_childEntities) {
for (const QList<Node *> &list : m_childEntities) {
qDeleteAll(list);
}
m_childEntities.clear();
......@@ -1860,11 +1853,7 @@ void EntityTreeModelPrivate::fillModel()
m_collectionTreeFetched = true;
Q_EMIT q_ptr->collectionTreeFetched(collections); // there are no collections to fetch
Item::List items;
items.reserve(m_monitor->itemsMonitoredEx().size());
Q_FOREACH (Item::Id id, m_monitor->itemsMonitoredEx()) {
items.append(Item(id));
}
const auto items = m_monitor->itemsMonitoredEx() | Views::transform([](const auto id) { return Item{id}; }) | Actions::toQVector;
ItemFetchJob *itemFetch = new ItemFetchJob(items, m_session);
itemFetch->setFetchScope(m_monitor->itemFetchScope());
itemFetch->fetchScope().setIgnoreRetrievalErrors(true);
......
......@@ -33,15 +33,17 @@ public:
: q_ptr(selectionProxyModel)
{
Q_Q(SelectionProxyModel);
foreach (const QModelIndex &rootIndex, q->sourceRootIndexes()) {
const auto indexes = q->sourceRootIndexes();
for (const auto &rootIndex : indexes) {
rootIndexAdded(rootIndex);
}
}
~SelectionProxyModelPrivate()
{
Q_Q(SelectionProxyModel);
foreach (const QModelIndex &idx, q->sourceRootIndexes()) {
rootIndexAboutToBeRemoved(idx);
const auto indexes = q->sourceRootIndexes();
for (const auto &rootIndex : indexes) {
rootIndexAboutToBeRemoved(rootIndex);
}
}
......
......@@ -329,10 +329,11 @@ QModelIndexList StatisticsProxyModel::match(const QModelIndex &start, int role,
QModelIndexList list;
QModelIndex proxyIndex;
foreach (const QModelIndex &idx, sourceModel()->match(mapToSource(start), role, value, hits, flags)) {
const auto matches = sourceModel()->match(mapToSource(start), role, value, hits, flags);
for (const auto &idx : matches) {
proxyIndex = mapFromSource(idx);
if (proxyIndex.isValid()) {
list << proxyIndex;
list.push_back(proxyIndex);
}
}
......
......@@ -80,7 +80,8 @@ QObject *PluginLoader::createForName(const QString &name)
PluginMetaData &info = mPluginInfos[name];
//First try to load it staticly
foreach (QObject *plugin, QPluginLoader::staticInstances()) {
const auto instances = QPluginLoader::staticInstances();
for (auto *plugin : instances) {
if (QLatin1String(plugin->metaObject()->className()) == info.className) {
info.loaded = true;
return plugin;
......
......@@ -35,11 +35,14 @@
#include "private/protocol_p.h"
#include "private/externalpartstorage_p.h"
#include <shared/akranges.h>
#include <QFile>
#include <QVarLengthArray>
using namespace Akonadi;
using namespace AkRanges;
CachePolicy ProtocolHelper::parseCachePolicy(const Protocol::CachePolicy &policy)
{
......@@ -102,7 +105,8 @@ template<typename T>
inline static Protocol::Attributes attributesToProtocolImpl(const T &entity, bool ns)
{
Protocol::Attributes attributes;
Q_FOREACH (const Attribute *attr, entity.attributes()) {
const auto attrs = entity.attributes();
for (const auto *attr : attrs) {
attributes.insert(ProtocolHelper::encodePartIdentifier(ns ? ProtocolHelper::PartAttribute : ProtocolHelper::PartGlobal, attr->type()),
attr->serialized());
}
......@@ -240,12 +244,7 @@ Collection ProtocolHelper::parseCollection(const Protocol::FetchCollectionsRespo
if (!data.searchQuery().isEmpty()) {
auto attr = collection.attribute<PersistentSearchAttribute>(Collection::AddIfMissing);
attr->setQueryString(data.searchQuery());
QVector<Collection> cols;
cols.reserve(data.searchCollections().size());
foreach (auto id, data.searchCollections()) {
cols.push_back(Collection(id));
}
const auto cols = data.searchCollections() | Views::transform([](const auto id) { return Collection{id}; }) | Actions::toQVector;
attr->setQueryCollections(cols);
}
......@@ -349,12 +348,8 @@ Protocol::ItemFetchScope ProtocolHelper::itemFetchScopeToProtocol(const ItemFetc
Protocol::ItemFetchScope fs;
QVector<QByteArray> parts;
parts.reserve(fetchScope.payloadParts().size() + fetchScope.attributes().size());
Q_FOREACH (const QByteArray &part, fetchScope.payloadParts()) {
parts << ProtocolHelper::encodePartIdentifier(ProtocolHelper::PartPayload, part);
}
Q_FOREACH (const QByteArray &part, fetchScope.attributes()) {
parts << ProtocolHelper::encodePartIdentifier(ProtocolHelper::PartAttribute, part);
}
parts += fetchScope.payloadParts() | Views::transform(std::bind(encodePartIdentifier, PartPayload, std::placeholders::_1)) | Actions::toQVector;
parts += fetchScope.attributes() | Views::transform(std::bind(encodePartIdentifier, PartAttribute, std::placeholders::_1)) | Actions::toQVector;
fs.setRequestedParts(parts);
// The default scope
......@@ -402,7 +397,8 @@ Protocol::ItemFetchScope ProtocolHelper::itemFetchScopeToProtocol(const ItemFetc
ItemFetchScope ProtocolHelper::parseItemFetchScope(const Protocol::ItemFetchScope &fetchScope)
{
ItemFetchScope ifs;
Q_FOREACH (const auto &part, fetchScope.requestedParts()) {
const auto parts = fetchScope.requestedParts();
for (const auto &part : fetchScope.requestedParts()) {
if (part.startsWith("PLD:")) {
ifs.fetchPayloadPart(part.mid(4), true);
} else if (part.startsWith("ATR:")) {
......
......@@ -163,7 +163,8 @@ void SpecialCollectionsPrivate::endBatchRegister()
void SpecialCollectionsPrivate::forgetFoldersForResource(const QString &resourceId)
{
if (mFoldersForResource.contains(resourceId)) {
foreach (const Collection &collection, mFoldersForResource[resourceId]) {
const auto folders = mFoldersForResource[resourceId];
for (const auto &collection : folders) {
mMonitor->setCollectionMonitored(collection, false);
}
......
......@@ -65,7 +65,7 @@ void ItemMoveHandler::itemsRetrieved(const QVector<qint64> &ids)
QMap<Entity::Id /* collection */, PimItem> toMove;
QMap<Entity::Id /* collection */, Collection> sources;
ImapSet toMoveIds;
Q_FOREACH (/*sic!*/ PimItem item, items) { //krazy:exclude=foreach
for (PimItem item : items) { //krazy:exclude=foreach
if (!item.isValid()) {
failureResponse("Invalid item in result set!?");
return;
......
......@@ -698,7 +698,7 @@ bool DataStore::removeTags(const Tag::List &tags, bool silent)
notificationCollector()->itemsTagsChanged(items, QSet<qint64>(), removedTags);
}
Q_FOREACH (const Tag &tag, tags) {
for (const Tag &tag : tags) {
// Emit special tagRemoved notification for each resource that owns the tag
QueryBuilder qb(TagRemoteIdResourceRelation::tableName(), QueryBuilder::Select);
qb.addColumn(TagRemoteIdResourceRelation::remoteIdFullColumnName());
......@@ -1174,7 +1174,7 @@ bool DataStore::appendPimItem(QVector<Part> &parts,
}
bool seen = false;
Q_FOREACH (const Flag &flag, flags) {
for (const Flag &flag : flags) {
seen |= (flag.name() == QLatin1String(AKONADI_FLAG_SEEN)
|| flag.name() == QLatin1String(AKONADI_FLAG_IGNORED));
if (!pimItem.addFlag(flag)) {
......
......@@ -356,6 +356,12 @@ struct AnyTag_
UnaryPredicate mFn;
};
template<typename UnaryPredicate>
struct NoneTag_
{
UnaryPredicate mFn;
};
} // namespace detail
} // namespace AkRanges
......@@ -404,7 +410,7 @@ auto operator|(const RangeLike &range, AkRanges::detail::FilterTag_<UnaryPredica
OutIt(std::cend(range), std::cend(range), p.mFn, range));
}
// Generic operator| fo foreach()
// Generic operator| for foreach()
template<typename RangeLike, typename UnaryOperation>
auto operator|(const RangeLike &range, AkRanges::detail::ForEachTag_<UnaryOperation> op)
{
......@@ -429,6 +435,13 @@ auto operator|(const RangeLike &range, AkRanges::detail::AnyTag_<PredicateFn> p)
return std::any_of(std::cbegin(range), std::cend(range), p.mFn);
}
// Generic operator| for none
template<typename RangeLike, typename UnaryPredicate>
auto operator|(const RangeLike &range, AkRanges::detail::NoneTag_<UnaryPredicate> p)
{
return std::none_of(std::cbegin(range), std::cend(range), p.mFn);
}
// Generic operator| for keys
template<typename AssocContainer>
auto operator|(const AssocContainer &in, AkRanges::detail::KeysTag_)
......@@ -460,6 +473,8 @@ static constexpr auto toQSet = detail::ToTag_<QSet>{};
static constexpr auto toQList = detail::ToTag_<QList>{};
/// Non-lazily convert given range or container of pairs to QMap
static constexpr auto toQMap = detail::ToAssocTag_<QMap>{};
/// Non-lazily convert given range or container of pairs to QHash
static constexpr auto toQHash = detail::ToAssocTag_<QHash>{};
/// Non-lazily call UnaryOperation for each element of the container or range
template<typename UnaryOperation>
......@@ -482,6 +497,13 @@ detail::AnyTag_<UnaryPredicate> any(UnaryPredicate &&pred)
return detail::AnyTag_<UnaryPredicate>{std::forward<UnaryPredicate>(pred)};
}
/// Non-lazily check that none of the elements in the range satisfies the given predicate
template<typename UnaryPredicate>
detail::NoneTag_<UnaryPredicate> none(UnaryPredicate &&pred)
{
return detail::NoneTag_<UnaryPredicate>{std::forward<UnaryPredicate>(pred)};
}
} // namespace Action
namespace Views {
......@@ -514,6 +536,7 @@ detail::Range<It> range(Iterator1 begin, Iterator2 end)
return detail::Range<It>(std::move(begin), std::move(end));
}
} // namespace View
} // namespace AkRanges
......
......@@ -134,7 +134,7 @@ void CollectionPropertiesDialog::Private::init()
mainLayout->addWidget(buttonBox);
if (mPageNames.isEmpty()) { // default loading
foreach (CollectionPropertiesPageFactory *factory, *s_pages) {
for (CollectionPropertiesPageFactory *factory : *s_pages) {
CollectionPropertiesPage *page = factory->createWidget(mTabWidget);
if (page->canHandle(mCollection)) {
mTabWidget->addTab(page, page->pageTitle());
......@@ -146,7 +146,7 @@ void CollectionPropertiesDialog::Private::init()
} else { // custom loading
QHash<QString, CollectionPropertiesPage *> pages;
foreach (CollectionPropertiesPageFactory *factory, *s_pages) {
for (CollectionPropertiesPageFactory *factory : *s_pages) {
CollectionPropertiesPage *page = factory->createWidget(mTabWidget);
const QString pageName = page->objectName();
......
......@@ -24,6 +24,8 @@
#include "differencesalgorithminterface.h"
#include "typepluginloader_p.h"
#include <shared/akranges.h>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
......@@ -40,6 +42,7 @@
#include <KWindowConfig>
using namespace Akonadi;
using namespace AkRanges;
static inline QString textToHTML(const QString &text)
{
......@@ -144,35 +147,20 @@ static void compareItems(AbstractDifferencesReporter *reporter, const Akonadi::I
}
if (localItem.flags() != otherItem.flags()) {
QStringList localFlags;
localFlags.reserve(localItem.flags().count());
foreach (const QByteArray &localFlag, localItem.flags()) {
localFlags.append(QString::fromUtf8(localFlag));
}