void K3bCddbLocalQuery::doQuery() { emit infoMessage( i18n("Searching entry in %1").arg( m_cddbDir ) ); kapp->processEvents(); //BAD! QString path = preparePath( m_cddbDir ); kdDebug() << "(K3bCddbLocalQuery) searching in dir " << path << " for " << QString::number( toc().discId(), 16 ).rightJustify( 8, '0' ) << endl; for( QStringList::const_iterator it = categories().begin(); it != categories().end(); ++it ) { QString file = path + *it + "/" + QString::number( toc().discId(), 16 ).rightJustify( 8, '0' ); if( QFile::exists( file ) ) { // found file QFile f( file ); if( !f.open( IO_ReadOnly ) ) { kdDebug() << "(K3bCddbLocalQuery) Could not open file" << endl; } else { QTextStream t( &f ); K3bCddbResultEntry entry; parseEntry( t, entry ); K3bCddbResultHeader header; header.discid = QString::number( toc().discId(), 16 ).rightJustify( 8, '0' ); header.category = *it; header.title = entry.cdTitle; header.artist = entry.cdArtist; m_inexactMatches.append(header); } } else { kdDebug() << "(K3bCddbLocalQuery) Could not find local entry in category " << *it << endl; } } if( m_inexactMatches.count() > 0 ) { setError( SUCCESS ); if( m_inexactMatches.count() == 1 ) { queryMatch( m_inexactMatches.first() ); } else { emit inexactMatches( this ); } } else { setError( NO_ENTRY_FOUND ); emit queryFinished( this ); } }
nsresult nsAbDirectoryQuery::matchCard(nsIAbCard* card, nsIAbBooleanExpression* expression, nsIAbDirSearchListener* listener, PRInt32* resultLimit) { bool matchFound = false; nsresult rv = matchCardExpression(card, expression, &matchFound); NS_ENSURE_SUCCESS(rv, rv); if (matchFound) { (*resultLimit)--; rv = queryMatch(card, listener); NS_ENSURE_SUCCESS(rv, rv); } return rv; }