diff --git a/src/models/keywordnotificationrulemodel.h b/src/models/keywordnotificationrulemodel.h index 831cdf714..f796a369b 100644 --- a/src/models/keywordnotificationrulemodel.h +++ b/src/models/keywordnotificationrulemodel.h @@ -7,23 +7,54 @@ #include +/** + * @class KeywordNotificationRuleModel + * + * This class defines the model for managing notification push rule keywords. + */ class KeywordNotificationRuleModel : public QAbstractListModel { Q_OBJECT public: + /** + * @brief Defines the model roles. + */ enum EventRoles { - NameRole = Qt::DisplayRole, + NameRole = Qt::DisplayRole, /**< The push rule keyword. */ }; KeywordNotificationRuleModel(QObject *parent = nullptr); + /** + * @brief Get the given role value at the given index. + * + * @sa QAbstractItemModel::data + */ [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + + /** + * @brief Number of rows in the model. + * + * @sa QAbstractItemModel::rowCount + */ [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; + /** + * @brief Returns a mapping from Role enum values to role names. + * + * @sa EventRoles, QAbstractItemModel::roleNames() + */ [[nodiscard]] QHash roleNames() const override; + /** + * @brief Add a new keyword to the model. + */ Q_INVOKABLE void addKeyword(const QString &keyword); + + /** + * @brief Remove a keyword from the model. + */ Q_INVOKABLE void removeKeywordAtIndex(int index); private Q_SLOTS: