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 "collectionmovejob.h"
0009 
0010 #include "session_p.h"
0011 
0012 using namespace Akonadi;
0013 
0014 class FileStore::CollectionMoveJobPrivate
0015 {
0016 public:
0017     Collection mCollection;
0018     Collection mTargetParent;
0019 };
0020 
0021 FileStore::CollectionMoveJob::CollectionMoveJob(const Collection &collection, const Collection &targetParent, FileStore::AbstractJobSession *session)
0022     : FileStore::Job(session)
0023     , d(new CollectionMoveJobPrivate())
0024 {
0025     Q_ASSERT(session != nullptr);
0026 
0027     d->mCollection = collection;
0028     d->mTargetParent = targetParent;
0029 
0030     session->addJob(this);
0031 }
0032 
0033 FileStore::CollectionMoveJob::~CollectionMoveJob() = default;
0034 
0035 Collection FileStore::CollectionMoveJob::collection() const
0036 {
0037     return d->mCollection;
0038 }
0039 
0040 Collection FileStore::CollectionMoveJob::targetParent() const
0041 {
0042     return d->mTargetParent;
0043 }
0044 
0045 bool FileStore::CollectionMoveJob::accept(FileStore::Job::Visitor *visitor)
0046 {
0047     return visitor->visit(this);
0048 }
0049 
0050 void FileStore::CollectionMoveJob::handleCollectionMoved(const Collection &collection)
0051 {
0052     d->mCollection = collection;
0053 }
0054 
0055 #include "moc_collectionmovejob.cpp"