1/*
2 This file is part of the KContacts framework.
3 SPDX-FileCopyrightText: 2003 Helge Deller <deller@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KCONTACTS_LDIFCONVERTER_H
9#define KCONTACTS_LDIFCONVERTER_H
10
11#include "addressee.h"
12#include "contactgroup.h"
13
14#include <QDateTime>
15#include <QString>
16
17namespace KContacts
18{
19/*!
20 * \namespace KContacts::LDIFConverter
21 * \inheaderfile KContacts/LDIFConverter
22 * \inmodule KContacts
23 *
24 * \brief A set of functions to convert a string with LDIF information to addressees
25 * and vice versa.
26 *
27 * It is useful for addressbook import- and exportfilters
28 * and might be used to read and write Mozilla and Netscape addresssbooks.
29 */
30namespace LDIFConverter
31{
32/*!
33 Converts a LDIF string to a list of addressees.
34
35 \a str The vcard string.
36
37 \a addrList The addresseelist.
38
39 \a contactGroupList the contactGroupList
40
41 \a dt The date & time value of the last modification (e.g. file modification time).
42*/
43Q_REQUIRED_RESULT KCONTACTS_EXPORT bool LDIFToAddressee(const QString &str,
44 AddresseeList &addrList,
45 QList<KContacts::ContactGroup> &contactGroupList,
46 const QDateTime &dt = QDateTime::currentDateTime());
47
48/*!
49 Converts a list of addressees to a LDIF string.
50
51 \a addrList The addresseelist.
52
53 \a str The LDIF string.
54*/
55Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const AddresseeList &addrList, QString &str);
56
57/*!
58 Converts a list of addressees and contactgrouplist to a LDIF string.
59
60 \a addrList The addresseelist.
61
62 \a contactGroupList The contact group list
63
64 \a str The LDIF string.
65
66*/
67Q_REQUIRED_RESULT KCONTACTS_EXPORT bool
68addresseeAndContactGroupToLDIF(const AddresseeList &addrList, const QList<KContacts::ContactGroup> &contactGroupList, QString &str);
69/*!
70 Converts an addressee to a LDIF string.
71
72 \a addr The addressee.
73
74 \a str The LDIF string.
75*/
76Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const Addressee &addr, QString &str);
77
78/*!
79 Converts a list of contact group to a LDIF string.
80
81 \a contactGroupList The contact group list
82
83 \a str The LDIF string.
84*/
85Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup::List &contactGroupList, QString &str);
86
87/*!
88 Converts a contact group to a LDIF string.
89
90 \a contactGroup The contact group
91
92 \a str The LDIF string.
93*/
94Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup &contactGroup, QString &str);
95}
96}
97#endif
98

source code of kcontacts/src/converter/ldifconverter.h