void AliasesExpandJob::start() { // At first we try to expand the recipient to a distribution list // or nick name and save the results in a map for later lookup foreach (const QString &recipient, mRecipients) { // speedup: assume aliases and list names don't contain '@' if (recipient.isEmpty() || recipient.contains(QLatin1Char('@'))) { continue; } // check for distribution list DistributionListExpandJob *expandJob = new DistributionListExpandJob(recipient, this); expandJob->setProperty("recipient", recipient); connect(expandJob, &Akonadi::ContactGroupExpandJob::result, this, &AliasesExpandJob::slotDistributionListExpansionDone); mDistributionListExpansionJobs++; expandJob->start(); // check for nick name Akonadi::ContactSearchJob *searchJob = new Akonadi::ContactSearchJob(this); searchJob->setProperty("recipient", recipient); searchJob->setQuery(Akonadi::ContactSearchJob::NickName, recipient.toLower()); connect(searchJob, &Akonadi::ContactSearchJob::result, this, &AliasesExpandJob::slotNicknameExpansionDone); mNicknameExpansionJobs++; searchJob->start(); } if (mDistributionListExpansionJobs == 0 && mNicknameExpansionJobs == 0) { emitResult(); } }
void FreeBusyManagerPrivate::fetchFreeBusyUrl( const QString &email ) { // First check if there is a specific FB url for this email QString configFile = KStandardDirs::locateLocal( "data", QLatin1String( "korganizer/freebusyurls" ) ); KConfig cfg( configFile ); KConfigGroup group = cfg.group( email ); QString url = group.readEntry( QLatin1String( "url" ) ); if ( !url.isEmpty() ) { kDebug() << "Found cached url:" << url; KUrl cachedUrl( url ); if ( KCalPrefs::instance()->thatIsMe( email ) ) { cachedUrl.setUser( KCalPrefs::instance()->mFreeBusyRetrieveUser ); cachedUrl.setPass( KCalPrefs::instance()->mFreeBusyRetrievePassword ); } emit freeBusyUrlRetrieved( email, replaceVariablesUrl( cachedUrl, email ) ); return; } // Try with the url configured by preferred email in kcontactmanager Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob(); job->setQuery( Akonadi::ContactSearchJob::Email, email ); job->setProperty( "contactEmail", QVariant::fromValue( email ) ); connect( job, SIGNAL(result(KJob*)), this, SLOT(contactSearchJobFinished(KJob*)) ); job->start(); }