File indexing completed on 2024-09-29 12:03:21
0001 /* 0002 This file is part of the KContacts framework. 0003 SPDX-FileCopyrightText: 2015-2019 Laurent Montel <montel@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef CALENDARURL_H 0009 #define CALENDARURL_H 0010 #include "kcontacts_export.h" 0011 0012 #include <QMap> 0013 #include <QSharedDataPointer> 0014 #include <QString> 0015 class QUrl; 0016 0017 class CalendarUrlTest; 0018 0019 namespace KContacts 0020 { 0021 class ParameterMap; 0022 0023 /** @short Class that holds a Calendar Url (FBURL/CALADRURI/CALURI) 0024 * @since 4.14.6 0025 */ 0026 class KCONTACTS_EXPORT CalendarUrl 0027 { 0028 friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const CalendarUrl &); 0029 friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, CalendarUrl &); 0030 friend class VCardTool; 0031 friend class ::CalendarUrlTest; 0032 0033 public: 0034 enum CalendarType { 0035 Unknown = 0, 0036 FBUrl, 0037 CALUri, 0038 CALADRUri, 0039 EndCalendarType, 0040 }; 0041 0042 CalendarUrl(); 0043 CalendarUrl(CalendarUrl::CalendarType type); 0044 CalendarUrl(const CalendarUrl &other); 0045 0046 ~CalendarUrl(); 0047 0048 typedef QVector<CalendarUrl> List; 0049 0050 Q_REQUIRED_RESULT bool isValid() const; 0051 0052 void setType(CalendarUrl::CalendarType type); 0053 Q_REQUIRED_RESULT CalendarUrl::CalendarType type() const; 0054 0055 void setUrl(const QUrl &url); 0056 QUrl url() const; 0057 0058 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88) 0059 /** 0060 * @deprecated Since 5.88 for lack of usage 0061 */ 0062 KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.") 0063 void setParameters(const QMap<QString, QStringList> ¶ms); 0064 #endif 0065 0066 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88) 0067 /** 0068 * @deprecated Since 5.88 for lack of usage 0069 */ 0070 Q_REQUIRED_RESULT 0071 KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.") 0072 QMap<QString, QStringList> parameters() const; 0073 #endif 0074 0075 Q_REQUIRED_RESULT bool operator==(const CalendarUrl &other) const; 0076 Q_REQUIRED_RESULT bool operator!=(const CalendarUrl &other) const; 0077 0078 CalendarUrl &operator=(const CalendarUrl &other); 0079 0080 Q_REQUIRED_RESULT QString toString() const; 0081 0082 private: 0083 // exported for CalendarUrlTest 0084 void setParams(const ParameterMap ¶ms); 0085 Q_REQUIRED_RESULT ParameterMap params() const; 0086 0087 class Private; 0088 QSharedDataPointer<Private> d; 0089 }; 0090 0091 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const CalendarUrl &object); 0092 0093 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, CalendarUrl &object); 0094 } 0095 Q_DECLARE_TYPEINFO(KContacts::CalendarUrl, Q_MOVABLE_TYPE); 0096 #endif // CALENDARURL_H