File indexing completed on 2024-11-17 04:45:05

0001 /*
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0003     SPDX-FileContributor: Kevin Ottens <kevin@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "resourcetask.h"
0011 
0012 class ChangeCollectionTask : public ResourceTask
0013 {
0014     Q_OBJECT
0015 
0016 public:
0017     explicit ChangeCollectionTask(const ResourceStateInterface::Ptr &resource, QObject *parent = nullptr);
0018     ~ChangeCollectionTask() override;
0019 
0020     void syncEnabledState(bool);
0021 
0022 private Q_SLOTS:
0023     void onRenameDone(KJob *job);
0024     void onSubscribeDone(KJob *job);
0025     void onSetAclDone(KJob *job);
0026     void onSetMetaDataDone(KJob *job);
0027 
0028 protected:
0029     void doStart(KIMAP::Session *session) override;
0030 
0031 private:
0032     void endTaskIfNeeded();
0033 
0034     int m_pendingJobs = 0;
0035     Akonadi::Collection m_collection;
0036     bool m_syncEnabledState = true;
0037 };