File indexing completed on 2024-11-24 04:43:06

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 #include <Akonadi/Item>
0009 #include <KContacts/VCardConverter>
0010 #include <QObject>
0011 
0012 class QTemporaryDir;
0013 namespace MimeTreeParser
0014 {
0015 class AttachmentTemporaryFilesDirs;
0016 }
0017 namespace KABSendVCards
0018 {
0019 class SendVcardsJob : public QObject
0020 {
0021     Q_OBJECT
0022 public:
0023     explicit SendVcardsJob(const Akonadi::Item::List &listItem, QObject *parent = nullptr);
0024     ~SendVcardsJob() override;
0025 
0026     [[nodiscard]] bool start();
0027 
0028     [[nodiscard]] KContacts::VCardConverter::Version version() const;
0029     void setVersion(KContacts::VCardConverter::Version version);
0030 
0031 Q_SIGNALS:
0032     void sendVCardsError(const QString &error);
0033 
0034 private:
0035     void slotExpandGroupResult(KJob *job);
0036     void createTemporaryFile(const QByteArray &data, const QString &filename);
0037     void createTemporaryDir();
0038     void jobFinished();
0039     const Akonadi::Item::List mListItem;
0040     MimeTreeParser::AttachmentTemporaryFilesDirs *mAttachmentTemporary = nullptr;
0041     QTemporaryDir *mTempDir = nullptr;
0042     KContacts::VCardConverter::Version mVersion = KContacts::VCardConverter::v3_0;
0043     int mExpandGroupJobCount = 0;
0044 };
0045 }