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 A set of functions to convert a string with LDIF information to addressees
21 and vice versa. It is useful for addressbook import- and exportfilters
22 and might be used to read and write Mozilla and Netscape addresssbooks.
23*/
24
25namespace LDIFConverter
26{
27/**
28 Converts a LDIF string to a list of addressees.
29
30 @param str The vcard string.
31 @param addrList The addresseelist.
32 @param contactGroupList the contactGroupList
33 @param dt The date & time value of the last modification (e.g. file modification time).
34*/
35Q_REQUIRED_RESULT KCONTACTS_EXPORT bool LDIFToAddressee(const QString &str,
36 AddresseeList &addrList,
37 QList<KContacts::ContactGroup> &contactGroupList,
38 const QDateTime &dt = QDateTime::currentDateTime());
39
40/**
41 Converts a list of addressees to a LDIF string.
42
43 @param addrList The addresseelist.
44 @param str The LDIF string.
45*/
46Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const AddresseeList &addrList, QString &str);
47
48/**
49 Converts a list of addressees and contactgrouplist to a LDIF string.
50
51 @param addrList The addresseelist.
52 @param contactGroupList The contact group list
53 @param str The LDIF string.
54
55*/
56Q_REQUIRED_RESULT KCONTACTS_EXPORT bool
57addresseeAndContactGroupToLDIF(const AddresseeList &addrList, const QList<KContacts::ContactGroup> &contactGroupList, QString &str);
58/**
59 Converts an addressee to a LDIF string.
60
61 @param addr The addressee.
62 @param str The LDIF string.
63*/
64Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const Addressee &addr, QString &str);
65
66/**
67 Converts a list of contact group to a LDIF string.
68
69 @param contactGroupList The contact group list
70 @param str The LDIF string.
71*/
72Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup::List &contactGroupList, QString &str);
73
74/**
75 Converts a contact group to a LDIF string.
76
77 @param contactGroup The contact group
78 @param str The LDIF string.
79*/
80Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup &contactGroup, QString &str);
81}
82}
83#endif
84

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