Commit ff0f48c9 authored by Volker Krause's avatar Volker Krause
Browse files

Adapt to KCalendarCore namespace change

parent 3d745ee2
......@@ -24,8 +24,8 @@
#include "xapiandocument.h"
#include "akonadi_indexer_agent_debug.h"
#include <KCalCore/Attendee>
#include <KCalCore/Event>
#include <KCalendarCore/Attendee>
#include <KCalendarCore/Event>
CalendarIndexer::CalendarIndexer(const QString &path)
......@@ -61,12 +61,12 @@ QStringList CalendarIndexer::mimeTypes() const
void CalendarIndexer::index(const Akonadi::Item &item)
{
if (item.hasPayload<KCalCore::Event::Ptr>()) {
indexEventItem(item, item.payload<KCalCore::Event::Ptr>());
} else if (item.hasPayload<KCalCore::Journal::Ptr>()) {
indexJournalItem(item, item.payload<KCalCore::Journal::Ptr>());
} else if (item.hasPayload<KCalCore::Todo::Ptr>()) {
indexTodoItem(item, item.payload<KCalCore::Todo::Ptr>());
if (item.hasPayload<KCalendarCore::Event::Ptr>()) {
indexEventItem(item, item.payload<KCalendarCore::Event::Ptr>());
} else if (item.hasPayload<KCalendarCore::Journal::Ptr>()) {
indexJournalItem(item, item.payload<KCalendarCore::Journal::Ptr>());
} else if (item.hasPayload<KCalendarCore::Todo::Ptr>()) {
indexTodoItem(item, item.payload<KCalendarCore::Todo::Ptr>());
} else {
return;
}
......@@ -134,16 +134,16 @@ void CalendarIndexer::move(Akonadi::Item::Id itemId,
m_db->replaceDocument(doc.get_docid(), doc);
}
void CalendarIndexer::indexEventItem(const Akonadi::Item &item, const KCalCore::Event::Ptr &event)
void CalendarIndexer::indexEventItem(const Akonadi::Item &item, const KCalendarCore::Event::Ptr &event)
{
Akonadi::Search::XapianDocument doc;
doc.indexText(event->organizer().email(), QStringLiteral("O"));
doc.indexText(event->summary(), QStringLiteral("S"));
doc.indexText(event->location(), QStringLiteral("L"));
KCalCore::Attendee::List attendees = event->attendees();
KCalCore::Attendee::List::ConstIterator it;
KCalCore::Attendee::List::ConstIterator end(attendees.constEnd());
KCalendarCore::Attendee::List attendees = event->attendees();
KCalendarCore::Attendee::List::ConstIterator it;
KCalendarCore::Attendee::List::ConstIterator end(attendees.constEnd());
for (it = attendees.constBegin(); it != end; ++it) {
doc.addBoolTerm((*it).email() + QString::number((*it).status()), QStringLiteral("PS"));
}
......@@ -158,21 +158,21 @@ void CalendarIndexer::indexEventItem(const Akonadi::Item &item, const KCalCore::
m_db->replaceDocument(item.id(), doc);
}
void CalendarIndexer::indexJournalItem(const Akonadi::Item &item, const KCalCore::Journal::Ptr &journal)
void CalendarIndexer::indexJournalItem(const Akonadi::Item &item, const KCalendarCore::Journal::Ptr &journal)
{
//TODO
Q_UNUSED(item);
Q_UNUSED(journal);
}
void CalendarIndexer::indexTodoItem(const Akonadi::Item &item, const KCalCore::Todo::Ptr &todo)
void CalendarIndexer::indexTodoItem(const Akonadi::Item &item, const KCalendarCore::Todo::Ptr &todo)
{
//TODO
Q_UNUSED(item);
Q_UNUSED(todo);
}
void CalendarIndexer::updateIncidenceItem(const KCalCore::Incidence::Ptr &calInc)
void CalendarIndexer::updateIncidenceItem(const KCalendarCore::Incidence::Ptr &calInc)
{
//TODO
Q_UNUSED(calInc);
......
......@@ -28,9 +28,9 @@
#include <AkonadiCore/Collection>
#include <AkonadiCore/Item>
#include <KCalCore/Journal>
#include <KCalCore/Event>
#include <KCalCore/Todo>
#include <KCalendarCore/Journal>
#include <KCalendarCore/Event>
#include <KCalendarCore/Todo>
class CalendarIndexer : public AbstractIndexer
{
......@@ -53,10 +53,10 @@ public:
Akonadi::Collection::Id from,
Akonadi::Collection::Id to) override;
private:
void indexEventItem(const Akonadi::Item &item, const KCalCore::Event::Ptr &event);
void indexJournalItem(const Akonadi::Item &item, const KCalCore::Journal::Ptr &journal);
void indexTodoItem(const Akonadi::Item &item, const KCalCore::Todo::Ptr &todo);
void updateIncidenceItem(const KCalCore::Incidence::Ptr &calInc);
void indexEventItem(const Akonadi::Item &item, const KCalendarCore::Event::Ptr &event);
void indexJournalItem(const Akonadi::Item &item, const KCalendarCore::Journal::Ptr &journal);
void indexTodoItem(const Akonadi::Item &item, const KCalendarCore::Todo::Ptr &todo);
void updateIncidenceItem(const KCalendarCore::Incidence::Ptr &calInc);
Akonadi::Search::XapianDatabase *m_db = nullptr;
};
......
......@@ -393,25 +393,25 @@ private Q_SLOTS:
// Calendar item
{
KCalCore::Event::Ptr event(new KCalCore::Event);
KCalCore::Attendee attendee(QStringLiteral("attendee1"), QStringLiteral("attendee1@example.com"), false, KCalCore::Attendee::NeedsAction);
KCalendarCore::Event::Ptr event(new KCalendarCore::Event);
KCalendarCore::Attendee attendee(QStringLiteral("attendee1"), QStringLiteral("attendee1@example.com"), false, KCalendarCore::Attendee::NeedsAction);
event->setOrganizer(QStringLiteral("organizer@example.com"));
event->addAttendee(attendee);
attendee = KCalCore::Attendee(QStringLiteral("attendee2"), QStringLiteral("attendee2@example.com"), false, KCalCore::Attendee::Accepted);
attendee = KCalendarCore::Attendee(QStringLiteral("attendee2"), QStringLiteral("attendee2@example.com"), false, KCalendarCore::Attendee::Accepted);
event->addAttendee(attendee);
attendee = KCalCore::Attendee(QStringLiteral("attendee3"), QStringLiteral("attendee3@example.com"), false, KCalCore::Attendee::Declined);
attendee = KCalendarCore::Attendee(QStringLiteral("attendee3"), QStringLiteral("attendee3@example.com"), false, KCalendarCore::Attendee::Declined);
event->addAttendee(attendee);
attendee = KCalCore::Attendee(QStringLiteral("attendee4"), QStringLiteral("attendee4@example.com"), false, KCalCore::Attendee::Tentative);
attendee = KCalendarCore::Attendee(QStringLiteral("attendee4"), QStringLiteral("attendee4@example.com"), false, KCalendarCore::Attendee::Tentative);
event->addAttendee(attendee);
attendee = KCalCore::Attendee(QStringLiteral("attendee5"), QStringLiteral("attendee5@example.com"), false, KCalCore::Attendee::Delegated);
attendee = KCalendarCore::Attendee(QStringLiteral("attendee5"), QStringLiteral("attendee5@example.com"), false, KCalendarCore::Attendee::Delegated);
event->addAttendee(attendee);
event->setSummary(QStringLiteral("title"));
event->setLocation(QStringLiteral("here"));
Akonadi::Item item(KCalCore::Event::eventMimeType());
Akonadi::Item item(KCalendarCore::Event::eventMimeType());
item.setId(2001);
item.setPayload<KCalCore::Event::Ptr>(event);
item.setPayload<KCalendarCore::Event::Ptr>(event);
item.setParentCollection(Akonadi::Collection(6));
calendarIndexer.index(item);
}
......@@ -440,7 +440,7 @@ private Q_SLOTS:
QTest::addColumn<QVector<qint64> >("collections");
QTest::addColumn<QStringList>("mimeTypes");
QTest::addColumn<QSet<qint64> >("expectedResult");
const QStringList calendarMimeTypes = QStringList() << KCalCore::Event::eventMimeType();
const QStringList calendarMimeTypes = QStringList() << KCalendarCore::Event::eventMimeType();
{
Akonadi::SearchQuery query;
query.addTerm(Akonadi::IncidenceSearchTerm(Akonadi::IncidenceSearchTerm::Organizer, QStringLiteral("organizer@example.com"), Akonadi::SearchTerm::CondEqual));
......
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