parent
e7ac6ce89c
commit
1a9b3917c1
5 changed files with 73 additions and 8 deletions
@ -0,0 +1,34 @@ |
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org> |
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL |
||||
*/ |
||||
|
||||
#include "tagmonitormanager.h" |
||||
#include <AkonadiCore/Monitor> |
||||
#include <AkonadiCore/TagFetchJob> |
||||
#include <AkonadiCore/TagFetchScope> |
||||
#include <AkonadiCore/TagAttribute> |
||||
|
||||
TagMonitorManager::TagMonitorManager(QObject *parent) |
||||
: QObject(parent) |
||||
, mMonitor(new Akonadi::Monitor(this)) |
||||
{ |
||||
mMonitor->setObjectName(QStringLiteral("TagActionManagerMonitor")); |
||||
mMonitor->setTypeMonitored(Akonadi::Monitor::Tags); |
||||
mMonitor->tagFetchScope().fetchAttribute<Akonadi::TagAttribute>(); |
||||
connect(mMonitor, &Akonadi::Monitor::tagAdded, this, &TagMonitorManager::tagAdded); |
||||
connect(mMonitor, &Akonadi::Monitor::tagRemoved, this, &TagMonitorManager::tagRemoved); |
||||
connect(mMonitor, &Akonadi::Monitor::tagChanged, this, &TagMonitorManager::tagChanged); |
||||
} |
||||
|
||||
TagMonitorManager::~TagMonitorManager() |
||||
{ |
||||
|
||||
} |
||||
|
||||
TagMonitorManager *TagMonitorManager::self() |
||||
{ |
||||
static TagMonitorManager s_self; |
||||
return &s_self; |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org> |
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL |
||||
*/ |
||||
|
||||
#ifndef TAGMONITORMANAGER_H |
||||
#define TAGMONITORMANAGER_H |
||||
|
||||
#include <QObject> |
||||
#include <AkonadiCore/Tag> |
||||
namespace Akonadi { |
||||
class Monitor; |
||||
} |
||||
class TagMonitorManager : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit TagMonitorManager(QObject *parent = nullptr); |
||||
~TagMonitorManager(); |
||||
|
||||
static TagMonitorManager *self(); |
||||
|
||||
Q_SIGNALS: |
||||
void tagAdded(const Akonadi::Tag &tag); |
||||
void tagChanged(const Akonadi::Tag &tag); |
||||
void tagRemoved(const Akonadi::Tag &tag); |
||||
|
||||
private: |
||||
Akonadi::Monitor *const mMonitor; |
||||
}; |
||||
|
||||
#endif // TAGMONITORMANAGER_H
|
||||
Loading…
Reference in new issue