File indexing completed on 2024-07-07 03:49:01

0001 /*
0002     This file is part of the KContacts framework.
0003     SPDX-FileCopyrightText: 2003 Helge Deller <deller@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KCONTACTS_LDIFCONVERTER_H
0009 #define KCONTACTS_LDIFCONVERTER_H
0010 
0011 #include "addressee.h"
0012 #include "contactgroup.h"
0013 
0014 #include <QDateTime>
0015 #include <QString>
0016 
0017 namespace KContacts
0018 {
0019 /**
0020   A set of functions to convert a string with LDIF information to addressees
0021   and vice versa. It is useful for addressbook import- and exportfilters
0022   and might be used to read and write Mozilla and Netscape addresssbooks.
0023 */
0024 
0025 namespace LDIFConverter
0026 {
0027 /**
0028   Converts a LDIF string to a list of addressees.
0029 
0030   @param str         The vcard string.
0031   @param addrList    The addresseelist.
0032   @param contactGroupList the contactGroupList
0033   @param dt          The date & time value of the last modification (e.g. file modification time).
0034 */
0035 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool LDIFToAddressee(const QString &str,
0036                                                         AddresseeList &addrList,
0037                                                         QList<KContacts::ContactGroup> &contactGroupList,
0038                                                         const QDateTime &dt = QDateTime::currentDateTime());
0039 
0040 /**
0041   Converts a list of addressees to a LDIF string.
0042 
0043   @param addrList    The addresseelist.
0044   @param str         The LDIF string.
0045 */
0046 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const AddresseeList &addrList, QString &str);
0047 
0048 /**
0049   Converts a list of addressees and contactgrouplist to a LDIF string.
0050 
0051   @param addrList    The addresseelist.
0052   @param contactGroupList The contact group list
0053   @param str         The LDIF string.
0054 
0055 */
0056 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool
0057 addresseeAndContactGroupToLDIF(const AddresseeList &addrList, const QList<KContacts::ContactGroup> &contactGroupList, QString &str);
0058 /**
0059   Converts an addressee to a LDIF string.
0060 
0061   @param addr    The addressee.
0062   @param str     The LDIF string.
0063 */
0064 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const Addressee &addr, QString &str);
0065 
0066 /**
0067   Converts a list of contact group to a LDIF string.
0068 
0069   @param contactGroupList    The contact group list
0070   @param str         The LDIF string.
0071 */
0072 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup::List &contactGroupList, QString &str);
0073 
0074 /**
0075   Converts a contact group to a LDIF string.
0076 
0077   @param contactGroup    The contact group
0078   @param str         The LDIF string.
0079 */
0080 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup &contactGroup, QString &str);
0081 }
0082 }
0083 #endif