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 * @short Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
25 *
26 * @see RFC 6350 Section 6.9 (https://datatracker.ietf.org/doc/html/rfc6350#section-6.9)
27 * @since 4.14.6
28 */
29class KCONTACTS_EXPORT CalendarUrl
30{
31 friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const CalendarUrl &);
32 friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, CalendarUrl &);
33 friend class VCardTool;
34 friend class ::CalendarUrlTest;
35
36public:
37 enum CalendarType {
38 Unknown = 0, ///< Unknow calendar type
39 FBUrl, ///< Specify the calendar containing the FreeBusy time information
40 CALUri, ///< Specify the calendar associated with the contact
41 CALADRUri, ///< Specify the calendar which should received the sheduling requests
42 EndCalendarType,
43 };
44
45 CalendarUrl();
46 CalendarUrl(CalendarUrl::CalendarType type);
47 CalendarUrl(const CalendarUrl &other);
48
49 ~CalendarUrl();
50
51 typedef QList<CalendarUrl> List;
52
53 Q_REQUIRED_RESULT bool isValid() const;
54
55 void setType(CalendarUrl::CalendarType type);
56 Q_REQUIRED_RESULT CalendarUrl::CalendarType type() const;
57
58 void setUrl(const QUrl &url);
59 QUrl url() const;
60
61 Q_REQUIRED_RESULT bool operator==(const CalendarUrl &other) const;
62 Q_REQUIRED_RESULT bool operator!=(const CalendarUrl &other) const;
63
64 CalendarUrl &operator=(const CalendarUrl &other);
65
66 Q_REQUIRED_RESULT QString toString() const;
67
68private:
69 // exported for CalendarUrlTest
70 void setParams(const ParameterMap &params);
71 Q_REQUIRED_RESULT ParameterMap params() const;
72
73 class Private;
74 QSharedDataPointer<Private> d;
75};
76
77KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const CalendarUrl &object);
78
79KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, CalendarUrl &object);
80}
81Q_DECLARE_TYPEINFO(KContacts::CalendarUrl, Q_RELOCATABLE_TYPE);
82#endif // CALENDARURL_H
83

source code of kcontacts/src/calendarurl.h