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

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003     SPDX-FileContributor: Kevin Krammer <krake@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "collectioncreatejob.h"
0009 
0010 #include "session_p.h"
0011 
0012 using namespace Akonadi;
0013 
0014 class FileStore::CollectionCreateJobPrivate
0015 {
0016 public:
0017     Collection mCollection;
0018     Collection mTargetParent;
0019 };
0020 
0021 FileStore::CollectionCreateJob::CollectionCreateJob(const Collection &collection, const Collection &targetParent, FileStore::AbstractJobSession *session)
0022     : FileStore::Job(session)
0023     , d(new CollectionCreateJobPrivate())
0024 {
0025     Q_ASSERT(session != nullptr);
0026 
0027     d->mCollection = collection;
0028     d->mTargetParent = targetParent;
0029 
0030     session->addJob(this);
0031 }
0032 
0033 FileStore::CollectionCreateJob::~CollectionCreateJob() = default;
0034 
0035 Collection FileStore::CollectionCreateJob::collection() const
0036 {
0037     return d->mCollection;
0038 }
0039 
0040 Collection FileStore::CollectionCreateJob::targetParent() const
0041 {
0042     return d->mTargetParent;
0043 }
0044 
0045 bool FileStore::CollectionCreateJob::accept(FileStore::Job::Visitor *visitor)
0046 {
0047     return visitor->visit(this);
0048 }
0049 
0050 void FileStore::CollectionCreateJob::handleCollectionCreated(const Collection &collection)
0051 {
0052     d->mCollection = collection;
0053 }
0054 
0055 #include "moc_collectioncreatejob.cpp"