Pimcommon

blacklistbalooemailutil.cpp
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5
6*/
7
8#include "blacklistbalooemailutil.h"
9
10using namespace PimCommon;
11BlackListBalooEmailUtil::BlackListBalooEmailUtil() = default;
12
13BlackListBalooEmailUtil::~BlackListBalooEmailUtil() = default;
14
15void BlackListBalooEmailUtil::initialBlackList(const QStringList &blackList)
16{
17 mInitialList = blackList;
18}
19
20void BlackListBalooEmailUtil::setNewBlackList(const QHash<QString, bool> &list)
21{
22 mNewBlackList = list;
23}
24
25QStringList BlackListBalooEmailUtil::createNewBlackList()
26{
27 if (mNewBlackList.isEmpty()) {
28 return mInitialList;
29 }
30
31 QHashIterator<QString, bool> i(mNewBlackList);
32 while (i.hasNext()) {
33 i.next();
34 const QString newEmail(i.key());
35 if (i.value()) {
36 if (!mInitialList.contains(newEmail)) {
37 mInitialList.append(newEmail);
38 }
39 } else {
40 mInitialList.removeAll(newEmail);
41 }
42 }
43 return mInitialList;
44}
KIOCORE_EXPORT QStringList list(const QString &fileClass)
folderdialogacltab.h
bool isEmpty() const const
void append(QList< T > &&value)
qsizetype removeAll(const AT &t)
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:39:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.