1/*
2 Copyright (c) 2014 Daniel Vrátil <dvratil@redhat.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#include "notificationsource_p.h"
21
22using namespace Akonadi;
23
24NotificationSource::NotificationSource(QObject *source)
25 : QObject(source)
26{
27 Q_ASSERT(source);
28
29 connect(source, SIGNAL(notifyV3(Akonadi::NotificationMessageV3::List)),
30 this, SIGNAL(notifyV3(Akonadi::NotificationMessageV3::List)));
31}
32
33NotificationSource::~NotificationSource()
34{
35}
36
37void NotificationSource::setAllMonitored(bool allMonitored)
38{
39 const bool ok = QMetaObject::invokeMethod(parent(), "setAllMonitored",
40 Q_ARG(bool, allMonitored));
41 Q_ASSERT(ok);
42 Q_UNUSED(ok);
43}
44
45void NotificationSource::setMonitoredCollection(Entity::Id id, bool monitored)
46{
47 const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredCollection",
48 Q_ARG(qlonglong, id),
49 Q_ARG(bool, monitored));
50 Q_ASSERT(ok);
51 Q_UNUSED(ok);
52}
53
54void NotificationSource::setMonitoredItem(Entity::Id id, bool monitored)
55{
56 const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredItem",
57 Q_ARG(qlonglong, id),
58 Q_ARG(bool, monitored));
59 Q_ASSERT(ok);
60 Q_UNUSED(ok);
61}
62
63void NotificationSource::setMonitoredResource(const QByteArray &resource, bool monitored)
64{
65 const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredResource",
66 Q_ARG(QByteArray, resource),
67 Q_ARG(bool, monitored));
68 Q_ASSERT(ok);
69 Q_UNUSED(ok);
70}
71
72void NotificationSource::setMonitoredMimeType(const QString &mimeType, bool monitored)
73{
74 const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredMimeType",
75 Q_ARG(QString, mimeType),
76 Q_ARG(bool, monitored));
77 Q_ASSERT(ok);
78 Q_UNUSED(ok);
79}
80
81void NotificationSource::setIgnoredSession(const QByteArray &session, bool ignored)
82{
83 const bool ok = QMetaObject::invokeMethod(parent(), "setIgnoredSession",
84 Q_ARG(QByteArray, session),
85 Q_ARG(bool, ignored));
86 Q_ASSERT(ok);
87 Q_UNUSED(ok);
88}
89
90void NotificationSource::setMonitoredTag(Tag::Id id, bool monitored)
91{
92 const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredTag",
93 Q_ARG(qlonglong, id),
94 Q_ARG(bool, monitored));
95 Q_ASSERT(ok);
96 Q_UNUSED(ok);
97}
98
99void NotificationSource::setMonitoredType(NotificationMessageV2::Type type, bool monitored)
100{
101 const bool ok = QMetaObject::invokeMethod(parent(), "setMonitoredType",
102 Q_ARG(Akonadi::NotificationMessageV2::Type, type),
103 Q_ARG(bool, monitored));
104 Q_ASSERT(ok);
105 Q_UNUSED(ok);
106}
107
108QObject *NotificationSource::source() const
109{
110 return parent();
111}
112