File indexing completed on 2024-11-17 04:45:02

0001 /*
0002     SPDX-FileCopyrightText: 2011-2013 Daniel Vrátil <dvratil@redhat.com>
0003     SPDX-FileCopyrightText: 2020 Igor Poboiko <igor.poboiko@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-3.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "generichandler.h"
0011 
0012 class TaskHandler : public GenericHandler
0013 {
0014 public:
0015     using GenericHandler::GenericHandler;
0016 
0017     QString mimeType() override;
0018     bool canPerformTask(const Akonadi::Item &item) override;
0019     bool canPerformTask(const Akonadi::Item::List &items) override;
0020 
0021     void retrieveCollections(const Akonadi::Collection &rootCollection) override;
0022     void retrieveItems(const Akonadi::Collection &collection) override;
0023 
0024     void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override;
0025     void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers) override;
0026     void itemsRemoved(const Akonadi::Item::List &items) override;
0027     void itemsMoved(const Akonadi::Item::List &items, const Akonadi::Collection &collectionSource, const Akonadi::Collection &collectionDestination) override;
0028 
0029     void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) override;
0030     void collectionChanged(const Akonadi::Collection &collection) override;
0031     void collectionRemoved(const Akonadi::Collection &collection) override;
0032 
0033 private:
0034     void slotItemsRetrieved(KGAPI2::Job *job);
0035     void setupCollection(Akonadi::Collection &collection, const KGAPI2::TaskListPtr &taskList);
0036     void doRemoveTasks(const Akonadi::Item::List &items);
0037 };