File indexing completed on 2024-04-28 16:52:17
0001 // SPDX-License-Identifier: GPL-2.0-or-later 0002 // SPDX-FileCopyrightText: 2011 Craig Drummond <craig.p.drummond@gmail.com> 0003 // SPDX-FileCopyrightText: 2018 Alexis Lopes Zubeta <contact@azubieta.net> 0004 // SPDX-FileCopyrightText: 2020 Tomaz Canabrava <tcanabrava@kde.org> 0005 /* 0006 * UFW KControl Module 0007 */ 0008 0009 #pragma once 0010 0011 #include <kcm_firewall_core_export.h> 0012 0013 #include <QAbstractListModel> 0014 0015 #include "profile.h" 0016 0017 class KCM_FIREWALL_CORE_EXPORT RuleListModel : public QAbstractListModel 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 enum ProfileItemModelRoles { ActionRole = Qt::UserRole + 1, FromRole, ToRole, Ipv6Role, LoggingRole }; 0023 0024 explicit RuleListModel(QObject *parent = nullptr); 0025 0026 Q_INVOKABLE void move(int from, int to); 0027 0028 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0029 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0030 0031 void setProfile(const Profile &profile); 0032 0033 protected: 0034 QHash<int, QByteArray> roleNames() const override; 0035 0036 private: 0037 Profile m_profile; 0038 QVector<Rule *> m_rules; 0039 };