summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-11 06:01:57 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-11 06:01:57 (GMT)
commitaca19ff99be98159588a146b2fd72c2ca24d3cd2 (patch)
tree6df1121ac3a4f79cfe713be286cc4ccd77244e1b
parent67c8a11ef12ede92b2f83c4f21255fe9239caa93 (diff)
We need contact fields in this library
-rw-r--r--CMakeLists.txt2
-rw-r--r--kaddressbookimportexport/src/CMakeLists.txt2
-rw-r--r--kaddressbookimportexport/src/kaddressbookimportexportcontactfields.cpp624
-rw-r--r--kaddressbookimportexport/src/kaddressbookimportexportcontactfields.h121
4 files changed, 748 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d614a58..42629b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.49")
+set(PIM_VERSION "5.3.50")
set(KDEPIM_APPS_LIB_VERSION ${PIM_VERSION})
set(QT_REQUIRED_VERSION "5.6.0")
diff --git a/kaddressbookimportexport/src/CMakeLists.txt b/kaddressbookimportexport/src/CMakeLists.txt
index d49ca37..f3c3d0d 100644
--- a/kaddressbookimportexport/src/CMakeLists.txt
+++ b/kaddressbookimportexport/src/CMakeLists.txt
@@ -10,6 +10,7 @@ set(kaddressbook_importexport_LIB_SRCS
kaddressbookcontactselectionwidget.cpp
kaddressbookcontactselectiondialog.cpp
kaddressbookexportselectionwidget.cpp
+ kaddressbookimportexportcontactfields.cpp
)
ecm_qt_declare_logging_category(kaddressbook_importexport_LIB_SRCS HEADER libkaddressbookexportimport_debug.h IDENTIFIER LIBKADDRESSBOOKIMPORTEXPORT_LOG CATEGORY_NAME org.kde.pim.kaddressbookimportexport)
@@ -72,6 +73,7 @@ install(FILES
install(FILES
${KaddressbookImportExport_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/kaddressbook_importexport_export.h
+ kaddressbookimportexportcontactfields.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/kaddressbookimportexport
COMPONENT Devel
)
diff --git a/kaddressbookimportexport/src/kaddressbookimportexportcontactfields.cpp b/kaddressbookimportexport/src/kaddressbookimportexportcontactfields.cpp
new file mode 100644
index 0000000..5bc18d5
--- /dev/null
+++ b/kaddressbookimportexport/src/kaddressbookimportexportcontactfields.cpp
@@ -0,0 +1,624 @@
+/*
+ This file is part of KAddressBook.
+
+ Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "kaddressbookimportexportcontactfields.h"
+
+#include <KLocalizedString>
+#include <QUrl>
+using namespace KAddressBookImportExport;
+
+QString KAddressBookImportExportContactFields::label(Field field)
+{
+ switch (field) {
+ case Undefined:
+ return i18nc("@item Undefined import field type", "Undefined");
+ break;
+ case FormattedName:
+ return KContacts::Addressee::formattedNameLabel();
+ case Prefix:
+ return KContacts::Addressee::prefixLabel();
+ case GivenName:
+ return KContacts::Addressee::givenNameLabel();
+ case AdditionalName:
+ return KContacts::Addressee::additionalNameLabel();
+ case FamilyName:
+ return KContacts::Addressee::familyNameLabel();
+ case Suffix:
+ return KContacts::Addressee::suffixLabel();
+ case NickName:
+ return KContacts::Addressee::nickNameLabel();
+ case Birthday:
+ return KContacts::Addressee::birthdayLabel();
+ case Anniversary:
+ return i18nc("The wedding anniversary of a contact", "Anniversary");
+ case HomeAddressStreet:
+ return KContacts::Addressee::homeAddressStreetLabel();
+ case HomeAddressPostOfficeBox:
+ return KContacts::Addressee::homeAddressPostOfficeBoxLabel();
+ case HomeAddressLocality:
+ return KContacts::Addressee::homeAddressLocalityLabel();
+ case HomeAddressRegion:
+ return KContacts::Addressee::homeAddressRegionLabel();
+ case HomeAddressPostalCode:
+ return KContacts::Addressee::homeAddressPostalCodeLabel();
+ case HomeAddressCountry:
+ return KContacts::Addressee::homeAddressCountryLabel();
+ case HomeAddressLabel:
+ return KContacts::Addressee::homeAddressLabelLabel();
+ case BusinessAddressStreet:
+ return KContacts::Addressee::businessAddressStreetLabel();
+ case BusinessAddressPostOfficeBox:
+ return KContacts::Addressee::businessAddressPostOfficeBoxLabel();
+ case BusinessAddressLocality:
+ return KContacts::Addressee::businessAddressLocalityLabel();
+ case BusinessAddressRegion:
+ return KContacts::Addressee::businessAddressRegionLabel();
+ case BusinessAddressPostalCode:
+ return KContacts::Addressee::businessAddressPostalCodeLabel();
+ case BusinessAddressCountry:
+ return KContacts::Addressee::businessAddressCountryLabel();
+ case BusinessAddressLabel:
+ return KContacts::Addressee::businessAddressLabelLabel();
+ case HomePhone:
+ return KContacts::Addressee::homePhoneLabel();
+ case BusinessPhone:
+ return KContacts::Addressee::businessPhoneLabel();
+ case MobilePhone:
+ return KContacts::Addressee::mobilePhoneLabel();
+ case HomeFax:
+ return KContacts::Addressee::homeFaxLabel();
+ case BusinessFax:
+ return KContacts::Addressee::businessFaxLabel();
+ case CarPhone:
+ return KContacts::Addressee::carPhoneLabel();
+ case Isdn:
+ return KContacts::Addressee::isdnLabel();
+ case Pager:
+ return KContacts::Addressee::pagerLabel();
+ case PreferredEmail:
+ return i18nc("Preferred email address", "EMail (preferred)");
+ case Email2:
+ return i18nc("Second email address", "EMail (2)");
+ case Email3:
+ return i18nc("Third email address", "EMail (3)");
+ case Email4:
+ return i18nc("Fourth email address", "EMail (4)");
+ case Mailer:
+ return KContacts::Addressee::mailerLabel();
+ case Title:
+ return KContacts::Addressee::titleLabel();
+ case Role:
+ return KContacts::Addressee::roleLabel();
+ case Organization:
+ return KContacts::Addressee::organizationLabel();
+ case Note:
+ return KContacts::Addressee::noteLabel();
+ case Homepage:
+ return KContacts::Addressee::urlLabel();
+ case BlogFeed:
+ return i18n("Blog Feed");
+ case Profession:
+ return i18n("Profession");
+ case Office:
+ return i18n("Office");
+ case Manager:
+ return i18n("Manager");
+ case Assistant:
+ return i18n("Assistant");
+ case Spouse:
+ return i18n("Spouse");
+ }
+
+ return QString();
+}
+
+KAddressBookImportExportContactFields::Fields KAddressBookImportExportContactFields::allFields()
+{
+ Fields fields;
+
+ fields << Undefined
+ << FormattedName
+ << Prefix
+ << GivenName
+ << AdditionalName
+ << FamilyName
+ << Suffix
+ << NickName
+ << Birthday
+ << Anniversary
+ << PreferredEmail
+ << Email2
+ << Email3
+ << Email4
+ << HomeAddressStreet
+ << HomeAddressPostOfficeBox
+ << HomeAddressLocality
+ << HomeAddressRegion
+ << HomeAddressPostalCode
+ << HomeAddressCountry
+ << HomeAddressLabel
+ << BusinessAddressStreet
+ << BusinessAddressPostOfficeBox
+ << BusinessAddressLocality
+ << BusinessAddressRegion
+ << BusinessAddressPostalCode
+ << BusinessAddressCountry
+ << BusinessAddressLabel
+ << HomePhone
+ << BusinessPhone
+ << MobilePhone
+ << HomeFax
+ << BusinessFax
+ << CarPhone
+ << Isdn
+ << Pager
+ << Mailer
+ << Title
+ << Role
+ << Organization
+ << Note
+ << Homepage
+ << BlogFeed
+ << Profession
+ << Office
+ << Manager
+ << Assistant
+ << Spouse;
+
+ return fields;
+}
+
+void KAddressBookImportExportContactFields::setValue(Field field, const QString &value, KContacts::Addressee &contact)
+{
+ switch (field) {
+ case KAddressBookImportExportContactFields::Undefined:
+ break;
+ case KAddressBookImportExportContactFields::FormattedName:
+ contact.setFormattedName(value);
+ break;
+ case KAddressBookImportExportContactFields::GivenName:
+ contact.setGivenName(value);
+ break;
+ case KAddressBookImportExportContactFields::FamilyName:
+ contact.setFamilyName(value);
+ break;
+ case KAddressBookImportExportContactFields::AdditionalName:
+ contact.setAdditionalName(value);
+ break;
+ case KAddressBookImportExportContactFields::Prefix:
+ contact.setPrefix(value);
+ break;
+ case KAddressBookImportExportContactFields::Suffix:
+ contact.setSuffix(value);
+ break;
+ case KAddressBookImportExportContactFields::NickName:
+ contact.setNickName(value);
+ break;
+ case KAddressBookImportExportContactFields::Birthday:
+ contact.setBirthday(QDate::fromString(value, Qt::ISODate));
+ break;
+ case KAddressBookImportExportContactFields::Anniversary:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("X-Anniversary"), value);
+ break;
+ case KAddressBookImportExportContactFields::PreferredEmail:
+ contact.insertEmail(value, true);
+ break;
+ case KAddressBookImportExportContactFields::Email2:
+ contact.insertEmail(value, false);
+ break;
+ case KAddressBookImportExportContactFields::Email3:
+ contact.insertEmail(value, false);
+ break;
+ case KAddressBookImportExportContactFields::Email4:
+ contact.insertEmail(value, false);
+ break;
+ case KAddressBookImportExportContactFields::Role:
+ contact.setRole(value);
+ break;
+ case KAddressBookImportExportContactFields::Title:
+ contact.setTitle(value);
+ break;
+ case KAddressBookImportExportContactFields::Mailer:
+ contact.setMailer(value);
+ break;
+ case KAddressBookImportExportContactFields::Homepage: {
+ KContacts::ResourceLocatorUrl url;
+ url.setUrl(QUrl(value));
+ contact.setUrl(url);
+ }
+ break;
+ case KAddressBookImportExportContactFields::Organization:
+ contact.setOrganization(value);
+ break;
+ case KAddressBookImportExportContactFields::Note:
+ contact.setNote(value);
+ break;
+ case KAddressBookImportExportContactFields::HomePhone: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Home);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessPhone: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Work);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::MobilePhone: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Cell);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeFax: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Home |
+ KContacts::PhoneNumber::Fax);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessFax: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Work |
+ KContacts::PhoneNumber::Fax);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::CarPhone: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Car);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::Isdn: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Isdn);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+ case KAddressBookImportExportContactFields::Pager: {
+ KContacts::PhoneNumber number = contact.phoneNumber(KContacts::PhoneNumber::Pager);
+ number.setNumber(value);
+ contact.insertPhoneNumber(number);
+ }
+ break;
+
+ case KAddressBookImportExportContactFields::HomeAddressStreet: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setStreet(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeAddressPostOfficeBox: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setPostOfficeBox(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeAddressLocality: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setLocality(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeAddressRegion: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setRegion(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeAddressPostalCode: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setPostalCode(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeAddressCountry: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setCountry(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::HomeAddressLabel: {
+ KContacts::Address address = contact.address(KContacts::Address::Home);
+ address.setLabel(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressStreet: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setStreet(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressPostOfficeBox: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setPostOfficeBox(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressLocality: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setLocality(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressRegion: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setRegion(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressPostalCode: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setPostalCode(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressCountry: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setCountry(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case KAddressBookImportExportContactFields::BusinessAddressLabel: {
+ KContacts::Address address = contact.address(KContacts::Address::Work);
+ address.setLabel(value);
+ contact.insertAddress(address);
+ }
+ break;
+ case BlogFeed:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("BlogFeed"), value);
+ break;
+ case Profession:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("X-Profession"), value);
+ break;
+ case Office:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("X-Office"), value);
+ break;
+ case Manager:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("X-ManagersName"), value);
+ break;
+ case Assistant:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("X-AssistantsName"), value);
+ break;
+ case Spouse:
+ contact.insertCustom(QStringLiteral("KADDRESSBOOK"),
+ QStringLiteral("X-SpousesName"), value);
+ break;
+ }
+}
+
+QString KAddressBookImportExportContactFields::value(Field field, const KContacts::Addressee &contact)
+{
+ switch (field) {
+ case Undefined:
+ return QString();
+ break;
+ case FormattedName:
+ return contact.formattedName();
+ break;
+ case Prefix:
+ return contact.prefix();
+ break;
+ case GivenName:
+ return contact.givenName();
+ break;
+ case AdditionalName:
+ return contact.additionalName();
+ break;
+ case FamilyName:
+ return contact.familyName();
+ break;
+ case Suffix:
+ return contact.suffix();
+ break;
+ case NickName:
+ return contact.nickName();
+ break;
+ case Birthday: {
+ const QDateTime birthday = contact.birthday();
+ if (birthday.date().isValid()) {
+ return birthday.date().toString(Qt::ISODate);
+ } else {
+ return QString();
+ }
+ }
+ break;
+ case Anniversary:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Anniversary"));
+ break;
+ case HomeAddressStreet: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.street();
+ }
+ break;
+ case HomeAddressPostOfficeBox: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.postOfficeBox();
+ }
+ break;
+ case HomeAddressLocality: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.locality();
+ }
+ break;
+ case HomeAddressRegion: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.region();
+ }
+ break;
+ case HomeAddressPostalCode: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.postalCode();
+ }
+ break;
+ case HomeAddressCountry: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.country();
+ }
+ break;
+ case HomeAddressLabel: {
+ const KContacts::Address address = contact.address(KContacts::Address::Home);
+ return address.label();
+ }
+ break;
+ case BusinessAddressStreet: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.street();
+ }
+ break;
+ case BusinessAddressPostOfficeBox: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.postOfficeBox();
+ }
+ break;
+ case BusinessAddressLocality: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.locality();
+ }
+ break;
+ case BusinessAddressRegion: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.region();
+ }
+ break;
+ case BusinessAddressPostalCode: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.postalCode();
+ }
+ break;
+ case BusinessAddressCountry: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.country();
+ }
+ break;
+ case BusinessAddressLabel: {
+ const KContacts::Address address = contact.address(KContacts::Address::Work);
+ return address.label();
+ }
+ break;
+ case HomePhone:
+ return contact.phoneNumber(KContacts::PhoneNumber::Home).number();
+ break;
+ case BusinessPhone:
+ return contact.phoneNumber(KContacts::PhoneNumber::Work).number();
+ break;
+ case MobilePhone:
+ return contact.phoneNumber(KContacts::PhoneNumber::Cell).number();
+ break;
+ case HomeFax:
+ return contact.phoneNumber(KContacts::PhoneNumber::Home | KContacts::PhoneNumber::Fax).number();
+ break;
+ case BusinessFax:
+ return contact.phoneNumber(KContacts::PhoneNumber::Work | KContacts::PhoneNumber::Fax).number();
+ break;
+ case CarPhone:
+ return contact.phoneNumber(KContacts::PhoneNumber::Car).number();
+ break;
+ case Isdn:
+ return contact.phoneNumber(KContacts::PhoneNumber::Isdn).number();
+ break;
+ case Pager:
+ return contact.phoneNumber(KContacts::PhoneNumber::Pager).number();
+ break;
+ case PreferredEmail: {
+ const QStringList emails = contact.emails();
+ if (emails.count() > 0) {
+ return emails.at(0);
+ } else {
+ return QString();
+ }
+ }
+ break;
+ case Email2: {
+ const QStringList emails = contact.emails();
+ if (emails.count() > 1) {
+ return emails.at(1);
+ } else {
+ return QString();
+ }
+ }
+ break;
+ case Email3: {
+ const QStringList emails = contact.emails();
+ if (emails.count() > 2) {
+ return emails.at(2);
+ } else {
+ return QString();
+ }
+ }
+ break;
+ case Email4: {
+ const QStringList emails = contact.emails();
+ if (emails.count() > 3) {
+ return emails.at(3);
+ } else {
+ return QString();
+ }
+ }
+ break;
+ case Mailer:
+ return contact.mailer();
+ break;
+ case Title:
+ return contact.title();
+ break;
+ case Role:
+ return contact.role();
+ break;
+ case Organization:
+ return contact.organization();
+ break;
+ case Note:
+ return contact.note();
+ break;
+ case Homepage:
+ return contact.url().url().url();
+ break;
+ case BlogFeed:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("BlogFeed"));
+ break;
+ case Profession:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Profession"));
+ break;
+ case Office:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Office"));
+ break;
+ case Manager:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-ManagersName"));
+ break;
+ case Assistant:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-AssistantsName"));
+ break;
+ case Spouse:
+ return contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-SpousesName"));
+ break;
+ }
+
+ return QString();
+}
diff --git a/kaddressbookimportexport/src/kaddressbookimportexportcontactfields.h b/kaddressbookimportexport/src/kaddressbookimportexportcontactfields.h
new file mode 100644
index 0000000..4ae82e3
--- /dev/null
+++ b/kaddressbookimportexport/src/kaddressbookimportexportcontactfields.h
@@ -0,0 +1,121 @@
+/*
+ This file is part of KAddressBook.
+
+ Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KAddressBookImportExportCONTACTFIELDS_H
+#define KAddressBookImportExportCONTACTFIELDS_H
+
+#include <KContacts/Addressee>
+#include "kaddressbook_importexport_export.h"
+namespace KAddressBookImportExport
+{
+class KADDRESSBOOK_IMPORTEXPORT_EXPORT KAddressBookImportExportContactFields
+{
+public:
+
+ /**
+ * Describes the standard fields that are available for every contact
+ */
+ enum Field {
+ Undefined = 0,
+
+ FormattedName,
+ Prefix,
+ GivenName,
+ AdditionalName,
+ FamilyName,
+ Suffix,
+ NickName,
+
+ Birthday,
+ Anniversary,
+
+ HomeAddressStreet,
+ HomeAddressPostOfficeBox,
+ HomeAddressLocality,
+ HomeAddressRegion,
+ HomeAddressPostalCode,
+ HomeAddressCountry,
+ HomeAddressLabel,
+
+ BusinessAddressStreet,
+ BusinessAddressPostOfficeBox,
+ BusinessAddressLocality,
+ BusinessAddressRegion,
+ BusinessAddressPostalCode,
+ BusinessAddressCountry,
+ BusinessAddressLabel,
+
+ HomePhone,
+ BusinessPhone,
+ MobilePhone,
+ HomeFax,
+ BusinessFax,
+ CarPhone,
+ Isdn,
+ Pager,
+
+ PreferredEmail,
+ Email2,
+ Email3,
+ Email4,
+
+ Mailer,
+ Title,
+ Role,
+ Organization,
+ Note,
+ Homepage,
+
+ BlogFeed,
+ Profession,
+ Office,
+ Manager,
+ Assistant,
+ Spouse
+ };
+
+ /**
+ * Defines a list of Field enums.
+ */
+ typedef QVector<Field> Fields;
+
+ /**
+ * Returns the i18n label for the @p field.
+ */
+ static QString label(Field field);
+
+ /**
+ * Returns a list of all available fields.
+ */
+ static Fields allFields();
+
+ /**
+ * Sets the @p value of the @p field for the @p contact.
+ */
+ static void setValue(Field field, const QString &value, KContacts::Addressee &contact);
+
+ /**
+ * Returns the value for the @p field of the @p contact.
+ */
+ static QString value(Field field, const KContacts::Addressee &contact);
+};
+}
+
+#endif