File indexing completed on 2024-05-12 05:46:42

0001 /*
0002     This file is part of the KContacts framework.
0003     Copyright (c) 2003 Helge Deller <deller@kde.org>
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Library General Public
0007     License version 2 only as published by the Free Software Foundation.
0008 
0009     This library is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012     Library General Public License for more details.
0013 
0014     You should have received a copy of the GNU Library General Public License
0015     along with this library; see the file COPYING.LIB.  If not, write to
0016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017     Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KCONTACTS_LDIFCONVERTER_H
0021 #define KCONTACTS_LDIFCONVERTER_H
0022 
0023 #include "addressee.h"
0024 #include "contactgroup.h"
0025 
0026 #include <QDateTime>
0027 #include <QString>
0028 
0029 namespace KContacts {
0030 /**
0031   A set of functions to convert a string with LDIF information to addressees
0032   and vice versa. It is useful for addressbook import- and exportfilters
0033   and might be used to read and write Mozilla and Netscape addresssbooks.
0034 */
0035 
0036 namespace LDIFConverter {
0037 /**
0038   Converts a LDIF string to a list of addressees.
0039 
0040   @param str         The vcard string.
0041   @param addrList    The addresseelist.
0042   @param contactGroupList the contactGroupList
0043   @param dt          The date & time value of the last modification (e.g. file modification time).
0044 */
0045 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool LDIFToAddressee(const QString &str, AddresseeList &addrList, QVector<KContacts::ContactGroup> &contactGroupList, const QDateTime &dt = QDateTime::currentDateTime());
0046 
0047 /**
0048   Converts a list of addressees to a LDIF string.
0049 
0050   @param addrList    The addresseelist.
0051   @param str         The LDIF string.
0052 */
0053 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const AddresseeList &addrList, QString &str);
0054 
0055 /**
0056   Converts a list of addressees and contactgrouplist to a LDIF string.
0057 
0058   @param addrList    The addresseelist.
0059   @param contactGroupList The contact group list
0060   @param str         The LDIF string.
0061 
0062 */
0063 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeAndContactGroupToLDIF(const AddresseeList &addrList, const QVector<KContacts::ContactGroup> &contactGroupList, QString &str);
0064 /**
0065   Converts an addressee to a LDIF string.
0066 
0067   @param addr    The addressee.
0068   @param str     The LDIF string.
0069 */
0070 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool addresseeToLDIF(const Addressee &addr, QString &str);
0071 
0072 /**
0073   Converts a list of contact group to a LDIF string.
0074 
0075   @param contactGroupList    The contact group list
0076   @param str         The LDIF string.
0077 */
0078 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup::List &contactGroupList, QString &str);
0079 
0080 /**
0081   Converts a contact group to a LDIF string.
0082 
0083   @param contactGroup    The contact group
0084   @param str         The LDIF string.
0085 */
0086 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool contactGroupToLDIF(const ContactGroup &contactGroup, QString &str);
0087 }
0088 }
0089 #endif