21#include "calendarurl.h"
25#include <qstringlist.h>
29class CalendarUrl::Private :
public QSharedData
36 Private(
const Private &other )
37 : QSharedData( other )
39 parameters = other.parameters;
43 static QString typeToString(CalendarUrl::CalendarType type);
44 QMap<QString, QStringList> parameters;
46 CalendarUrl::CalendarType type;
50QString CalendarUrl::Private::typeToString(CalendarUrl::CalendarType type)
55 ret = QLatin1String(
"Unknown");
58 ret = QLatin1String(
"FreeBusy");
61 ret = QLatin1String(
"CalUri");
64 ret = QLatin1String(
"Caladruri");
71CalendarUrl::CalendarUrl()
77CalendarUrl::CalendarUrl(CalendarUrl::CalendarType type)
83CalendarUrl::CalendarUrl(
const CalendarUrl &other )
88CalendarUrl::~CalendarUrl()
93QMap<QString, QStringList> CalendarUrl::parameters()
const
98bool CalendarUrl::operator==(
const CalendarUrl &other)
const
100 return (d->parameters == other.parameters()) && (d->type == other.type()) && (d->url == other.url());
103bool CalendarUrl::operator!=(
const CalendarUrl &other)
const
105 return !( other == *this );
108CalendarUrl &CalendarUrl::operator=(
const CalendarUrl &other)
110 if (
this != &other ) {
118QString CalendarUrl::toString()
const
121 str += QString::fromLatin1(
"CalendarUrl {\n" );
122 str += QString::fromLatin1(
" url: %1\n" ).arg( d->url.toString() );
123 str += QString::fromLatin1(
" type: %1\n" ).arg( CalendarUrl::Private::typeToString(d->type) );
124 if (!d->parameters.isEmpty()) {
125 QMapIterator<QString, QStringList> i(d->parameters);
127 while (i.hasNext()) {
129 param += QString::fromLatin1(
"%1 %2").arg(i.key()).arg(i.value().join(QLatin1String(
",")));
131 str += QString::fromLatin1(
" parameters: %1\n" ).arg( param );
133 str += QString::fromLatin1(
"}\n" );
137void CalendarUrl::setParameters(
const QMap<QString, QStringList> ¶ms)
139 d->parameters = params;
142bool CalendarUrl::isValid()
const
144 return (d->type != Unknown) && (d->url.isValid());
147void CalendarUrl::setType(CalendarUrl::CalendarType type)
152CalendarUrl::CalendarType CalendarUrl::type()
const
157void CalendarUrl::setUrl(
const QUrl &url)
162QUrl CalendarUrl::url()
const
169 return s << calUrl.d->parameters << (uint)calUrl.d->type << calUrl.d->url;
175 s >> calUrl.d->parameters >> type >> calUrl.d->url;
176 calUrl.d->type =
static_cast<CalendarUrl::CalendarType
>(type);
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
QDataStream & operator<<(QDataStream &stream, const Address &address)
Serializes the address object into the stream.
QDataStream & operator>>(QDataStream &stream, Address &address)
Initializes the address object from the stream.