File indexing completed on 2024-04-21 03:52:45

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org>
0005 
0006   SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KCALCORE_CONFERENCE_H
0010 #define KCALCORE_CONFERENCE_H
0011 
0012 #include <QMetaType>
0013 #include <QSharedDataPointer>
0014 #include <QUrl>
0015 
0016 #include "customproperties.h"
0017 #include "kcalendarcore_export.h"
0018 
0019 namespace KCalendarCore
0020 {
0021 /**
0022   @brief
0023   Represents information related to a conference information of an Calendar
0024   Incidence, typically a meeting or task (to-do).
0025 
0026   Conference contains information needed to join a remote conference system
0027   (e.g. phone call, audio/video meeting etc.)
0028 
0029   @since 5.77
0030 */
0031 class KCALENDARCORE_EXPORT Conference
0032 {
0033     Q_GADGET
0034     Q_PROPERTY(bool isNull READ isNull)
0035     Q_PROPERTY(QStringList features READ features WRITE setFeatures)
0036     Q_PROPERTY(QString label READ label WRITE setLabel)
0037     Q_PROPERTY(QUrl uri READ uri WRITE setUri)
0038     Q_PROPERTY(QString language READ language WRITE setLanguage)
0039 
0040 public:
0041     using List = QList<Conference>;
0042 
0043     /** Create a null Conference. */
0044     explicit Conference();
0045 
0046     /**
0047       Constructs a conference consisting of a @p uri, description of
0048       the URI (@p label), list of features of the conference (@p features)
0049       and @p language.
0050 
0051       @param uri Uri to join the conference.
0052       @param label Label of the URI.
0053       @param features Features of this particular conference method.
0054       @param language Language of the information present in other fields.
0055     */
0056     Conference(const QUrl &uri, const QString &label, const QStringList &features = {}, const QString &language = {});
0057 
0058     /**
0059       Constructs a conference by copying another conference.
0060 
0061       @param conference is the conference to be copied.
0062     */
0063     Conference(const Conference &conference);
0064 
0065     /**
0066       Destroys the conference.
0067     */
0068     ~Conference();
0069 
0070     /**
0071       Compares this with @p conference for equality.
0072 
0073       @param conference the conference to compare.
0074     */
0075     bool operator==(const Conference &conference) const;
0076 
0077     /**
0078       Compares this with @p conference for inequality.
0079 
0080       @param conference the conference to compare.
0081     */
0082     bool operator!=(const Conference &other) const;
0083 
0084     /**
0085      * Returns @c true if this is a default-constructed Conference instance.
0086      */
0087     Q_REQUIRED_RESULT bool isNull() const;
0088 
0089     /**
0090      * Returns URI to join the conference, with access code included.
0091      */
0092     Q_REQUIRED_RESULT QUrl uri() const;
0093 
0094     /**
0095      * Sets the URI to @uri.
0096      */
0097     void setUri(const QUrl &uri);
0098 
0099     /**
0100      * Returns label with additional details regarding further use of the URI.
0101      */
0102     Q_REQUIRED_RESULT QString label() const;
0103 
0104     /**
0105      * Sets the URI label to @p label.
0106      */
0107     void setLabel(const QString &label);
0108 
0109     /**
0110      * Returns the list of features of the conferencing system at given URI.
0111      *
0112      * This can be e.g. CHAT, AUDIO, VIDEO, PHONE, etc.
0113      */
0114     Q_REQUIRED_RESULT QStringList features() const;
0115 
0116     /**
0117      * Adds @p feature to the list of features.
0118      *
0119      * @param feature Feature to add.
0120      */
0121     void addFeature(const QString &feature);
0122 
0123     /**
0124      * Removes @p feature from the list of features.
0125      *
0126      * @param feature Feature to remove.
0127      */
0128     void removeFeature(const QString &feature);
0129 
0130     /**
0131      * Sets the list of features to @p features.
0132      */
0133     void setFeatures(const QStringList &features);
0134 
0135     /**
0136      * Returns the language of the text present in other properties of this object.
0137      */
0138     Q_REQUIRED_RESULT QString language() const;
0139 
0140     /**
0141      * Sets the language to @p language.
0142      */
0143     void setLanguage(const QString &language);
0144 
0145     /**
0146       Sets this conference equal to @p conference.
0147 
0148       @param conference is the conference to copy.
0149     */
0150     Conference &operator=(const Conference &conference);
0151 
0152     /**
0153       Adds a custom property. If the property already exists it will be overwritten.
0154       @param xname is the name of the property.
0155       @param xvalue is its value.
0156     */
0157     void setCustomProperty(const QByteArray &xname, const QString &xvalue);
0158 
0159     /**
0160       Returns a reference to the CustomProperties object
0161     */
0162     Q_REQUIRED_RESULT CustomProperties &customProperties();
0163 
0164     /**
0165       Returns a const reference to the CustomProperties object
0166     */
0167     const CustomProperties &customProperties() const;
0168 
0169 private:
0170     //@cond PRIVATE
0171     class Private;
0172     QSharedDataPointer<Private> d;
0173     //@endcond
0174 
0175     friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &, const KCalendarCore::Conference &);
0176     friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &, KCalendarCore::Conference &);
0177 };
0178 
0179 /**
0180   Serializes a Conference object into a data stream.
0181   @param stream is a QDataStream.
0182   @param conference is a reference to a Conference object to be serialized.
0183 */
0184 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Conference &conference);
0185 
0186 /**
0187   Initializes a Conference object from a data stream.
0188   @param stream is a QDataStream.
0189   @param conference is a reference to a Conference object to be initialized.
0190 */
0191 KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Conference &conference);
0192 
0193 }
0194 
0195 //@cond PRIVATE
0196 Q_DECLARE_TYPEINFO(KCalendarCore::Conference, Q_RELOCATABLE_TYPE);
0197 Q_DECLARE_METATYPE(KCalendarCore::Conference)
0198 //@endcond
0199 
0200 #endif