File indexing completed on 2024-12-22 04:55:32

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 
0012 #include "contactlist.h"
0013 #include "kaddressbook_importexport_export.h"
0014 
0015 class QProgressDialog;
0016 class KJob;
0017 
0018 namespace KAddressBookImportExport
0019 {
0020 class KADDRESSBOOK_IMPORTEXPORT_EXPORT ImportExportEngine : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit ImportExportEngine(QObject *parent = nullptr);
0025     ~ImportExportEngine() override;
0026     void setContactList(const ContactList &contacts);
0027 
0028     void importContacts();
0029     void setParentWidget(QWidget *parent);
0030     QWidget *parentWidget() const;
0031     void setDefaultAddressBook(const Akonadi::Collection &defaultAddressBook);
0032 
0033 Q_SIGNALS:
0034     void finished();
0035 
0036 private:
0037     KADDRESSBOOK_IMPORTEXPORT_NO_EXPORT void slotImportJobDone(KJob *);
0038     ContactList mContactsList;
0039     Akonadi::Collection mDefaultAddressBook;
0040     QWidget *mParentWidget = nullptr;
0041     QProgressDialog *mImportProgressDialog = nullptr;
0042     int mNumberElementToImport = -1;
0043     int mImportDone = 0;
0044 };
0045 }