1/*
2 SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "protocolinfo.h"
8#include "davmanager_p.h"
9#include "davprotocolbase_p.h"
10#include "libkdav_debug.h"
11
12using namespace KDAV;
13
14bool ProtocolInfo::useMultiget(KDAV::Protocol protocol)
15{
16 return DavManager::davProtocol(protocol)->useMultiget();
17}
18
19QString ProtocolInfo::principalHomeSet(KDAV::Protocol protocol)
20{
21 return DavManager::davProtocol(protocol)->principalHomeSet();
22}
23
24QString ProtocolInfo::principalHomeSetNS(KDAV::Protocol protocol)
25{
26 return DavManager::davProtocol(protocol)->principalHomeSetNS();
27}
28
29QString ProtocolInfo::protocolName(KDAV::Protocol protocol)
30{
31 switch (protocol) {
32 case KDAV::CalDav:
33 return QStringLiteral("CalDav");
34 case KDAV::CardDav:
35 return QStringLiteral("CardDav");
36 case KDAV::GroupDav:
37 return QStringLiteral("GroupDav");
38 }
39 return {};
40}
41
42KDAV::Protocol ProtocolInfo::protocolByName(const QString &name)
43{
44 Protocol protocol = KDAV::CalDav;
45
46 if (name == QLatin1String("CalDav")) {
47 protocol = KDAV::CalDav;
48 } else if (name == QLatin1String("CardDav")) {
49 protocol = KDAV::CardDav;
50 } else if (name == QLatin1String("GroupDav")) {
51 protocol = KDAV::GroupDav;
52 } else {
53 qCCritical(KDAV_LOG) << "Unexpected protocol name : " << name;
54 }
55
56 return protocol;
57}
58
59QString ProtocolInfo::contactsMimeType(KDAV::Protocol protocol)
60{
61 QString ret;
62
63 if (protocol == KDAV::CardDav) {
64 ret = QStringLiteral("text/vcard");
65 } else if (protocol == KDAV::GroupDav) {
66 ret = QStringLiteral("text/x-vcard");
67 }
68
69 return ret;
70}
71

source code of kdav/src/common/protocolinfo.cpp