Commit 86b7e812 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

GIT_SILENT: coding style

parent 17658b3f
......@@ -29,18 +29,14 @@ AbstractIndexer::~AbstractIndexer()
{
}
void AbstractIndexer::move(Akonadi::Item::Id item,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to)
void AbstractIndexer::move(Akonadi::Item::Id item, Akonadi::Collection::Id from, Akonadi::Collection::Id to)
{
Q_UNUSED(item);
Q_UNUSED(from);
Q_UNUSED(to);
}
void AbstractIndexer::updateFlags(const Akonadi::Item &item,
const QSet<QByteArray> &addedFlags,
const QSet<QByteArray> &removed)
void AbstractIndexer::updateFlags(const Akonadi::Item &item, const QSet<QByteArray> &addedFlags, const QSet<QByteArray> &removed)
{
Q_UNUSED(item);
Q_UNUSED(addedFlags);
......
......@@ -25,8 +25,7 @@
#include <AkonadiCore/Item>
#include <QStringList>
namespace Akonadi
{
namespace Akonadi {
class Collection;
}
......@@ -42,12 +41,8 @@ public:
virtual void remove(const Akonadi::Collection &item) = 0;
virtual void commit() = 0;
virtual void move(Akonadi::Item::Id item,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to);
virtual void updateFlags(const Akonadi::Item &item,
const QSet<QByteArray> &addedFlags,
const QSet<QByteArray> &removed);
virtual void move(Akonadi::Item::Id item, Akonadi::Collection::Id from, Akonadi::Collection::Id to);
virtual void updateFlags(const Akonadi::Item &item, const QSet<QByteArray> &addedFlags, const QSet<QByteArray> &removed);
};
#endif // ABSTRACTINDEXER_H
......@@ -47,12 +47,11 @@
#include <KLocalizedString>
#include "akonadi_indexer_agent_debug.h"
#define INDEXING_AGENT_VERSION 5
AkonadiIndexingAgent::AkonadiIndexingAgent(const QString &id)
: AgentBase(id),
m_scheduler(m_index, config(), QSharedPointer<JobFactory>(new JobFactory))
: AgentBase(id)
, m_scheduler(m_index, config(), QSharedPointer<JobFactory>(new JobFactory))
{
lowerIOPriority();
lowerSchedulingPriority();
......@@ -187,9 +186,7 @@ void AkonadiIndexingAgent::itemChanged(const Akonadi::Item &item, const QSet<QBy
m_scheduler.addItem(item);
}
void AkonadiIndexingAgent::itemsFlagsChanged(const Akonadi::Item::List &items,
const QSet<QByteArray> &addedFlags,
const QSet<QByteArray> &removedFlags)
void AkonadiIndexingAgent::itemsFlagsChanged(const Akonadi::Item::List &items, const QSet<QByteArray> &addedFlags, const QSet<QByteArray> &removedFlags)
{
// We optimize and skip the "shouldIndex" call for each item here, since it's
// cheaper to just let Xapian throw an exception for items that were not
......@@ -214,9 +211,7 @@ void AkonadiIndexingAgent::itemsRemoved(const Akonadi::Item::List &items)
m_index.scheduleCommit();
}
void AkonadiIndexingAgent::itemsMoved(const Akonadi::Item::List &items,
const Akonadi::Collection &sourceCollection,
const Akonadi::Collection &destinationCollection)
void AkonadiIndexingAgent::itemsMoved(const Akonadi::Item::List &items, const Akonadi::Collection &sourceCollection, const Akonadi::Collection &destinationCollection)
{
const bool indexSource = shouldIndex(sourceCollection);
const bool indexDest = shouldIndex(destinationCollection);
......@@ -237,8 +232,7 @@ void AkonadiIndexingAgent::itemsMoved(const Akonadi::Item::List &items,
}
}
void AkonadiIndexingAgent::collectionAdded(const Akonadi::Collection &collection,
const Akonadi::Collection &parent)
void AkonadiIndexingAgent::collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent)
{
Q_UNUSED(parent);
......@@ -250,8 +244,7 @@ void AkonadiIndexingAgent::collectionAdded(const Akonadi::Collection &collection
m_index.scheduleCommit();
}
void AkonadiIndexingAgent::collectionChanged(const Akonadi::Collection &collection,
const QSet<QByteArray> &changedAttributes)
void AkonadiIndexingAgent::collectionChanged(const Akonadi::Collection &collection, const QSet<QByteArray> &changedAttributes)
{
if (changedAttributes.contains(Akonadi::IndexPolicyAttribute().type())) {
const auto attr = collection.attribute<Akonadi::IndexPolicyAttribute>();
......@@ -294,9 +287,7 @@ void AkonadiIndexingAgent::collectionRemoved(const Akonadi::Collection &collecti
m_index.scheduleCommit();
}
void AkonadiIndexingAgent::collectionMoved(const Akonadi::Collection &collection,
const Akonadi::Collection &collectionSource,
const Akonadi::Collection &collectionDestination)
void AkonadiIndexingAgent::collectionMoved(const Akonadi::Collection &collection, const Akonadi::Collection &collectionSource, const Akonadi::Collection &collectionDestination)
{
Q_UNUSED(collectionSource);
Q_UNUSED(collectionDestination);
......
......@@ -31,7 +31,6 @@
#include "scheduler.h"
#include "index.h"
class AkonadiIndexingAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::ObserverV3
{
Q_OBJECT
......@@ -48,19 +47,14 @@ public:
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override;
void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers) override;
void itemsFlagsChanged(const Akonadi::Item::List &items,
const QSet<QByteArray> &addedFlags,
const QSet<QByteArray> &removedFlags) override;
void itemsFlagsChanged(const Akonadi::Item::List &items, const QSet<QByteArray> &addedFlags, const QSet<QByteArray> &removedFlags) override;
void itemsRemoved(const Akonadi::Item::List &items) override;
void itemsMoved(const Akonadi::Item::List &items,
const Akonadi::Collection &sourceCollection,
const Akonadi::Collection &destinationCollection) override;
void itemsMoved(const Akonadi::Item::List &items, const Akonadi::Collection &sourceCollection, const Akonadi::Collection &destinationCollection) override;
void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) override;
void collectionChanged(const Akonadi::Collection &collection, const QSet<QByteArray> &changedAttributes) override;
void collectionRemoved(const Akonadi::Collection &collection) override;
void collectionMoved(const Akonadi::Collection &collection, const Akonadi::Collection &collectionSource,
const Akonadi::Collection &collectionDestination) override;
void collectionMoved(const Akonadi::Collection &collection, const Akonadi::Collection &collectionSource, const Akonadi::Collection &collectionDestination) override;
// Remove the entire db
void cleanup() override;
......
......@@ -25,7 +25,10 @@
#include <QTextDocument>
AkonotesIndexer::AkonotesIndexer(const QString &path)
: AbstractIndexer(), m_db(nullptr), m_doc(nullptr), m_termGen(nullptr)
: AbstractIndexer()
, m_db(nullptr)
, m_doc(nullptr)
, m_termGen(nullptr)
{
try {
m_db = new Xapian::WritableDatabase(path.toUtf8().constData(), Xapian::DB_CREATE_OR_OPEN);
......@@ -176,9 +179,7 @@ void AkonotesIndexer::remove(const Akonadi::Collection &collection)
}
}
void AkonotesIndexer::move(Akonadi::Item::Id itemId,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to)
void AkonotesIndexer::move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to)
{
if (!m_db) {
return;
......@@ -197,4 +198,3 @@ void AkonotesIndexer::move(Akonadi::Item::Id itemId,
doc.add_boolean_term(tt.data());
m_db->replace_document(doc.get_docid(), doc);
}
......@@ -48,9 +48,7 @@ public:
void remove(const Akonadi::Item &item) override;
void remove(const Akonadi::Collection &collection) override;
void move(Akonadi::Item::Id itemId,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to) override;
void move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to) override;
private:
void processPart(KMime::Content *content, KMime::Content *mainContent);
void process(const KMime::Message::Ptr &msg);
......
......@@ -36,29 +36,53 @@ public:
QList<Akonadi::Item::Id> alreadyIndexed;
QList<Akonadi::Item::Id> itemsRemoved;
void commit() override {}
bool createIndexers() override {
void commit() override
{
}
bool createIndexers() override
{
return true;
}
void findIndexed(QSet< Akonadi::Item::Id> &indexed, Akonadi::Collection::Id) override {
void findIndexed(QSet< Akonadi::Item::Id> &indexed, Akonadi::Collection::Id) override
{
indexed = alreadyIndexed.toSet();
}
void index(const Akonadi::Item &item) override {
void index(const Akonadi::Item &item) override
{
itemsIndexed << item.id();
}
qlonglong indexedItems(Akonadi::Collection::Id) override {
qlonglong indexedItems(Akonadi::Collection::Id) override
{
return alreadyIndexed.size();
}
void move(const Akonadi::Item::List & /* items */,
const Akonadi::Collection & /* from */,
const Akonadi::Collection & /* to */) override {}
void remove(const Akonadi::Collection & /* col */) override {}
void remove(const QSet<Akonadi::Item::Id> &ids, const QStringList & /* mimeTypes */) override {
void move(const Akonadi::Item::List & /* items */, const Akonadi::Collection & /* from */, const Akonadi::Collection & /* to */) override
{
}
void remove(const Akonadi::Collection & /* col */) override
{
}
void remove(const QSet<Akonadi::Item::Id> &ids, const QStringList & /* mimeTypes */) override
{
itemsRemoved += ids.values();
}
void remove(const Akonadi::Item::List & /* items */) override {}
void removeDatabase() override {}
bool haveIndexerForMimeTypes(const QStringList &) override {
void remove(const Akonadi::Item::List & /* items */) override
{
}
void removeDatabase() override
{
}
bool haveIndexerForMimeTypes(const QStringList &) override
{
return true;
}
};
......@@ -138,7 +162,6 @@ private Q_SLOTS:
QCOMPARE(index.itemsIndexed.size(), 3);
QCOMPARE(index.itemsRemoved.size(), 3);
}
};
QTEST_MAIN(CollectionIndexingJobTest)
......
......@@ -72,7 +72,6 @@ private Q_SLOTS:
dbPrefix = QDir::tempPath() + QLatin1String("/collectiontest");
index.setOverrideDbPrefixPath(dbPrefix);
index.createIndexers();
}
void cleanup()
......@@ -144,7 +143,6 @@ private Q_SLOTS:
QCOMPARE(results.size(), 1);
QCOMPARE(results.at(0), col2.id());
}
}
QList<qint64> getResults(Akonadi::Search::PIM::ResultIterator it)
......@@ -224,10 +222,8 @@ private Q_SLOTS:
QCOMPARE(results.at(0), col3.id());
}
}
};
QTEST_GUILESS_MAIN(CollectionQueryTest)
#include "collectionquerytest.moc"
......@@ -157,4 +157,3 @@ private Q_SLOTS:
QTEST_GUILESS_MAIN(IndexerTest)
#include "indexertest.moc"
......@@ -34,15 +34,14 @@ class DummyIndexingJob : public CollectionIndexingJob
{
Q_OBJECT
public:
DummyIndexingJob(Index &index, const Akonadi::Collection &col,
const QList<Akonadi::Item::Id> &pending, QObject *parent = nullptr)
DummyIndexingJob(Index &index, const Akonadi::Collection &col, const QList<Akonadi::Item::Id> &pending, QObject *parent = nullptr)
: CollectionIndexingJob(index, col, pending, parent)
{
}
void start() override {
QMetaObject::invokeMethod(this, &DummyIndexingJob::finish, Qt::QueuedConnection);
void start() override
{
QMetaObject::invokeMethod(this, &DummyIndexingJob::finish, Qt::QueuedConnection);
}
private Q_SLOTS:
......@@ -59,12 +58,9 @@ public:
Akonadi::Item::List indexedItems;
QList<bool> fullSyncs;
CollectionIndexingJob *createCollectionIndexingJob(Index &index,
const Akonadi::Collection &col,
const QList<Akonadi::Item::Id> &pending,
bool fullSync, QObject *parent = nullptr) override {
for (qint64 id : pending)
{
CollectionIndexingJob *createCollectionIndexingJob(Index &index, const Akonadi::Collection &col, const QList<Akonadi::Item::Id> &pending, bool fullSync, QObject *parent = nullptr) override
{
for (qint64 id : pending) {
indexedItems << Akonadi::Item(id);
}
indexedCollections << col;
......@@ -83,6 +79,7 @@ private Q_SLOTS:
qRegisterMetaType<Akonadi::Collection::Id>("Akonadi::Collection::Id");
QStandardPaths::setTestModeEnabled(true);
}
void init()
{
AkonadiTest::checkTestIsIsolated();
......@@ -205,11 +202,9 @@ private Q_SLOTS:
QVERIFY(factory->fullSyncs.at(0));
QCOMPARE(finishedIndexing.count(), 1);
}
};
QTEST_MAIN(SchedulerTest)
#include "schedulertest.moc"
......@@ -27,9 +27,9 @@
#include <KCalendarCore/Attendee>
#include <KCalendarCore/Event>
CalendarIndexer::CalendarIndexer(const QString &path)
: AbstractIndexer(), m_db(nullptr)
: AbstractIndexer()
, m_db(nullptr)
{
try {
m_db = new Akonadi::Search::XapianDatabase(path, true);
......@@ -54,9 +54,9 @@ CalendarIndexer::~CalendarIndexer()
QStringList CalendarIndexer::mimeTypes() const
{
return QStringList() << QStringLiteral("application/x-vnd.akonadi.calendar.event")
<< QStringLiteral("application/x-vnd.akonadi.calendar.todo")
<< QStringLiteral("application/x-vnd.akonadi.calendar.journal")
<< QStringLiteral("application/x-vnd.akonadi.calendar.freebusy");
<< QStringLiteral("application/x-vnd.akonadi.calendar.todo")
<< QStringLiteral("application/x-vnd.akonadi.calendar.journal")
<< QStringLiteral("application/x-vnd.akonadi.calendar.freebusy");
}
void CalendarIndexer::index(const Akonadi::Item &item)
......@@ -112,9 +112,7 @@ void CalendarIndexer::remove(const Akonadi::Collection &collection)
}
}
void CalendarIndexer::move(Akonadi::Item::Id itemId,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to)
void CalendarIndexer::move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to)
{
if (!m_db) {
return;
......
......@@ -49,9 +49,7 @@ public:
void remove(const Akonadi::Item &item) override;
void remove(const Akonadi::Collection &collection) override;
void move(Akonadi::Item::Id itemId,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to) override;
void move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to) override;
private:
void indexEventItem(const Akonadi::Item &item, const KCalendarCore::Event::Ptr &event);
void indexJournalItem(const Akonadi::Item &item, const KCalendarCore::Journal::Ptr &journal);
......
......@@ -154,9 +154,7 @@ void CollectionIndexer::remove(const Akonadi::Collection &col)
}
}
void CollectionIndexer::move(const Akonadi::Collection &collection,
const Akonadi::Collection &from,
const Akonadi::Collection &to)
void CollectionIndexer::move(const Akonadi::Collection &collection, const Akonadi::Collection &from, const Akonadi::Collection &to)
{
Q_UNUSED(from);
Q_UNUSED(to);
......
......@@ -25,8 +25,7 @@
#include <AkonadiCore/collection.h>
#include <QString>
namespace Xapian
{
namespace Xapian {
class WritableDatabase;
}
......@@ -40,9 +39,7 @@ public:
void index(const Akonadi::Collection &collection);
void change(const Akonadi::Collection &collection);
void remove(const Akonadi::Collection &col);
void move(const Akonadi::Collection &collection,
const Akonadi::Collection &from,
const Akonadi::Collection &to);
void move(const Akonadi::Collection &collection, const Akonadi::Collection &from, const Akonadi::Collection &to);
void commit();
private:
......
......@@ -31,18 +31,15 @@
#include <AkonadiCore/IndexPolicyAttribute>
#include <KLocalizedString>
CollectionIndexingJob::CollectionIndexingJob(Index &index, const Akonadi::Collection &col,
const QList<Akonadi::Item::Id> &pending,
QObject *parent)
: KJob(parent),
m_collection(col),
m_pending(pending),
m_index(index),
m_reindexingLock(false),
m_fullSync(true),
m_progressTotal(0)
CollectionIndexingJob::CollectionIndexingJob(Index &index, const Akonadi::Collection &col, const QList<Akonadi::Item::Id> &pending, QObject *parent)
: KJob(parent)
, m_collection(col)
, m_pending(pending)
, m_index(index)
, m_reindexingLock(false)
, m_fullSync(true)
, m_progressTotal(0)
{
}
void CollectionIndexingJob::setFullSync(bool enable)
......@@ -74,8 +71,8 @@ void CollectionIndexingJob::slotOnCollectionFetched(KJob *job)
}
m_collection = static_cast<Akonadi::CollectionFetchJob *>(job)->collections().at(0);
if (m_collection.isVirtual()
|| (m_collection.hasAttribute<Akonadi::IndexPolicyAttribute>()
&& !m_collection.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled())) {
|| (m_collection.hasAttribute<Akonadi::IndexPolicyAttribute>()
&& !m_collection.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled())) {
emitResult();
return;
}
......@@ -236,4 +233,3 @@ void CollectionIndexingJob::slotFoundUnindexed(KJob *job)
qCDebug(AKONADI_INDEXER_AGENT_LOG) << "Indexing complete. Total time: " << m_time.elapsed();
emitResult();
}
......@@ -38,9 +38,7 @@ class CollectionIndexingJob : public KJob
{
Q_OBJECT
public:
explicit CollectionIndexingJob(Index &index, const Akonadi::Collection &col,
const QList<Akonadi::Item::Id> &pending,
QObject *parent = nullptr);
explicit CollectionIndexingJob(Index &index, const Akonadi::Collection &col, const QList<Akonadi::Item::Id> &pending, QObject *parent = nullptr);
void setFullSync(bool);
void start() override;
......
......@@ -28,11 +28,10 @@
#include <AkonadiCore/IndexPolicyAttribute>
CollectionUpdateJob::CollectionUpdateJob(Index &index, const Akonadi::Collection &col, QObject *parent)
: KJob(parent),
mCol(col),
mIndex(index)
: KJob(parent)
, mCol(col)
, mIndex(index)
{
}
void CollectionUpdateJob::start()
......
......@@ -49,4 +49,3 @@ private:
};
#endif
......@@ -28,8 +28,9 @@
#include <KContacts/ContactGroup>
#include <Collection>
ContactIndexer::ContactIndexer(const QString &path):
AbstractIndexer(), m_db(nullptr)
ContactIndexer::ContactIndexer(const QString &path)
: AbstractIndexer()
, m_db(nullptr)
{
try {
m_db = new Akonadi::Search::XapianDatabase(path, true);
......@@ -181,9 +182,7 @@ void ContactIndexer::commit()
}
}
void ContactIndexer::move(Akonadi::Item::Id itemId,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to)
void ContactIndexer::move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to)
{
if (!m_db) {
return;
......@@ -203,4 +202,3 @@ void ContactIndexer::move(Akonadi::Item::Id itemId,
doc.addBoolTerm(QString::fromLatin1(tt.data()));
m_db->replaceDocument(doc.doc().get_docid(), doc);
}
......@@ -26,7 +26,7 @@
#include "abstractindexer.h"
#include "xapiandatabase.h"
class ContactIndexer: public AbstractIndexer
class ContactIndexer : public AbstractIndexer
{
public:
explicit ContactIndexer(const QString &path);
......@@ -40,9 +40,7 @@ public:
void commit() override;
void move(Akonadi::Item::Id itemId,
Akonadi::Collection::Id from,
Akonadi::Collection::Id to) override;
void move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to) override;
private:
bool indexContact(const Akonadi::Item &item);
void indexContactGroup(const Akonadi::Item &item);
......
Markdown is supported
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