File indexing completed on 2025-01-19 04:46:51
0001 /* 0002 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <MimeTreeParser/BodyPart> 0010 #include <MimeTreeParser/Enums> 0011 0012 #include <KContacts/Addressee> 0013 #include <QObject> 0014 0015 class KJob; 0016 0017 namespace MessageViewer 0018 { 0019 struct VCard { 0020 VCard() = default; 0021 0022 VCard(const QString &str, bool b) 0023 : email(str) 0024 , found(b) 0025 { 0026 } 0027 0028 KContacts::Addressee address; 0029 QString email; 0030 bool found = false; 0031 }; 0032 0033 class VcardMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento 0034 { 0035 Q_OBJECT 0036 public: 0037 explicit VcardMemento(const QStringList &emails); 0038 ~VcardMemento() override; 0039 0040 bool finished() const; 0041 0042 void detach() override; 0043 0044 bool vcardExist(int index) const; 0045 0046 KContacts::Addressee address(int index) const; 0047 0048 Q_SIGNALS: 0049 // TODO: Factor our update and detach into base class 0050 void update(MimeTreeParser::UpdateMode); 0051 0052 private: 0053 void slotSearchJobFinished(KJob *job); 0054 void checkEmail(); 0055 void continueToCheckEmail(); 0056 QList<VCard> mVCardList; 0057 int mIndex = 0; 0058 bool mFinished = false; 0059 }; 0060 }