File indexing completed on 2024-05-12 05:04:10
0001 // SPDX-FileCopyrightText: 2023 Rishi Kumar <rsi.dev17@gmail.com> 0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 0004 #pragma once 0005 0006 #include "emailinfo.h" 0007 0008 #include <QtQml> 0009 0010 class EmailBlockToolModel : public QAbstractListModel 0011 { 0012 Q_OBJECT 0013 QML_ELEMENT 0014 0015 Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged) 0016 0017 public: 0018 enum CustomRoles { 0019 IdRole, 0020 DomainRole, 0021 CreatedAtRole, 0022 AccountSignUpCount, 0023 IpSignUpCount, 0024 }; 0025 0026 explicit EmailBlockToolModel(QObject *parent = nullptr); 0027 0028 bool loading() const; 0029 void setLoading(bool loading); 0030 0031 QVariant data(const QModelIndex &index, int role) const override; 0032 int rowCount(const QModelIndex &parent) const override; 0033 QHash<int, QByteArray> roleNames() const override; 0034 0035 void filltimeline(); 0036 0037 Q_INVOKABLE void newEmailBlock(const QString &domain); 0038 Q_INVOKABLE void deleteEmailBlock(int row); 0039 0040 Q_SIGNALS: 0041 void loadingChanged(); 0042 0043 private: 0044 QList<EmailInfo> m_emailinfo; 0045 bool m_loading = false; 0046 QUrl m_next; 0047 };