File indexing completed on 2025-03-09 04:54:37

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QWidget>
0010 
0011 #include "messageviewer_private_export.h"
0012 #include "remotecontentinfo.h"
0013 #include <QTreeWidgetItem>
0014 class QTreeWidget;
0015 namespace MessageViewer
0016 {
0017 class RemoteContentStatusTypeComboBox;
0018 class RemoteContentInfo;
0019 /**
0020  * @brief The RemoteContentWidgetItem class
0021  * @author Laurent Montel <montel@kde.org>
0022  */
0023 class MESSAGEVIEWER_TESTS_EXPORT RemoteContentWidgetItem : public QTreeWidgetItem
0024 {
0025 public:
0026     enum ColumnType {
0027         Domain = 0,
0028         RuleType = 1,
0029     };
0030 
0031     explicit RemoteContentWidgetItem(QTreeWidget *parent = nullptr);
0032     ~RemoteContentWidgetItem() override;
0033 
0034     [[nodiscard]] MessageViewer::RemoteContentInfo::RemoteContentInfoStatus status() const;
0035     void setStatus(MessageViewer::RemoteContentInfo::RemoteContentInfoStatus type);
0036 
0037 private:
0038     void updateInfo();
0039     RemoteContentStatusTypeComboBox *const mStatusTypeCombobox;
0040 };
0041 
0042 class MESSAGEVIEWER_TESTS_EXPORT RemoteContentConfigureWidget : public QWidget
0043 {
0044     Q_OBJECT
0045 public:
0046     explicit RemoteContentConfigureWidget(QWidget *parent = nullptr);
0047     ~RemoteContentConfigureWidget() override;
0048     void saveSettings();
0049 
0050 private:
0051     void insertRemoteContentInfo(const RemoteContentInfo &info);
0052     void slotCustomContextMenuRequested(const QPoint &);
0053     void modifyRemoteContent(RemoteContentWidgetItem *rulesItem);
0054     void slotAdd();
0055     void fillContentInfo(const RemoteContentInfo &info, RemoteContentWidgetItem *item);
0056     void readSettings();
0057     QTreeWidget *const mTreeWidget;
0058 };
0059 }