File indexing completed on 2024-10-27 04:51:06
0001 /* 0002 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 */ 0007 0008 #pragma once 0009 0010 #include <Akonadi/Item> 0011 #include <KJob> 0012 0013 /** 0014 * @brief The CreateNewContactJob class 0015 * The job will check if there is address book folder to store new contact to akonadi 0016 * otherise it will allow to create new one. 0017 */ 0018 class CreateNewContactJob : public KJob 0019 { 0020 Q_OBJECT 0021 public: 0022 /** 0023 * @brief CreateNewContactJob create a new contact job 0024 * @param parentWidget The widget that will be used as parent for dialog. 0025 * @param parent The parent object 0026 */ 0027 explicit CreateNewContactJob(QWidget *parentWidget, QObject *parent = nullptr); 0028 0029 /** 0030 * Destroys the new contact job 0031 */ 0032 ~CreateNewContactJob() override; 0033 0034 /** 0035 * @brief start the job 0036 */ 0037 void start() override; 0038 0039 private: 0040 void slotCollectionsFetched(KJob *); 0041 void slotResourceCreationDone(KJob *job); 0042 void slotContactEditorError(const QString &error); 0043 void contactStored(const Akonadi::Item &item); 0044 0045 void createContact(); 0046 0047 QWidget *const mParentWidget; 0048 };