File indexing completed on 2025-01-05 04:49:30

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <QObject>
0011 class KJob;
0012 class AutomaticAddContactsJob : public QObject
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit AutomaticAddContactsJob(QObject *parent = nullptr);
0017     ~AutomaticAddContactsJob() override;
0018 
0019     void start();
0020 
0021     void setEmails(const QStringList &list);
0022     void setCollection(const Akonadi::Collection &collection);
0023 
0024 Q_SIGNALS:
0025     void finished();
0026 
0027 private:
0028     void fetchCollection();
0029     void verifyContactExist();
0030     void addNextContact();
0031     void slotSelectedCollectionFetched(KJob *job);
0032     void slotFetchAllCollections(KJob *job);
0033     void slotSearchDone(KJob *job);
0034     void slotAddContactDone(KJob *job);
0035     void slotResourceCreationDone(KJob *);
0036     void deleteLaterAndEmitSignal();
0037 
0038     QStringList mEmails;
0039     QStringList mProcessedEmails;
0040     QString mProcessEmail;
0041     QString mName;
0042     Akonadi::Collection mCollection;
0043     int mCurrentIndex = -1;
0044 };