Akonadi

collectionidentificationattribute.cpp
1/*
2 SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "collectionidentificationattribute.h"
8
9#include "private/imapparser_p.h"
10
11#include <QByteArray>
12#include <QList>
13
14using namespace Akonadi;
15
16class Akonadi::CollectionIdentificationAttributePrivate
17{
18public:
19 QByteArray mFolderNamespace;
20 QByteArray mIdentifier;
21 QByteArray mName;
22 QByteArray mOrganizationUnit;
23 QByteArray mMail;
24};
25
26CollectionIdentificationAttribute::CollectionIdentificationAttribute(const QByteArray &identifier,
27 const QByteArray &folderNamespace,
28 const QByteArray &name,
29 const QByteArray &organizationUnit,
30 const QByteArray &mail)
31 : d(new CollectionIdentificationAttributePrivate())
32{
33 d->mIdentifier = identifier;
34 d->mFolderNamespace = folderNamespace;
35 d->mName = name;
36 d->mOrganizationUnit = organizationUnit;
37 d->mMail = mail;
38}
39
40CollectionIdentificationAttribute::~CollectionIdentificationAttribute() = default;
41
43{
44 d->mIdentifier = identifier;
45}
46
47QByteArray CollectionIdentificationAttribute::identifier() const
48{
49 return d->mIdentifier;
50}
51
52void CollectionIdentificationAttribute::setMail(const QByteArray &mail)
53{
54 d->mMail = mail;
55}
56
57QByteArray CollectionIdentificationAttribute::mail() const
58{
59 return d->mMail;
60}
61
62void CollectionIdentificationAttribute::setOu(const QByteArray &ou)
63{
64 d->mOrganizationUnit = ou;
65}
66
67QByteArray CollectionIdentificationAttribute::ou() const
68{
69 return d->mOrganizationUnit;
70}
71
72void CollectionIdentificationAttribute::setName(const QByteArray &name)
73{
74 d->mName = name;
75}
76
77QByteArray CollectionIdentificationAttribute::name() const
78{
79 return d->mName;
80}
81
83{
84 d->mFolderNamespace = ns;
85}
86
87QByteArray CollectionIdentificationAttribute::collectionNamespace() const
88{
89 return d->mFolderNamespace;
90}
91
93{
94 return QByteArrayLiteral("collectionidentification");
95}
96
98{
99 return new CollectionIdentificationAttribute(d->mIdentifier, d->mFolderNamespace, d->mName, d->mOrganizationUnit, d->mMail);
100}
101
103{
105 l << Akonadi::ImapParser::quote(d->mIdentifier);
106 l << Akonadi::ImapParser::quote(d->mFolderNamespace);
107 l << Akonadi::ImapParser::quote(d->mName);
108 l << Akonadi::ImapParser::quote(d->mOrganizationUnit);
109 l << Akonadi::ImapParser::quote(d->mMail);
110 return '(' + Akonadi::ImapParser::join(l, " ") + ')';
111}
112
114{
116 Akonadi::ImapParser::parseParenthesizedList(data, l);
117 const int size = l.size();
118 Q_ASSERT(size >= 2);
119 if (size < 2) {
120 return;
121 }
122 d->mIdentifier = l[0];
123 d->mFolderNamespace = l[1];
124
125 if (size == 5) {
126 d->mName = l[2];
127 d->mOrganizationUnit = l[3];
128 d->mMail = l[4];
129 }
130}
Provides interface for custom attributes for Entity.
Definition attribute.h:132
Attribute that stores additional information on a collection that can be used for searching.
void setCollectionNamespace(const QByteArray &ns)
Sets a namespace the collection is in.
QByteArray type() const override
Returns the type of the attribute.
void deserialize(const QByteArray &data) override
Sets the data of this attribute, using the same encoding as returned by toByteArray().
void setIdentifier(const QByteArray &identifier)
Sets an identifier for the collection.
Attribute * clone() const override
Creates a copy of this attribute.
QByteArray serialized() const override
Returns a QByteArray representation of the attribute which will be storaged.
Helper integration between Akonadi and Qt.
QString name(StandardAction id)
QAction * mail(const QObject *recvr, const char *slot, QObject *parent)
qsizetype size() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 11:57:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.