File indexing completed on 2024-04-28 15:19:07

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org>
0005   SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0006 
0007   SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 /**
0010   @file
0011   This file is part of the API for handling calendar data and
0012   defines the Journal class.
0013 
0014   @author Cornelius Schumacher \<schumacher@kde.org\>
0015   @author Reinhold Kainhofer \<reinhold@kainhofer.com\>
0016 */
0017 #ifndef KCALCORE_JOURNAL_H
0018 #define KCALCORE_JOURNAL_H
0019 
0020 #include "incidence.h"
0021 #include "kcalendarcore_export.h"
0022 
0023 namespace KCalendarCore
0024 {
0025 
0026 class JournalPrivate;
0027 
0028 /**
0029   @brief
0030   Provides a Journal in the sense of RFC2445.
0031 */
0032 class KCALENDARCORE_EXPORT Journal : public Incidence
0033 {
0034 public:
0035     /**
0036       A shared pointer to a Journal object.
0037     */
0038     typedef QSharedPointer<Journal> Ptr;
0039 
0040     /**
0041       List of journals.
0042     */
0043     typedef QVector<Ptr> List;
0044 
0045     ///@cond PRIVATE
0046     // needed for Akonadi polymorphic payload support
0047     typedef Incidence SuperClass;
0048     ///@endcond
0049 
0050     /**
0051       Constructs an empty journal.
0052     */
0053     Journal();
0054 
0055     /** Copy a journey object. */
0056     Journal(const Journal &);
0057 
0058     /**
0059       Destroys a journal.
0060     */
0061     ~Journal() override;
0062 
0063     /**
0064       @copydoc
0065       IncidenceBase::type()
0066     */
0067     Q_REQUIRED_RESULT IncidenceType type() const override;
0068 
0069     /**
0070       @copydoc
0071       IncidenceBase::typeStr()
0072     */
0073     Q_REQUIRED_RESULT QByteArray typeStr() const override;
0074 
0075     /**
0076       Returns an exact copy of this journal. The returned object is owned
0077       by the caller.
0078     */
0079     Journal *clone() const override;
0080 
0081     /**
0082       @copydoc
0083       IncidenceBase::dateTime(DateTimeRole)const
0084     */
0085     Q_REQUIRED_RESULT QDateTime dateTime(DateTimeRole role) const override;
0086 
0087     /**
0088       @copydoc
0089       IncidenceBase::setDateTime(const QDateTime &, DateTimeRole )
0090     */
0091     void setDateTime(const QDateTime &dateTime, DateTimeRole role) override;
0092 
0093     /**
0094        @copydoc
0095        IncidenceBase::mimeType()
0096     */
0097     Q_REQUIRED_RESULT QLatin1String mimeType() const override;
0098 
0099     /**
0100        @copydoc
0101        Incidence::iconName()
0102     */
0103     Q_REQUIRED_RESULT QLatin1String iconName(const QDateTime &recurrenceId = {}) const override;
0104 
0105     /**
0106        @copydoc
0107        Incidence::supportsGroupwareCommunication()
0108     */
0109     Q_REQUIRED_RESULT bool supportsGroupwareCommunication() const override;
0110 
0111     /**
0112        Returns the Akonadi specific sub MIME type of a KCalendarCore::Journal.
0113     */
0114     Q_REQUIRED_RESULT static QLatin1String journalMimeType();
0115 
0116 protected:
0117     /**
0118       Compare this with @p journal for equality.
0119 
0120       @param journal is the journal to compare.
0121     */
0122     bool equals(const IncidenceBase &journal) const override;
0123 
0124     /**
0125       @copydoc
0126       IncidenceBase::assign()
0127     */
0128     IncidenceBase &assign(const IncidenceBase &other) override;
0129 
0130     /**
0131       @copydoc
0132       IncidenceBase::virtual_hook()
0133     */
0134     void virtual_hook(VirtualHook id, void *data) override;
0135 
0136 private:
0137     /**
0138       @copydoc
0139       IncidenceBase::accept(Visitor &, const IncidenceBase::Ptr &)
0140     */
0141     bool accept(Visitor &v, const IncidenceBase::Ptr &incidence) override;
0142 
0143     /**
0144       Disabled, otherwise could be dangerous if you subclass Journal.
0145       Use IncidenceBase::operator= which is safe because it calls
0146       virtual function assign().
0147       @param other is another Journal object to assign to this one.
0148      */
0149     Journal &operator=(const Journal &other) = delete;
0150 
0151     // For polymorphic serialization
0152     void serialize(QDataStream &out) const override;
0153     void deserialize(QDataStream &in) override;
0154 
0155     //@cond PRIVATE
0156     Q_DECLARE_PRIVATE(Journal)
0157 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 91)
0158     KCALENDARCORE_DEPRECATED_VERSION(5, 91, "Do not use")
0159     JournalPrivate *const _ = nullptr;    // TODO KF6 remove. ABI compatibility hack.
0160 #endif
0161     //@endcond
0162 };
0163 
0164 } // namespace KCalendarCore
0165 
0166 //@cond PRIVATE
0167 Q_DECLARE_TYPEINFO(KCalendarCore::Journal::Ptr, Q_MOVABLE_TYPE);
0168 Q_DECLARE_METATYPE(KCalendarCore::Journal::Ptr)
0169 Q_DECLARE_METATYPE(KCalendarCore::Journal *)
0170 //@endcond
0171 
0172 #endif