File indexing completed on 2024-12-22 04:55:32
0001 /* 0002 This file is part of KAddressBook. 0003 0004 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include "kaddressbook_importexport_export.h" 0012 #include <KContacts/Addressee> 0013 namespace KAddressBookImportExport 0014 { 0015 /** Contact fields for import/export. */ 0016 class KADDRESSBOOK_IMPORTEXPORT_EXPORT ContactFields 0017 { 0018 public: 0019 /** 0020 * Describes the standard fields that are available for every contact 0021 */ 0022 enum Field { 0023 Undefined = 0, 0024 0025 FormattedName, 0026 Prefix, 0027 GivenName, 0028 AdditionalName, 0029 FamilyName, 0030 Suffix, 0031 NickName, 0032 0033 Birthday, 0034 Anniversary, 0035 0036 HomeAddressStreet, 0037 HomeAddressPostOfficeBox, 0038 HomeAddressLocality, 0039 HomeAddressRegion, 0040 HomeAddressPostalCode, 0041 HomeAddressCountry, 0042 HomeAddressLabel, 0043 0044 BusinessAddressStreet, 0045 BusinessAddressPostOfficeBox, 0046 BusinessAddressLocality, 0047 BusinessAddressRegion, 0048 BusinessAddressPostalCode, 0049 BusinessAddressCountry, 0050 BusinessAddressLabel, 0051 0052 HomePhone, 0053 BusinessPhone, 0054 MobilePhone, 0055 HomeFax, 0056 BusinessFax, 0057 CarPhone, 0058 Isdn, 0059 Pager, 0060 0061 PreferredEmail, 0062 Email2, 0063 Email3, 0064 Email4, 0065 0066 Mailer, 0067 Title, 0068 Role, 0069 Organization, 0070 Note, 0071 Homepage, 0072 0073 BlogFeed, 0074 Profession, 0075 Office, 0076 Manager, 0077 Assistant, 0078 Spouse 0079 }; 0080 0081 /** 0082 * Defines a list of Field enums. 0083 */ 0084 using Fields = QList<Field>; 0085 0086 /** 0087 * Returns the i18n label for the @p field. 0088 */ 0089 [[nodiscard]] static QString label(Field field); 0090 0091 /** 0092 * Returns a list of all available fields. 0093 */ 0094 [[nodiscard]] static Fields allFields(); 0095 0096 /** 0097 * Sets the @p value of the @p field for the @p contact. 0098 */ 0099 static void setValue(Field field, const QString &value, KContacts::Addressee &contact); 0100 0101 /** 0102 * Returns the value for the @p field of the @p contact. 0103 */ 0104 [[nodiscard]] static QString value(Field field, const KContacts::Addressee &contact); 0105 }; 0106 }