File indexing completed on 2025-01-05 04:35:35
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2020-2022 Harald Sitter <sitter@kde.org> 0003 0004 #pragma once 0005 0006 #include <memory> 0007 0008 #include <QAbstractListModel> 0009 0010 #include "ace.h" 0011 0012 class Model : public QAbstractListModel 0013 { 0014 Q_OBJECT 0015 Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged) 0016 public: 0017 enum class Role { 0018 Sid = Qt::UserRole, 0019 Type, 0020 Flags, 0021 Mask, 0022 ACEObject, 0023 }; 0024 Q_ENUM(Role) 0025 0026 using QAbstractListModel::QAbstractListModel; 0027 0028 [[nodiscard]] int rowCount(const QModelIndex &parent) const override; 0029 [[nodiscard]] QVariant data(const QModelIndex &index, int intRole) const override; 0030 [[nodiscard]] QHash<int, QByteArray> roleNames() const override; 0031 0032 void resetData(const QList<std::shared_ptr<ACE>> &acl); 0033 QList<std::shared_ptr<ACE>> acl() const; 0034 0035 bool isEmpty() 0036 { 0037 return m_acl.isEmpty(); 0038 } 0039 0040 Q_SIGNALS: 0041 void emptyChanged(); 0042 0043 private: 0044 mutable QList<std::shared_ptr<ACE>> m_acl; 0045 }; 0046