Libkdav2

davcollection.cpp
1/*
2 Copyright (c) 2009 Grégory Oestreicher <greg@kamago.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/
18
19#include "davcollection.h"
20
21#include "davurl.h"
22
23#include <QColor>
24
25using namespace KDAV2;
26
27class DavCollectionPrivate
28{
29public:
30 DavCollectionPrivate(DavCollection *qPtr) : q(qPtr) {}
31
32 void fillFrom(const DavCollectionPrivate &other);
33
35 QString mCTag;
36 DavUrl mUrl;
37 QString mDisplayName;
38 QColor mColor;
39 DavCollection::ContentTypes mContentTypes;
40 Privileges mPrivileges;
41};
42
43void DavCollectionPrivate::fillFrom(const DavCollectionPrivate &other)
44{
45 mCTag = other.mCTag;
46 mUrl = other.mUrl;
47 mDisplayName = other.mDisplayName;
48 mColor = other.mColor;
49 mContentTypes = other.mContentTypes;
50 mPrivileges = other.mPrivileges;
51}
52
53
55 : d(std::unique_ptr<DavCollectionPrivate>(new DavCollectionPrivate(this)))
56{
57}
58
59DavCollection::DavCollection(const DavUrl &url, const QString &displayName, ContentTypes contentTypes)
60 : d(std::unique_ptr<DavCollectionPrivate>(new DavCollectionPrivate(this)))
61{
62 d->mUrl = url;
63 d->mDisplayName = displayName;
64 d->mContentTypes = contentTypes;
65 d->mPrivileges = KDAV2::All;
66}
67
69 : d(std::unique_ptr<DavCollectionPrivate>(new DavCollectionPrivate(this)))
70{
71 d->fillFrom(*other.d.get());
72}
73
74DavCollection &DavCollection::operator=(const DavCollection &other)
75{
76 d->fillFrom(*other.d.get());
77 return *this;
78}
79
80DavCollection::~DavCollection()
81{
82}
83
85{
86 d->mCTag = ctag;
87}
88
90{
91 return d->mCTag;
92}
93
95{
96 d->mUrl = url;
97}
98
100{
101 return d->mUrl;
102}
103
105{
106 d->mDisplayName = displayName;
107}
108
110{
111 return d->mDisplayName;
112}
113
115{
116 d->mColor = color;
117}
118
120{
121 return d->mColor;
122}
123
125{
126 d->mContentTypes = contentTypes;
127}
128
130{
131 return d->mContentTypes;
132}
133
135{
136 d->mPrivileges = privs;
137}
138
140{
141 return d->mPrivileges;
142}
143
A helper class to store information about DAV collection.
Privileges privileges() const
Returns the privileges on this collection.
QString displayName() const
Returns the display name of the collection.
void setPrivileges(Privileges privs)
Sets the privileges on this collection.
void setDisplayName(const QString &name)
Sets the display name of the collection.
ContentTypes contentTypes() const
Returns the possible content types of the collection.
void setUrl(const DavUrl &url)
Sets the url that identifies the collection.
DavUrl url() const
Returns the url that identifies the collection.
DavCollection()
Creates an empty DAV collection.
QString CTag() const
Returns this collection CTag.
QColor color() const
Return the color of the collection, or an empty string if none was provided by the backend.
void setCTag(const QString &ctag)
Sets this collection CTag.
void setColor(const QColor &color)
Sets the color for this collection.
void setContentTypes(ContentTypes types)
Sets the possible content types of the collection.
A helper class to combine url and protocol of a DAV url.
Definition davurl.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.