File indexing completed on 2025-01-05 04:58:20

0001 /*
0002   SPDX-FileCopyrightText: 2015-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 "pimcommonakonadi_private_export.h"
0011 #include <QHash>
0012 #include <QListWidget>
0013 #include <QListWidgetItem>
0014 
0015 namespace PimCommon
0016 {
0017 class PIMCOMMONAKONADI_TESTS_EXPORT BlackListBalooEmailListItem : public QListWidgetItem
0018 {
0019 public:
0020     explicit BlackListBalooEmailListItem(QListWidget *parent = nullptr);
0021     ~BlackListBalooEmailListItem() override;
0022 
0023     [[nodiscard]] bool initializeStatus() const;
0024     void setInitializeStatus(bool initializeStatus);
0025 
0026 private:
0027     bool mInitializeStatus;
0028 };
0029 
0030 class PIMCOMMONAKONADI_TESTS_EXPORT BlackListBalooEmailList : public QListWidget
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit BlackListBalooEmailList(QWidget *parent = nullptr);
0035     ~BlackListBalooEmailList() override;
0036 
0037     void setEmailBlackList(const QStringList &list);
0038 
0039     [[nodiscard]] QHash<QString, bool> blackListItemChanged() const;
0040 
0041     void setExcludeDomains(const QStringList &domain);
0042     [[nodiscard]] int setEmailFound(const QStringList &);
0043 
0044     void setExcludeEmailsRegularExpressions(const QStringList &newExcludeEmailsRegularExpressions);
0045 
0046 protected:
0047     void paintEvent(QPaintEvent *event) override;
0048 
0049     void changeEvent(QEvent *event) override;
0050 
0051 private:
0052     void generalPaletteChanged();
0053     QStringList mExcludeEmailsRegularExpressions;
0054     QStringList mEmailBlackList;
0055     QStringList mExcludeDomains;
0056     QColor mTextColor;
0057     bool mFirstResult = false;
0058 };
0059 }