Libkdav2

davcollection.h
1 /*
2  Copyright (c) 2009 GrĂ©gory Oestreicher <[email protected]>
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 #ifndef KDAV2_DAVCOLLECTION_H
20 #define KDAV2_DAVCOLLECTION_H
21 
22 #include "kpimkdav2_export.h"
23 
24 #include "enums.h"
25 
26 #include <memory>
27 
28 #include <QtCore/QVector>
29 #include <QtCore/QString>
30 
31 class QColor;
32 
33 class DavCollectionPrivate;
34 
35 namespace KDAV2
36 {
37  class DavUrl;
38 }
39 
40 namespace KDAV2
41 {
42 
43 /**
44  * @short A helper class to store information about DAV collection.
45  *
46  * This class is used as container to transfer information about DAV
47  * collections between the Akonadi resource and the DAV jobs.
48  */
49 class KPIMKDAV2_EXPORT DavCollection
50 {
51 public:
52  /**
53  * Defines a list of DAV collection objects.
54  */
56 
57  /**
58  * Describes the possible content type of the DAV collection.
59  */
60  enum ContentType {
61  Events = 1, ///< The collection can contain event DAV resources.
62  Todos = 2, ///< The collection can contain todo DAV resources.
63  Contacts = 4, ///< The collection can contain contact DAV resources.
64  FreeBusy = 8, ///< The collection can contain free/busy information.
65  Journal = 16, ///< The collection can contain journal DAV resources.
66  Calendar = 32 ///< The collection can contain anything calendar-related.
67  };
68  Q_DECLARE_FLAGS(ContentTypes, ContentType)
69 
70  /**
71  * Creates an empty DAV collection.
72  */
73  DavCollection();
74 
75  /**
76  * Creates a new DAV collection.
77  *
78  * @param url The url that identifies the collection.
79  * @param displayName The display name of the collection.
80  * @param contentTypes The possible content types of the collection.
81  */
82  DavCollection(const DavUrl &url, const QString &displayName, ContentTypes contentTypes);
83 
84  DavCollection(const DavCollection &other);
85  DavCollection &operator=(const DavCollection &other);
86 
87  ~DavCollection();
88 
89  /**
90  * Sets this collection CTag.
91  */
92  void setCTag(const QString &ctag);
93 
94  /**
95  * Returns this collection CTag. The returned value will be empty
96  * if no CTag was found.
97  */
98  QString CTag() const;
99 
100  /**
101  * Sets the @p url that identifies the collection.
102  */
103  void setUrl(const DavUrl &url);
104 
105  /**
106  * Returns the url that identifies the collection.
107  */
108  DavUrl url() const;
109 
110  /**
111  * Sets the display @p name of the collection.
112  */
113  void setDisplayName(const QString &name);
114 
115  /**
116  * Returns the display name of the collection.
117  */
118  QString displayName() const;
119 
120  /**
121  * Sets the color for this collection
122  */
123  void setColor(const QColor &color);
124 
125  /**
126  * Return the color of the collection, or an empty string if
127  * none was provided by the backend.
128  */
129  QColor color() const;
130 
131  /**
132  * Sets the possible content @p types of the collection.
133  */
134  void setContentTypes(ContentTypes types);
135 
136  /**
137  * Returns the possible content types of the collection.
138  */
139  ContentTypes contentTypes() const;
140 
141  /**
142  * Sets the privileges on this collection.
143  */
144  void setPrivileges(Privileges privs);
145 
146  /**
147  * Returns the privileges on this collection.
148  */
149  Privileges privileges() const;
150 
151 private:
152  std::unique_ptr<DavCollectionPrivate> d;
153 };
154 
155 }
156 
157 Q_DECLARE_OPERATORS_FOR_FLAGS(KDAV2::DavCollection::ContentTypes)
158 Q_DECLARE_TYPEINFO(KDAV2::DavCollection, Q_MOVABLE_TYPE);
159 
160 #endif
A helper class to store information about DAV collection.
Definition: davcollection.h:49
ContentType
Describes the possible content type of the DAV collection.
Definition: davcollection.h:60
A helper class to combine url and protocol of a DAV url.
Definition: davurl.h:35
QVector< DavCollection > List
Defines a list of DAV collection objects.
Definition: davcollection.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 27 2022 23:10:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.