Commit 54e4e0d0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 7fbbb739
Pipeline #60654 passed with stage
in 10 minutes and 47 seconds
......@@ -14,7 +14,7 @@
#include "../src/widgets/actionstatemanager.cpp"
#undef QT_NO_CLIPBOARD
typedef QHash<Akonadi::StandardActionManager::Type, bool> StateMap;
using StateMap = QHash<Akonadi::StandardActionManager::Type, bool>;
Q_DECLARE_METATYPE(StateMap)
using namespace Akonadi;
......
......@@ -25,7 +25,7 @@ static Collection res1;
void AttributeFactoryTest::initTestCase()
{
AkonadiTest::checkTestIsIsolated();
CollectionPathResolver *resolver = new CollectionPathResolver(QStringLiteral("res1"), this);
auto resolver = new CollectionPathResolver(QStringLiteral("res1"), this);
AKVERIFYEXEC(resolver);
res1 = Collection(resolver->collection());
}
......@@ -38,7 +38,7 @@ void AttributeFactoryTest::testUnknownAttribute()
item.setPayload<QByteArray>("payload");
auto ta = new TestAttribute;
{
auto *created = AttributeFactory::createAttribute(ta->type()); // DefaultAttribute
auto created = AttributeFactory::createAttribute(ta->type()); // DefaultAttribute
QVERIFY(created != nullptr);
delete created;
}
......@@ -68,7 +68,7 @@ void AttributeFactoryTest::testRegisteredAttribute()
item.setPayload<QByteArray>("payload");
auto ta = new TestAttribute;
{
auto *created = AttributeFactory::createAttribute(ta->type());
auto created = AttributeFactory::createAttribute(ta->type());
QVERIFY(created != nullptr);
delete created;
}
......
......@@ -108,7 +108,7 @@ private:
{
static int s_num = 0;
Item item(uid);
auto *attr = item.attribute<TestAttribute>(Item::AddIfMissing);
auto attr = item.attribute<TestAttribute>(Item::AddIfMissing);
attr->data = QByteArray::number(++s_num);
auto job = new ItemModifyJob(item);
job->disableRevisionCheck();
......
......@@ -61,7 +61,7 @@ void CollectionAttributeTest::initTestCase()
Control::start();
AttributeFactory::registerAttribute<TestAttribute>();
CollectionPathResolver *resolver = new CollectionPathResolver(QStringLiteral("res3"), this);
auto resolver = new CollectionPathResolver(QStringLiteral("res3"), this);
AKVERIFYEXEC(resolver);
parentColId = resolver->collection();
QVERIFY(parentColId > 0);
......@@ -82,7 +82,7 @@ void CollectionAttributeTest::testAttributes_data()
QTest::newRow("newline") << QByteArray("\n") << QByteArray("no newline");
QTest::newRow("newline2") << QByteArray(" \\\n\\\nnn") << QByteArray("no newline");
QTest::newRow("cr") << QByteArray("\r") << QByteArray("\\\r\n");
QTest::newRow("quotes") << QByteArray("\"quoted \\ test\"") << QByteArray("single \" quote \\");
QTest::newRow("quotes") << QByteArray(R"("quoted \ test")") << QByteArray("single \" quote \\");
QTest::newRow("parenthesis") << QByteArray(")") << QByteArray("(");
QTest::newRow("binary") << QByteArray("\000") << QByteArray("\001");
}
......@@ -243,8 +243,8 @@ void CollectionAttributeTest::testDetach()
Collection col2 = col; // and a copy, so that non-const access detaches
// WHEN
auto *attr = col2.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing);
auto *attr2 = col2.attribute<TestAttribute>();
auto attr = col2.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing);
auto attr2 = col2.attribute<TestAttribute>();
// THEN
QCOMPARE(attr, attr2);
......
......@@ -97,7 +97,7 @@ private Q_SLOTS:
void testIlleagalCopy()
{
// invalid source
CollectionCopyJob *copy = new CollectionCopyJob(Collection(), Collection(1));
auto copy = new CollectionCopyJob(Collection(), Collection(1));
QVERIFY(!copy->exec());
// non-existing source
......
......@@ -86,7 +86,7 @@ static Collection::Id searchColId = -1;
void CollectionJobTest::testTopLevelList()
{
// non-recursive top-level list
CollectionFetchJob *job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel);
auto job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel);
AKVERIFYEXEC(job);
Collection::List list = job->collections();
......@@ -119,7 +119,7 @@ void CollectionJobTest::testTopLevelList()
void CollectionJobTest::testFolderList()
{
// recursive list of physical folders
CollectionFetchJob *job = new CollectionFetchJob(Collection(res1ColId), CollectionFetchJob::Recursive);
auto job = new CollectionFetchJob(Collection(res1ColId), CollectionFetchJob::Recursive);
QSignalSpy spy(job, &CollectionFetchJob::collectionsReceived);
QVERIFY(spy.isValid());
AKVERIFYEXEC(job);
......@@ -189,7 +189,7 @@ void CollectionJobTest::testSignalOrder()
void CollectionJobTest::testNonRecursiveFolderList()
{
CollectionFetchJob *job = new CollectionFetchJob(Collection(res1ColId), CollectionFetchJob::Base);
auto job = new CollectionFetchJob(Collection(res1ColId), CollectionFetchJob::Base);
AKVERIFYEXEC(job);
Collection::List list = job->collections();
......@@ -199,7 +199,7 @@ void CollectionJobTest::testNonRecursiveFolderList()
void CollectionJobTest::testEmptyFolderList()
{
CollectionFetchJob *job = new CollectionFetchJob(Collection(res3ColId), CollectionFetchJob::FirstLevel);
auto job = new CollectionFetchJob(Collection(res3ColId), CollectionFetchJob::FirstLevel);
AKVERIFYEXEC(job);
Collection::List list = job->collections();
......@@ -208,7 +208,7 @@ void CollectionJobTest::testEmptyFolderList()
void CollectionJobTest::testSearchFolderList()
{
CollectionFetchJob *job = new CollectionFetchJob(Collection(searchColId), CollectionFetchJob::FirstLevel);
auto job = new CollectionFetchJob(Collection(searchColId), CollectionFetchJob::FirstLevel);
AKVERIFYEXEC(job);
Collection::List list = job->collections();
......@@ -218,7 +218,7 @@ void CollectionJobTest::testSearchFolderList()
void CollectionJobTest::testResourceFolderList()
{
// non-existing resource
CollectionFetchJob *job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel);
auto job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel);
job->fetchScope().setResource(QStringLiteral("i_dont_exist"));
QVERIFY(!job->exec());
......@@ -248,7 +248,7 @@ void CollectionJobTest::testResourceFolderList()
void CollectionJobTest::testMimeTypeFilter()
{
CollectionFetchJob *job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive);
auto job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive);
job->fetchScope().setContentMimeTypes(QStringList() << QStringLiteral("message/rfc822"));
AKVERIFYEXEC(job);
......@@ -319,7 +319,7 @@ void CollectionJobTest::testCreateDeleteFolder_data()
col.parentCollection().setId(2);
QTest::newRow("already existing with different case") << col << true;
CollectionPathResolver *resolver = new CollectionPathResolver(QStringLiteral("res2/foo2"), this);
auto resolver = new CollectionPathResolver(QStringLiteral("res2/foo2"), this);
AKVERIFYEXEC(resolver);
col.parentCollection().setId(resolver->collection());
col.setName(QStringLiteral("new folder"));
......@@ -391,7 +391,7 @@ void CollectionJobTest::testCreateDeleteFolder()
void CollectionJobTest::testIllegalDeleteFolder()
{
// non-existing folder
CollectionDeleteJob *del = new CollectionDeleteJob(Collection(INT_MAX), this);
auto del = new CollectionDeleteJob(Collection(INT_MAX), this);
QVERIFY(!del->exec());
// root
......@@ -402,7 +402,7 @@ void CollectionJobTest::testIllegalDeleteFolder()
void CollectionJobTest::testStatistics()
{
// empty folder
CollectionStatisticsJob *statistics = new CollectionStatisticsJob(Collection(res1ColId), this);
auto statistics = new CollectionStatisticsJob(Collection(res1ColId), this);
AKVERIFYEXEC(statistics);
CollectionStatistics s = statistics->statistics();
......@@ -410,7 +410,7 @@ void CollectionJobTest::testStatistics()
QCOMPARE(s.unreadCount(), 0LL);
// folder with attributes and content
CollectionPathResolver *resolver = new CollectionPathResolver(QStringLiteral("res1/foo"), this);
auto resolver = new CollectionPathResolver(QStringLiteral("res1/foo"), this);
AKVERIFYEXEC(resolver);
statistics = new CollectionStatisticsJob(Collection(resolver->collection()), this);
AKVERIFYEXEC(statistics);
......@@ -440,7 +440,7 @@ void CollectionJobTest::testModify()
QFETCH(QString, rid);
if (!rid.isEmpty()) {
ResourceSelectJob *rjob = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"));
auto rjob = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"));
AKVERIFYEXEC(rjob);
}
......@@ -568,7 +568,7 @@ void CollectionJobTest::testUtf8CollectionName()
QCOMPARE(col.name(), folderName);
// list parent
CollectionFetchJob *list = new CollectionFetchJob(Collection(res3ColId), CollectionFetchJob::Recursive, this);
auto list = new CollectionFetchJob(Collection(res3ColId), CollectionFetchJob::Recursive, this);
AKVERIFYEXEC(list);
QCOMPARE(list->collections().count(), 1);
QCOMPARE(list->collections().first(), col);
......@@ -712,7 +712,7 @@ void CollectionJobTest::testRidCreateDelete()
collection.parentCollection().setRemoteId(QStringLiteral("8"));
collection.setRemoteId(remoteId);
ResourceSelectJob *resSel = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_2"));
auto resSel = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_2"));
AKVERIFYEXEC(resSel);
auto createJob = new CollectionCreateJob(collection, this);
......@@ -722,7 +722,7 @@ void CollectionJobTest::testRidCreateDelete()
QVERIFY(createdCol.isValid());
QCOMPARE(createdCol.name(), collection.name());
CollectionFetchJob *listJob = new CollectionFetchJob(Collection(res3ColId), CollectionFetchJob::FirstLevel, this);
auto listJob = new CollectionFetchJob(Collection(res3ColId), CollectionFetchJob::FirstLevel, this);
AKVERIFYEXEC(listJob);
Collection listedCol = findCol(listJob->collections(), collection.name());
QCOMPARE(listedCol, createdCol);
......@@ -753,7 +753,7 @@ void CollectionJobTest::testAncestorRetrieval()
QCOMPARE(col.parentCollection().remoteId(), QStringLiteral("6"));
QCOMPARE(col.parentCollection().parentCollection(), Collection::root());
ResourceSelectJob *select = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"), this);
auto select = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"), this);
AKVERIFYEXEC(select);
Collection col2(col);
col2.setId(-1); // make it invalid but keep the ancestor chain
......@@ -783,7 +783,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
auto create = new Akonadi::CollectionCreateJob(col);
AKVERIFYEXEC(create);
CollectionFetchJob *job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
auto job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
job->fetchScope().setAncestorRetrieval(CollectionFetchScope::All);
job->fetchScope().ancestorFetchScope().setFetchIdOnly(false);
job->fetchScope().ancestorFetchScope().fetchAttribute<TestAttribute>();
......@@ -815,7 +815,7 @@ void CollectionJobTest::testListPreference()
auto create = new Akonadi::CollectionCreateJob(col);
AKVERIFYEXEC(create);
CollectionFetchJob *job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
auto job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
AKVERIFYEXEC(job);
Akonadi::Collection result = job->collections().first();
QCOMPARE(result.enabled(), true);
......@@ -833,7 +833,7 @@ void CollectionJobTest::testListPreference()
col.setLocalListPreference(Collection::ListIndex, Collection::ListDisabled);
auto create = new Akonadi::CollectionCreateJob(col);
AKVERIFYEXEC(create);
CollectionFetchJob *job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
auto job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
AKVERIFYEXEC(job);
Akonadi::Collection result = job->collections().first();
QCOMPARE(result.enabled(), true);
......@@ -851,7 +851,7 @@ void CollectionJobTest::testListPreference()
col.setLocalListPreference(Collection::ListIndex, Collection::ListEnabled);
auto create = new Akonadi::CollectionCreateJob(col);
AKVERIFYEXEC(create);
CollectionFetchJob *job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
auto job = new CollectionFetchJob(create->collection(), CollectionFetchJob::Base);
AKVERIFYEXEC(job);
Akonadi::Collection result = job->collections().first();
QCOMPARE(result.enabled(), false);
......
......@@ -37,7 +37,7 @@ private Q_SLOTS:
col = cj->collection();
QVERIFY(col.isValid());
auto *attr = col.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
auto attr = col.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
attr->setDisplayName(QStringLiteral("Test Collection"));
col.setContentMimeTypes({Collection::mimeType(), QLatin1String("application/octet-stream")});
......
......@@ -22,7 +22,7 @@ void CollectionPathResolverTest::initTestCase()
void CollectionPathResolverTest::testPathResolver()
{
CollectionPathResolver *resolver = new CollectionPathResolver(QStringLiteral("/res1/foo/bar/bla"), this);
auto resolver = new CollectionPathResolver(QStringLiteral("/res1/foo/bar/bla"), this);
AKVERIFYEXEC(resolver);
int col = resolver->collection();
QVERIFY(col > 0);
......@@ -34,7 +34,7 @@ void CollectionPathResolverTest::testPathResolver()
void CollectionPathResolverTest::testRoot()
{
CollectionPathResolver *resolver = new CollectionPathResolver(CollectionPathResolver::pathDelimiter(), this);
auto resolver = new CollectionPathResolver(CollectionPathResolver::pathDelimiter(), this);
AKVERIFYEXEC(resolver);
QCOMPARE(resolver->collection(), Collection::root().id());
......@@ -45,7 +45,7 @@ void CollectionPathResolverTest::testRoot()
void CollectionPathResolverTest::testFailure()
{
CollectionPathResolver *resolver = new CollectionPathResolver(QStringLiteral("/I/do not/exist"), this);
auto resolver = new CollectionPathResolver(QStringLiteral("/I/do not/exist"), this);
QVERIFY(!resolver->exec());
resolver = new CollectionPathResolver(Collection(INT_MAX), this);
......
......@@ -30,7 +30,7 @@ class CollectionSyncTest : public QObject
private:
Collection::List fetchCollections(const QString &res)
{
CollectionFetchJob *fetch = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
auto fetch = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
fetch->fetchScope().setResource(res);
fetch->fetchScope().setAncestorRetrieval(CollectionFetchScope::All);
if (!fetch->exec()) {
......@@ -69,7 +69,7 @@ private:
{
Collection::List collections = fetchCollections(QStringLiteral("akonadi_knut_resource_0"));
ResourceSelectJob *resJob = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"));
auto resJob = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"));
Q_ASSERT(resJob->exec());
Collection root;
......@@ -104,7 +104,7 @@ private:
CollectionSync *prepareBenchmarkSyncer(const Collection::List &collections)
{
CollectionSync *syncer = new CollectionSync(QStringLiteral("akonadi_knut_resource_0"));
auto syncer = new CollectionSync(QStringLiteral("akonadi_knut_resource_0"));
connect(syncer, SIGNAL(percent(KJob *, ulong)), this, SLOT(syncBenchmarkProgress(KJob *, ulong)));
syncer->setHierarchicalRemoteIds(false);
syncer->setRemoteCollections(collections);
......
......@@ -25,24 +25,24 @@ void ConflictResolveDialogTest::shouldHaveDefaultValues()
QVERIFY(!dlg.windowTitle().isEmpty());
auto *takeLeftButton = dlg.findChild<QPushButton *>(QStringLiteral("takeLeftButton"));
auto takeLeftButton = dlg.findChild<QPushButton *>(QStringLiteral("takeLeftButton"));
QVERIFY(takeLeftButton);
QVERIFY(!takeLeftButton->text().isEmpty());
auto *takeRightButton = dlg.findChild<QPushButton *>(QStringLiteral("takeRightButton"));
auto takeRightButton = dlg.findChild<QPushButton *>(QStringLiteral("takeRightButton"));
QVERIFY(takeRightButton);
QVERIFY(!takeRightButton->text().isEmpty());
auto *keepBothButton = dlg.findChild<QPushButton *>(QStringLiteral("keepBothButton"));
auto keepBothButton = dlg.findChild<QPushButton *>(QStringLiteral("keepBothButton"));
QVERIFY(keepBothButton);
QVERIFY(!keepBothButton->text().isEmpty());
QVERIFY(keepBothButton->isDefault());
auto *mView = dlg.findChild<QTextBrowser *>(QStringLiteral("view"));
auto mView = dlg.findChild<QTextBrowser *>(QStringLiteral("view"));
QVERIFY(mView);
QVERIFY(mView->toPlainText().isEmpty());
auto *docuLabel = dlg.findChild<QLabel *>(QStringLiteral("doculabel"));
auto docuLabel = dlg.findChild<QLabel *>(QStringLiteral("doculabel"));
QVERIFY(docuLabel);
QVERIFY(!docuLabel->text().isEmpty());
QVERIFY(docuLabel->wordWrap());
......
......@@ -24,11 +24,11 @@ private Q_SLOTS:
QTest::addColumn<QString>("activeIcon");
QTest::addColumn<QByteArray>("output");
QTest::newRow("empty") << QByteArray("(\"\" \"\")") << QString() << QString() << QString() << QByteArray("(\"\" \"\" \"\" ())");
QTest::newRow("name+icon") << QByteArray("(\"name\" \"icon\")") << QStringLiteral("name") << QStringLiteral("icon") << QString()
<< QByteArray("(\"name\" \"icon\" \"\" ())");
QTest::newRow("name+icon+activeIcon") << QByteArray("(\"name\" \"icon\" \"activeIcon\")") << QStringLiteral("name") << QStringLiteral("icon")
<< QStringLiteral("activeIcon") << QByteArray("(\"name\" \"icon\" \"activeIcon\" ())");
QTest::newRow("empty") << QByteArray(R"(("" ""))") << QString() << QString() << QString() << QByteArray(R"(("" "" "" ()))");
QTest::newRow("name+icon") << QByteArray(R"(("name" "icon"))") << QStringLiteral("name") << QStringLiteral("icon") << QString()
<< QByteArray(R"(("name" "icon" "" ()))");
QTest::newRow("name+icon+activeIcon") << QByteArray(R"(("name" "icon" "activeIcon"))") << QStringLiteral("name") << QStringLiteral("icon")
<< QStringLiteral("activeIcon") << QByteArray(R"(("name" "icon" "activeIcon" ()))");
}
void testDeserialize()
......
......@@ -236,8 +236,8 @@ void EntityTreeModelTest::testCollectionMove()
QFETCH(QString, targetCollection);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto movedIndex = firstMatchedIndex(*model, movedCollection);
Q_ASSERT(movedIndex.isValid());
......@@ -289,7 +289,7 @@ void EntityTreeModelTest::testCollectionAdded()
QFETCH(QString, parentCollection);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto const serverData = testDrivers.first;
auto const addCommand = new FakeCollectionAddedCommand(addedCollection, parentCollection, serverData);
......@@ -332,8 +332,8 @@ void EntityTreeModelTest::testCollectionRemoved()
QFETCH(QString, removedCollection);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto removedIndex = firstMatchedIndex(*model, removedCollection);
const auto parentCollection = removedIndex.parent().data().toString();
......@@ -380,8 +380,8 @@ void EntityTreeModelTest::testCollectionChanged()
QFETCH(QString, monitoredMimeType); // ##### TODO: this is unused. Is this test correct?
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto changedIndex = firstMatchedIndex(*model, collectionName);
const auto parentCollection = changedIndex.parent().data().toString();
......@@ -431,8 +431,8 @@ void EntityTreeModelTest::testItemMove()
QFETCH(QString, targetCollection);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto movedIndex = firstMatchedIndex(*model, movedItem);
const auto sourceCollection = movedIndex.parent().data().toString();
......@@ -494,8 +494,8 @@ void EntityTreeModelTest::testItemAdded()
QFETCH(QString, parentCollection);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto parentIndex = firstMatchedIndex(*model, parentCollection);
const auto targetRow = model->rowCount(parentIndex);
......@@ -545,8 +545,8 @@ void EntityTreeModelTest::testItemRemoved()
QFETCH(QString, removedItem);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto removedIndex = firstMatchedIndex(*model, removedItem);
const auto sourceCollection = removedIndex.parent().data().toString();
......@@ -597,8 +597,8 @@ void EntityTreeModelTest::testItemChanged()
QFETCH(QString, changedItem);
const auto testDrivers = populateModel(serverContent);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto changedIndex = firstMatchedIndex(*model, changedItem);
const auto parentCollection = changedIndex.parent().data().toString();
......@@ -630,8 +630,8 @@ void EntityTreeModelTest::testRemoveCollectionOnChanged()
const auto monitoredMimeType = QStringLiteral("text/directory");
const auto testDrivers = populateModel(serverContent, monitoredMimeType);
auto *const serverData = testDrivers.first;
auto *const model = testDrivers.second;
auto const serverData = testDrivers.first;
auto const model = testDrivers.second;
const auto changedIndex = firstMatchedIndex(*model, collectionName);
auto changedCol = changedIndex.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
......
......@@ -42,7 +42,7 @@ bool FakeAkonadiServerCommand::isCollectionSignal(const QByteArray &signal) cons
void FakeAkonadiServerCommand::connectForwardingSignals()
{
const auto *mo = FakeAkonadiServerCommand::metaObject();
const auto mo = FakeAkonadiServerCommand::metaObject();
for (int methodIndex = 0; methodIndex < mo->methodCount(); ++methodIndex) {
const QMetaMethod mm = mo->method(methodIndex);
const QByteArray signature = mm.methodSignature();
......
......@@ -56,8 +56,8 @@ public:
private:
QHash<typename T::Id, T> m_data;
};
typedef FakeEntityCache<Akonadi::Collection, Akonadi::CollectionCache> FakeCollectionCache;
typedef FakeEntityCache<Akonadi::Item, Akonadi::ItemCache> FakeItemCache;
using FakeCollectionCache = FakeEntityCache<Akonadi::Collection, Akonadi::CollectionCache>;
using FakeItemCache = FakeEntityCache<Akonadi::Item, Akonadi::ItemCache>;
class AKONADITESTFAKE_EXPORT FakeNotificationSource : public QObject
{
......
......@@ -115,7 +115,7 @@ void FavoriteProxyTest::testItemAdded()
const QModelIndex res3Index = getIndex(QStringLiteral("res3"), model);
QVERIFY(res3Index.isValid());
const Akonadi::Collection favoriteCollection = res3Index.data(EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto favoriteCollection = res3Index.data(EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
QVERIFY(favoriteCollection.isValid());
QVERIFY(!model->etmPrivate()->isMonitored(favoriteCollection.id()));
......@@ -166,7 +166,7 @@ void FavoriteProxyTest::testLoadConfig()
QVERIFY(waitForPopulation(QModelIndex(), model, numberOfRootCollections));
const QModelIndex res3Index = getIndex(QStringLiteral("res3"), model);
QVERIFY(res3Index.isValid());
const Akonadi::Collection favoriteCollection = res3Index.data(EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto favoriteCollection = res3Index.data(EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
QVERIFY(favoriteCollection.isValid());
KConfigGroup configGroup(KSharedConfig::openConfig(), "favoritecollectionsmodeltest");
......@@ -206,7 +206,7 @@ void FavoriteProxyTest::testInsertAfterModelCreation()
QVERIFY(waitForPopulation(QModelIndex(), model, numberOfRootCollections));
const QModelIndex res3Index = getIndex(QStringLiteral("res3"), model);
QVERIFY(res3Index.isValid());
const Akonadi::Collection favoriteCollection = res3Index.data(EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto favoriteCollection = res3Index.data(EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
QVERIFY(favoriteCollection.isValid());
KConfigGroup configGroup(KSharedConfig::openConfig(), "favoritecollectionsmodeltest2");
......
......@@ -124,7 +124,7 @@ void GidTest::testCreate()
item.setMimeType(QStringLiteral("application/octet-stream"));
item.setPayload<QByteArray>(QByteArray("test"));
item.setGid(QStringLiteral("createGid"));
ItemCreateJob *createJob = new ItemCreateJob(item, Collection(colId), this);
auto createJob = new ItemCreateJob(item, Collection(colId), this);
AKVERIFYEXEC(createJob);
auto fetch = new ItemFetchJob(item, this);
AKVERIFYEXEC(fetch);
......@@ -165,7 +165,7 @@ void GidTest::testFetchScope()
item.setMimeType(QStringLiteral("application/octet-stream"));
item.setPayload<QByteArray>(QByteArray("test"));
item.setGid(QStringLiteral("createGid2"));
ItemCreateJob *createJob = new ItemCreateJob(item, Collection(colId), this);
auto createJob = new ItemCreateJob(item, Collection(colId), this);
AKVERIFYEXEC(createJob);
{
auto fetch = new ItemFetchJob(item, this);
......
......@@ -161,7 +161,7 @@ void ItemAppendTest::testIllegalAppend()
item.setMimeType(QStringLiteral("application/octet-stream"));
// adding item to non-existing collection
ItemCreateJob *job = new ItemCreateJob(item, Collection(INT_MAX), this);
auto job = new ItemCreateJob(item, Collection(INT_MAX), this);
QVERIFY(!job->exec());
// adding item into a collection which can't handle items of this type
......@@ -208,7 +208,7 @@ void ItemAppendTest::testInvalidMultipartAppend()
item.setPayload<QByteArray>("body data");
item.attribute<TestAttribute>(Item::AddIfMissing)->data = "extra data";
item.setFlag("TestFlag");
ItemCreateJob *job = new ItemCreateJob(item, Collection(-1), this);
auto job = new ItemCreateJob(item, Collection(-1), this);
QVERIFY(!job->exec());
Item item2;
......@@ -216,7 +216,7 @@ void ItemAppendTest::testInvalidMultipartAppend()
item2.setPayload<QByteArray>("more body data");
item2.attribute<TestAttribute>(Item::AddIfMissing)->data = "even more extra data";
item2.setFlag("TestFlag");
ItemCreateJob *job2 = new ItemCreateJob(item2, Collection(-1), this);
auto job2 = new ItemCreateJob(item2, Collection(-1), this);
QVERIFY(!job2->exec());
}
......@@ -342,7 +342,7 @@ void ItemAppendTest::testItemMerge()
}
if (merge->item().id() != createdItem.id()) {
ItemDeleteJob *del = new ItemDeleteJob(merge->item(), this);
auto del = new ItemDeleteJob(merge->item(), this);
AKVERIFYEXEC(del);
}
auto del = new ItemDeleteJob(createdItem, this);
......
......@@ -42,7 +42,7 @@ private Q_SLOTS:
const Collection target(AkonadiTest::collectionIdFromPath(QStringLiteral("res3")));
QVERIFY(target.isValid());
ItemCopyJob *copy = new ItemCopyJob(Item(1), target);
auto copy = new ItemCopyJob(Item(1), target);
AKVERIFYEXEC(copy);
Item source(1);
......@@ -71,7 +71,7 @@ private Q_SLOTS:
void testIlleagalCopy()
{
// empty item list
ItemCopyJob *copy = new ItemCopyJob(Item::List(), Collection::root());
auto copy = new ItemCopyJob(Item::List(), Collection::root());
QVERIFY(!copy->exec());