File indexing completed on 2024-11-10 04:40:37

0001 /*
0002     SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "changenotification.h"
0008 #include "private/protocol_p.h"
0009 
0010 using namespace Akonadi;
0011 
0012 namespace Akonadi
0013 {
0014 class ChangeNotificationPrivate : public QSharedData
0015 {
0016 public:
0017     QDateTime timestamp;
0018     QList<QByteArray> listeners;
0019     Protocol::ChangeNotificationPtr notification;
0020     ChangeNotification::Type type;
0021 };
0022 
0023 } // namespace Akonadi
0024 
0025 ChangeNotification::ChangeNotification()
0026     : d(new ChangeNotificationPrivate)
0027 {
0028 }
0029 
0030 ChangeNotification::ChangeNotification(const ChangeNotification &other)
0031     : d(other.d)
0032 {
0033 }
0034 
0035 ChangeNotification::~ChangeNotification()
0036 {
0037 }
0038 
0039 ChangeNotification &ChangeNotification::operator=(const ChangeNotification &other)
0040 {
0041     d = other.d;
0042     return *this;
0043 }
0044 
0045 bool ChangeNotification::isValid() const
0046 {
0047     return d->timestamp.isValid();
0048 }
0049 
0050 void ChangeNotification::setType(ChangeNotification::Type type)
0051 {
0052     d->type = type;
0053 }
0054 
0055 ChangeNotification::Type ChangeNotification::type() const
0056 {
0057     return d->type;
0058 }
0059 
0060 void ChangeNotification::setListeners(const QList<QByteArray> &listeners)
0061 {
0062     d->listeners = listeners;
0063 }
0064 
0065 QList<QByteArray> ChangeNotification::listeners() const
0066 {
0067     return d->listeners;
0068 }
0069 
0070 void ChangeNotification::setTimestamp(const QDateTime &timestamp)
0071 {
0072     d->timestamp = timestamp;
0073 }
0074 
0075 QDateTime ChangeNotification::timestamp() const
0076 {
0077     return d->timestamp;
0078 }
0079 
0080 Protocol::ChangeNotificationPtr ChangeNotification::notification() const
0081 {
0082     return d->notification;
0083 }
0084 
0085 void ChangeNotification::setNotification(const Protocol::ChangeNotificationPtr &ntf)
0086 {
0087     d->notification = ntf;
0088 }