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 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <Akonadi/Item>
0011 
0012 #include <QObject>
0013 
0014 namespace Akonadi
0015 {
0016 namespace FileStore
0017 {
0018 class Job;
0019 
0020 /**
0021  */
0022 class AbstractJobSession : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit AbstractJobSession(QObject *parent = nullptr);
0028 
0029     ~AbstractJobSession() override;
0030 
0031     virtual void addJob(Job *job) = 0;
0032 
0033     virtual void cancelAllJobs() = 0;
0034 
0035     void notifyCollectionsReceived(Job *job, const Collection::List &collections);
0036 
0037     void notifyCollectionCreated(Job *job, const Collection &collection);
0038 
0039     void notifyCollectionDeleted(Job *job, const Collection &collection);
0040 
0041     void notifyCollectionModified(Job *job, const Collection &collection);
0042 
0043     void notifyCollectionMoved(Job *job, const Collection &collection);
0044 
0045     void notifyItemsReceived(Job *job, const Item::List &items);
0046 
0047     void notifyItemCreated(Job *job, const Item &item);
0048 
0049     void notifyItemModified(Job *job, const Item &item);
0050 
0051     void notifyItemMoved(Job *job, const Item &item);
0052 
0053     void notifyCollectionsChanged(Job *job, const Collection::List &collections);
0054 
0055     void notifyItemsChanged(Job *job, const Item::List &items);
0056 
0057     void setError(Job *job, int errorCode, const QString &errorText);
0058 
0059     void emitResult(Job *job);
0060 
0061 Q_SIGNALS:
0062     void jobsReady(const QList<FileStore::Job *> &jobs);
0063 
0064 protected:
0065     virtual void removeJob(Job *job) = 0;
0066 };
0067 }
0068 }