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

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 "storecompactjob.h"
0008 
0009 #include "session_p.h"
0010 
0011 using namespace Akonadi;
0012 
0013 class FileStore::StoreCompactJobPrivate
0014 {
0015 public:
0016     explicit StoreCompactJobPrivate(FileStore::StoreCompactJob *parent)
0017         : mParent(parent)
0018     {
0019     }
0020 
0021 public:
0022     FileStore::StoreCompactJob *mParent = nullptr;
0023 
0024     Collection::List mCollections;
0025     Item::List mItems;
0026 };
0027 
0028 FileStore::StoreCompactJob::StoreCompactJob(FileStore::AbstractJobSession *session)
0029     : FileStore::Job(session)
0030     , d(new StoreCompactJobPrivate(this))
0031 {
0032     session->addJob(this);
0033 }
0034 
0035 FileStore::StoreCompactJob::~StoreCompactJob() = default;
0036 
0037 bool FileStore::StoreCompactJob::accept(FileStore::Job::Visitor *visitor)
0038 {
0039     return visitor->visit(this);
0040 }
0041 
0042 Item::List FileStore::StoreCompactJob::changedItems() const
0043 {
0044     return d->mItems;
0045 }
0046 
0047 Collection::List FileStore::StoreCompactJob::changedCollections() const
0048 {
0049     return d->mCollections;
0050 }
0051 
0052 void FileStore::StoreCompactJob::handleCollectionsChanged(const Collection::List &collections)
0053 {
0054     d->mCollections << collections;
0055     Q_EMIT collectionsChanged(collections);
0056 }
0057 
0058 void FileStore::StoreCompactJob::handleItemsChanged(const Item::List &items)
0059 {
0060     d->mItems << items;
0061     Q_EMIT itemsChanged(items);
0062 }
0063 
0064 #include "moc_storecompactjob.cpp"