Commit c0228b94 authored by mvogt's avatar mvogt

[libcontacts] Remove details that cannot be imported

Some detail types cannot be supported by the qtcontacts-sqlite
backend; remove them from contacts before attempting to import.
parent b6957d6c
......@@ -338,11 +338,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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment