Warning, file /office/marknote/src/notebooksmodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im> 0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 0004 #ifndef NoteBooksModel_H 0005 #define NoteBooksModel_H 0006 0007 #include <QAbstractListModel> 0008 #include <QDir> 0009 0010 class NoteBooksModel : public QAbstractListModel 0011 { 0012 Q_OBJECT 0013 0014 public: 0015 enum Role { Path = Qt::UserRole + 1, Name, Icon, Color }; 0016 Q_ENUM(Role) 0017 0018 explicit NoteBooksModel(QObject *parent = nullptr); 0019 0020 int rowCount(const QModelIndex &index) const override; 0021 0022 QVariant data(const QModelIndex &index, int role) const override; 0023 0024 QHash<int, QByteArray> roleNames() const override; 0025 0026 Q_INVOKABLE void addNoteBook(const QString &name, const QString &icon, const QString &color); 0027 0028 Q_INVOKABLE void deleteNoteBook(const QString &name); 0029 0030 Q_INVOKABLE void renameNoteBook(const QUrl &path, const QString &name); 0031 0032 private: 0033 QDir directory; 0034 }; 0035 0036 #endif // NoteBooksModel_H