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 "messageviewer_private_export.h" 0010 #include <QObject> 0011 #include <QUrl> 0012 namespace MessageViewer 0013 { 0014 class RemoteContentInfo; 0015 /** 0016 * @brief The RemoteContentManager class 0017 * @author Laurent Montel <montel@kde.org> 0018 */ 0019 class MESSAGEVIEWER_TESTS_EXPORT RemoteContentManager : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit RemoteContentManager(QObject *parent = nullptr); 0024 ~RemoteContentManager() override; 0025 static RemoteContentManager *self(); 0026 void clear(); 0027 0028 [[nodiscard]] bool isAutorized(const QString &url) const; 0029 [[nodiscard]] bool isAutorized(const QUrl &url, bool &contains) const; 0030 0031 void addRemoteContent(const RemoteContentInfo &info); 0032 [[nodiscard]] QList<RemoteContentInfo> removeContentInfo() const; 0033 0034 void setRemoveContentInfo(const QList<RemoteContentInfo> &removeContentInfo); 0035 0036 [[nodiscard]] bool isUnique(const RemoteContentInfo &newInfo) const; 0037 0038 [[nodiscard]] bool isBlocked(const QUrl &url, bool &contains) const; 0039 0040 private: 0041 void loadSettings(); 0042 void writeSettings(); 0043 QList<RemoteContentInfo> mRemoveContentInfo; 0044 }; 0045 }