void FreeBusyManagerPrivate::contactSearchJobFinished( KJob *_job ) { const QString email = _job->property( "contactEmail" ).toString(); if ( _job->error() ) { kError() << "Error while searching for contact: " << _job->errorString() << ", email = " << email; emit freeBusyUrlRetrieved( email, KUrl() ); return; } Akonadi::ContactSearchJob *job = qobject_cast<Akonadi::ContactSearchJob*>( _job ); QString configFile = KStandardDirs::locateLocal( "data", QLatin1String( "korganizer/freebusyurls" ) ); KConfig cfg( configFile ); KConfigGroup group = cfg.group( email ); QString url = group.readEntry( QLatin1String( "url" ) ); QString pref; const KABC::Addressee::List contacts = job->contacts(); foreach ( const KABC::Addressee &contact, contacts ) { pref = contact.preferredEmail(); if ( !pref.isEmpty() && pref != email ) { group = cfg.group( pref ); url = group.readEntry ( "url" ); kDebug() << "Preferred email of" << email << "is" << pref; if ( !url.isEmpty() ) { kDebug() << "Taken url from preferred email:" << url; emit freeBusyUrlRetrieved( email, replaceVariablesUrl( KUrl( url ), email ) ); return; } } }
void VcardMemento::slotSearchJobFinished(KJob *job) { Akonadi::ContactSearchJob *searchJob = static_cast<Akonadi::ContactSearchJob *>(job); if (searchJob->error()) { qCWarning(VCARD_LOG) << "Unable to fetch contact:" << searchJob->errorText(); mIndex++; continueToCheckEmail(); return; } const int contactSize(searchJob->contacts().size()); if (contactSize >= 1) { VCard vcard = mVCardList.at(mIndex); vcard.found = true; vcard.address = searchJob->contacts().at(0); mVCardList[mIndex] = vcard; if (contactSize > 1) { qCDebug(VCARD_LOG) << " more than 1 contact was found"; } } mIndex++; continueToCheckEmail(); }