Exemplo n.º 1
0
ContactList CsvXXPort::importContacts() const
{
    ContactList contactList;
    QPointer<CSVImportDialog> dlg = new CSVImportDialog(parentWidget());
    if (dlg->exec() && dlg) {
        contactList.setAddressList(dlg->contacts());
    }

    delete dlg;
    return contactList;
}
void CSVImportExportPluginInterface::importCSV()
{
    KAddressBookImportExport::KAddressBookImportExportContactList contactList;
    QPointer<CSVImportDialog> dlg = new CSVImportDialog(parentWidget());
    if (dlg->exec() && dlg) {
        contactList.setAddressList(dlg->contacts());
    }

    delete dlg;
    ImportExportEngine *engine = new ImportExportEngine(this);
    engine->setContactList(contactList);
    engine->setDefaultAddressBook(defaultCollection());
    engine->importContacts();
}
Exemplo n.º 3
0
QList<Contact> Contacts::getContactsFromPhone(){
   QPointer<QContactManager> contactManager = new QContactManager();
   // QStringList QContactManager::supportedContactTypes ()
   QList<QContact> contactsPhone = contactManager->contacts();
   QList<Contact> contacts;
   foreach (const QContact& contact, contactsPhone) {
       QContactPhoneNumber phoneNumber = contact.detail<QContactPhoneNumber>();
       //  QList<QContactPhoneNumber> phoneNumbers = contact.details<QContactPhoneNumber>();
       if(!phoneNumber.isEmpty()){
           QContactName name = contact.detail<QContactName>();
           QString number = phoneNumber.number();
           number = number.replace("+","");
           QString nameFinal = name.firstName()+" "+name.lastName();
           contacts.append(Contact(nameFinal.trimmed(),number));
       }
   }