File indexing completed on 2025-02-16 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 #include "checkattachmentjob.h"
0008 
0009 #include <KEmailAddress>
0010 #include <PimCommon/PimUtil>
0011 
0012 CheckAttachmentJob::CheckAttachmentJob() = default;
0013 
0014 CheckAttachmentJob::~CheckAttachmentJob() = default;
0015 
0016 void CheckAttachmentJob::start()
0017 {
0018     mResultList.clear();
0019 
0020     for (const QString &email : std::as_const(mOriginalEmails)) {
0021         QString tname;
0022         QString temail;
0023         KEmailAddress::extractEmailAddressAndName(email, temail, tname); // ignore return value
0024         if (!temail.isEmpty()) {
0025             if (!mResultList.contains(temail)) {
0026                 mResultList.append(temail);
0027             }
0028         }
0029     }
0030 }
0031 
0032 QStringList CheckAttachmentJob::originalEmails() const
0033 {
0034     return mOriginalEmails;
0035 }
0036 
0037 void CheckAttachmentJob::setOriginalEmails(const QStringList &list)
0038 {
0039     mOriginalEmails = PimCommon::Util::generateEmailList(list);
0040 }
0041 
0042 QStringList CheckAttachmentJob::resultList() const
0043 {
0044     return mResultList;
0045 }
0046 
0047 void CheckAttachmentJob::setResultList(const QStringList &resultList)
0048 {
0049     mResultList = resultList;
0050 }