File indexing completed on 2024-05-12 05:11:15

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  *
0006  */
0007 #pragma once
0008 
0009 #include "index.h"
0010 #include <Akonadi/Collection>
0011 #include <Akonadi/Item>
0012 #include <KJob>
0013 
0014 /**
0015  * A Job that indexes a collection and all it's children in order to correctly update the paths (for which we need to have the display attribute available).
0016  */
0017 class CollectionUpdateJob : public KJob
0018 {
0019     Q_OBJECT
0020 public:
0021     explicit CollectionUpdateJob(Index &index, const Akonadi::Collection &col, QObject *parent = nullptr);
0022 
0023     void start() override;
0024 
0025 private Q_SLOTS:
0026     void onCollectionsReceived(const Akonadi::Collection::List &);
0027     void onCollectionsFetched(KJob *);
0028 
0029 private:
0030     [[nodiscard]] bool shouldIndex(const Akonadi::Collection &col) const;
0031 
0032     const Akonadi::Collection mCol;
0033     Index &mIndex;
0034 };