File indexing completed on 2024-11-24 04:44:34
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2009 Kevin Krammer <kevin.krammer@gmx.at> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "collectionfetchjob.h" 0008 0009 #include "session_p.h" 0010 0011 #include <Akonadi/CollectionFetchScope> 0012 0013 using namespace Akonadi; 0014 0015 class FileStore::CollectionFetchJobPrivate 0016 { 0017 public: 0018 CollectionFetchJobPrivate() 0019 : mType(FileStore::CollectionFetchJob::Base) 0020 { 0021 } 0022 0023 FileStore::CollectionFetchJob::Type mType; 0024 Collection mCollection; 0025 0026 CollectionFetchScope mFetchScope; 0027 0028 Collection::List mCollections; 0029 }; 0030 0031 FileStore::CollectionFetchJob::CollectionFetchJob(const Collection &collection, Type type, FileStore::AbstractJobSession *session) 0032 : FileStore::Job(session) 0033 , d(new CollectionFetchJobPrivate()) 0034 { 0035 Q_ASSERT(session != nullptr); 0036 0037 d->mType = type; 0038 d->mCollection = collection; 0039 0040 session->addJob(this); 0041 } 0042 0043 FileStore::CollectionFetchJob::~CollectionFetchJob() = default; 0044 0045 FileStore::CollectionFetchJob::Type FileStore::CollectionFetchJob::type() const 0046 { 0047 return d->mType; 0048 } 0049 0050 Collection FileStore::CollectionFetchJob::collection() const 0051 { 0052 return d->mCollection; 0053 } 0054 0055 void FileStore::CollectionFetchJob::setFetchScope(const CollectionFetchScope &fetchScope) 0056 { 0057 d->mFetchScope = fetchScope; 0058 } 0059 0060 CollectionFetchScope &FileStore::CollectionFetchJob::fetchScope() 0061 { 0062 return d->mFetchScope; 0063 } 0064 0065 Collection::List FileStore::CollectionFetchJob::collections() const 0066 { 0067 return d->mCollections; 0068 } 0069 0070 bool FileStore::CollectionFetchJob::accept(FileStore::Job::Visitor *visitor) 0071 { 0072 return visitor->visit(this); 0073 } 0074 0075 void FileStore::CollectionFetchJob::handleCollectionsReceived(const Collection::List &collections) 0076 { 0077 d->mCollections << collections; 0078 0079 Q_EMIT collectionsReceived(collections); 0080 } 0081 0082 #include "moc_collectionfetchjob.cpp"