File indexing completed on 2025-01-05 04:58:17

0001 /*
0002   SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <KIMAP/Acl>
0011 #include <QObject>
0012 class KJob;
0013 namespace PimCommon
0014 {
0015 class ImapAclAttribute;
0016 class AclModifyJob : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit AclModifyJob(QObject *parent = nullptr);
0021     ~AclModifyJob() override;
0022 
0023     void setTopLevelCollection(const Akonadi::Collection &topLevelCollection);
0024     void setRecursive(bool recursive);
0025     void start();
0026 
0027     void setCurrentRight(const QMap<QByteArray, KIMAP::Acl::Rights> &currentRight);
0028 
0029 Q_SIGNALS:
0030     void searchContactDone();
0031     void searchNextContact();
0032 
0033 private:
0034     void slotModifyDone(KJob *job);
0035     void slotFetchCollectionFinished(const Akonadi::Collection::List &collectionList);
0036     void slotFetchCollectionFailed();
0037     void changeAcl(const Akonadi::Collection &collection);
0038     void checkNewCollection();
0039     bool canAdministrate(const PimCommon::ImapAclAttribute *attribute, const Akonadi::Collection &collection) const;
0040     void searchContact();
0041     void slotModifyAcl();
0042     void slotGroupSearchResult(KJob *job);
0043 
0044     Akonadi::Collection mTopLevelCollection;
0045     Akonadi::Collection::List mRecursiveCollection;
0046     QMap<QByteArray, KIMAP::Acl::Rights> mNewRight;
0047     QMap<QByteArray, KIMAP::Acl::Rights> mCurrentRight;
0048     QMap<QByteArray, KIMAP::Acl::Rights>::const_iterator mIt;
0049     bool mRecursive = false;
0050     int mCurrentIndex = -1;
0051 };
0052 }