Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #74 from matthewvogt/unimportable-details
Browse files Browse the repository at this point in the history
[libcontacts] Remove details that cannot be imported
  • Loading branch information
matthewvogt committed Feb 5, 2014
2 parents f419481 + c0228b9 commit 285aff6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/seasideimport.cpp
Expand Up @@ -311,11 +311,26 @@ QList<QContact> SeasideImport::buildImportContacts(const QList<QVersitDocument>
QHash<QString, int> importNames;
QHash<QString, int> importLabels;

QSet<QContactDetail::DetailType> unimportableDetailTypes;
unimportableDetailTypes.insert(QContactDetail::TypeFamily);
unimportableDetailTypes.insert(QContactDetail::TypeGeoLocation);
unimportableDetailTypes.insert(QContactDetail::TypeGlobalPresence);
unimportableDetailTypes.insert(QContactDetail::TypeSyncTarget);
unimportableDetailTypes.insert(QContactDetail::TypeVersion);

// Merge any duplicates in the import list
QList<QContact>::iterator it = importedContacts.begin();
while (it != importedContacts.end()) {
QContact &contact(*it);

// Remove any details that our backend can't store
foreach (QContactDetail detail, contact.details()) {
if (unimportableDetailTypes.contains(detail.type())) {
qDebug() << " Removing unimportable detail:" << detail;
contact.removeDetail(&detail);
}
}

const QString guid = contact.detail<QContactGuid>().guid();
const QString name = contactNameString(contact);
const bool emptyName = name.isEmpty();
Expand Down

0 comments on commit 285aff6

Please sign in to comment.