KDAV

protocolinfo.cpp
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
15{
16 return DavManager::davProtocol(protocol)->useMultiget();
17}
18
20{
21 return DavManager::davProtocol(protocol)->principalHomeSet();
22}
23
25{
26 return DavManager::davProtocol(protocol)->principalHomeSetNS();
27}
28
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
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
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}
KDAV_EXPORT QString contactsMimeType(KDAV::Protocol protocol)
Returns the mimetype that shall be used for contact DAV resources using protocol.
KDAV_EXPORT KDAV::Protocol protocolByName(const QString &name)
Returns the protocol matching the given name.
KDAV_EXPORT QString principalHomeSetNS(KDAV::Protocol protocol)
Returns the principal home set namespace of protocol.
KDAV_EXPORT QString protocolName(KDAV::Protocol protocol)
Returns the untranslated name of the given DAV protocol dialect.
KDAV_EXPORT QString principalHomeSet(KDAV::Protocol protocol)
Returns the principal home set of protocol.
KDAV_EXPORT bool useMultiget(KDAV::Protocol protocol)
Returns whether the protocol dialect supports the MULTIGET command.
The KDAV namespace.
Protocol
Describes the DAV protocol dialect.
Definition enums.h:20
@ GroupDav
The GroupDav protocol as defined in http://www.groupdav.org.
Definition enums.h:23
@ CardDav
The CardDav protocol as defined in https://devguide.calconnect.org/CardDAV.
Definition enums.h:22
@ CalDav
The CalDav protocol as defined in https://devguide.calconnect.org/CalDAV.
Definition enums.h:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.