1/*
2 This file is part of the KContacts framework.
3 SPDX-FileCopyrightText: 2015-2019 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef CALENDARURL_H
9#define CALENDARURL_H
10#include "kcontacts_export.h"
11
12#include <QMap>
13#include <QSharedDataPointer>
14#include <QString>
15class QUrl;
16
17class CalendarUrlTest;
18
19namespace KContacts
20{
21class ParameterMap;
22
23/*!
24 * \class KContacts::CalendarUrl
25 * \inheaderfile KContacts/CalendarUrl
26 * \inmodule KContacts
27 *
28 * \brief Class that holds a Calendar Url (FBURL/CALADRURI/CALURI).
29 *
30 * \sa https://datatracker.ietf.org/doc/html/rfc6350#section-6.9
31 * \since 4.14.6
32 */
33class KCONTACTS_EXPORT CalendarUrl
34{
35 friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const CalendarUrl &);
36 friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, CalendarUrl &);
37 friend class VCardTool;
38 friend class ::CalendarUrlTest;
39
40public:
41 /*!
42 * \value Unknown Unknow calendar type
43 * \value FBUrl Specify the calendar containing the FreeBusy time information
44 * \value CALUri Specify the calendar associated with the contact
45 * \value CALADRUri Specify the calendar which should received the sheduling requests
46 * \omitvalue EndCalendarType
47 */
48 enum CalendarType {
49 Unknown = 0,
50 FBUrl,
51 CALUri,
52 CALADRUri,
53 EndCalendarType,
54 };
55
56 /*!
57 *
58 */
59 CalendarUrl();
60
61 /*!
62 *
63 */
64 CalendarUrl(CalendarUrl::CalendarType type);
65
66 CalendarUrl(const CalendarUrl &other);
67
68 ~CalendarUrl();
69
70 /*!
71 * \typedef KContacts::CalendarUrl::List
72 */
73 typedef QList<CalendarUrl> List;
74
75 /*!
76 *
77 */
78 Q_REQUIRED_RESULT bool isValid() const;
79
80 /*!
81 *
82 */
83 void setType(CalendarUrl::CalendarType type);
84
85 /*!
86 *
87 */
88 Q_REQUIRED_RESULT CalendarUrl::CalendarType type() const;
89
90 /*!
91 *
92 */
93 void setUrl(const QUrl &url);
94
95 /*!
96 *
97 */
98 QUrl url() const;
99
100 /*!
101 *
102 */
103 Q_REQUIRED_RESULT bool operator==(const CalendarUrl &other) const;
104
105 /*!
106 *
107 */
108 Q_REQUIRED_RESULT bool operator!=(const CalendarUrl &other) const;
109
110 CalendarUrl &operator=(const CalendarUrl &other);
111
112 /*!
113 *
114 */
115 Q_REQUIRED_RESULT QString toString() const;
116
117private:
118 // exported for CalendarUrlTest
119 void setParams(const ParameterMap &params);
120 Q_REQUIRED_RESULT ParameterMap params() const;
121
122 class Private;
123 QSharedDataPointer<Private> d;
124};
125
126/*!
127 * \relates KContacts::CalendarUrl
128 */
129KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const CalendarUrl &object);
130
131/*!
132 * \relates KContacts::CalendarUrl
133 */
134KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, CalendarUrl &object);
135}
136Q_DECLARE_TYPEINFO(KContacts::CalendarUrl, Q_RELOCATABLE_TYPE);
137#endif // CALENDARURL_H
138

source code of kcontacts/src/calendarurl.h