File indexing completed on 2024-11-24 04:44:34

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2009, 2010 Kevin Krammer <kevin.krammer@gmx.at>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "job.h"
0010 
0011 #include <Akonadi/Collection>
0012 
0013 #include <memory>
0014 
0015 namespace Akonadi
0016 {
0017 class CollectionFetchScope;
0018 
0019 namespace FileStore
0020 {
0021 class AbstractJobSession;
0022 class CollectionFetchJobPrivate;
0023 
0024 /**
0025  */
0026 class AKONADI_FILESTORE_EXPORT CollectionFetchJob : public Job
0027 {
0028     friend class AbstractJobSession;
0029 
0030     Q_OBJECT
0031 
0032 public:
0033     enum Type {
0034         Base,
0035         FirstLevel,
0036         Recursive,
0037     };
0038 
0039     explicit CollectionFetchJob(const Collection &collection, Type type = FirstLevel, AbstractJobSession *session = nullptr);
0040 
0041     ~CollectionFetchJob() override;
0042 
0043     [[nodiscard]] Type type() const;
0044 
0045     [[nodiscard]] Collection collection() const;
0046 
0047     void setFetchScope(const CollectionFetchScope &fetchScope);
0048 
0049     CollectionFetchScope &fetchScope();
0050 
0051     [[nodiscard]] Collection::List collections() const;
0052 
0053     bool accept(Visitor *visitor) override;
0054 
0055 Q_SIGNALS:
0056     void collectionsReceived(const Akonadi::Collection::List &items);
0057 
0058 private:
0059     void handleCollectionsReceived(const Akonadi::Collection::List &collections);
0060 
0061 private:
0062     std::unique_ptr<CollectionFetchJobPrivate> const d;
0063 };
0064 }
0065 }