File indexing completed on 2024-11-24 04:50:45

0001 // SPDX-FileCopyrightText: 2021 Claudio Cambra <claudio.cambra@gmail.com>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #pragma once
0005 
0006 #include <Akonadi/Monitor>
0007 #include <Akonadi/TagModel>
0008 #include <QObject>
0009 #include <QSortFilterProxyModel>
0010 
0011 class TagManager : public QObject
0012 {
0013     Q_OBJECT
0014     Q_PROPERTY(QSortFilterProxyModel *tagModel READ tagModel NOTIFY tagModelChanged)
0015 
0016 public:
0017     explicit TagManager(QObject *parent = nullptr);
0018     ~TagManager() override = default;
0019 
0020     QSortFilterProxyModel *tagModel();
0021     Q_INVOKABLE void createTag(const QString &name);
0022     Q_INVOKABLE void renameTag(Akonadi::Tag tag, const QString &newName);
0023     Q_INVOKABLE void deleteTag(Akonadi::Tag tag);
0024 
0025 Q_SIGNALS:
0026     void tagModelChanged();
0027 
0028 private:
0029     QSortFilterProxyModel *m_tagModel = nullptr;
0030 };