File indexing completed on 2024-05-26 05:14:08

0001 /*
0002     SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QDateTime>
0010 #include <QList>
0011 #include <QSharedDataPointer>
0012 #include <QSharedPointer>
0013 
0014 #include "akonadicore_export.h"
0015 
0016 namespace Akonadi
0017 {
0018 namespace Protocol
0019 {
0020 class ChangeNotification;
0021 using ChangeNotificationPtr = QSharedPointer<ChangeNotification>;
0022 }
0023 
0024 class ChangeNotificationPrivate;
0025 
0026 /**
0027  * Emitted by Monitor::debugNotification() signal.
0028  *
0029  * This is purely for debugging purposes and should never be used in regular
0030  * applications.
0031  *
0032  * @since 5.4
0033  */
0034 class AKONADICORE_EXPORT ChangeNotification
0035 {
0036 public:
0037     enum Type {
0038         Items,
0039         Collection,
0040         Tag,
0041         Relation,
0042         Subscription,
0043     };
0044 
0045     explicit ChangeNotification();
0046     ChangeNotification(const ChangeNotification &other);
0047     ~ChangeNotification();
0048 
0049     ChangeNotification &operator=(const ChangeNotification &other);
0050 
0051     [[nodiscard]] bool isValid() const;
0052 
0053     [[nodiscard]] QDateTime timestamp() const;
0054     void setTimestamp(const QDateTime &timestamp);
0055 
0056     [[nodiscard]] QList<QByteArray> listeners() const;
0057     void setListeners(const QList<QByteArray> &listeners);
0058 
0059     [[nodiscard]] Type type() const;
0060     void setType(Type type);
0061 
0062     [[nodiscard]] Protocol::ChangeNotificationPtr notification() const;
0063     void setNotification(const Protocol::ChangeNotificationPtr &ntf);
0064 
0065 private:
0066     QSharedDataPointer<ChangeNotificationPrivate> d;
0067 };
0068 
0069 }