File indexing completed on 2024-05-12 05:11:15
0001 /* 0002 * This file is part of the KDE Akonadi Search Project 0003 * SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 * 0007 */ 0008 0009 #pragma once 0010 0011 #include "abstractindexer.h" 0012 #include "xapiandatabase.h" 0013 0014 #include <Akonadi/Collection> 0015 #include <Akonadi/Item> 0016 #include <KCalendarCore/Event> 0017 #include <KCalendarCore/Journal> 0018 #include <KCalendarCore/Todo> 0019 #include <memory> 0020 0021 class CalendarIndexer : public AbstractIndexer 0022 { 0023 public: 0024 /** 0025 * You must provide the path where the indexed information 0026 * should be stored 0027 */ 0028 explicit CalendarIndexer(const QString &path); 0029 ~CalendarIndexer() override; 0030 0031 [[nodiscard]] QStringList mimeTypes() const override; 0032 0033 void index(const Akonadi::Item &item) override; 0034 void commit() override; 0035 0036 void remove(const Akonadi::Item &item) override; 0037 void remove(const Akonadi::Collection &collection) override; 0038 void move(Akonadi::Item::Id itemId, Akonadi::Collection::Id from, Akonadi::Collection::Id to) override; 0039 0040 private: 0041 void indexEventItem(const Akonadi::Item &item, const KCalendarCore::Event::Ptr &event); 0042 void indexJournalItem(const Akonadi::Item &item, const KCalendarCore::Journal::Ptr &journal); 0043 void indexTodoItem(const Akonadi::Item &item, const KCalendarCore::Todo::Ptr &todo); 0044 void updateIncidenceItem(const KCalendarCore::Incidence::Ptr &calInc); 0045 0046 std::unique_ptr<Akonadi::Search::XapianDatabase> m_db = nullptr; 0047 };