113 const TQString& _constraint,
114 const TQString& _preferences )
const
117 ParseTreeBase::Ptr constr;
118 ParseTreeBase::Ptr prefs;
120 if ( !_constraint.isEmpty() )
121 constr = TDEIO::parseConstraints( _constraint );
123 if ( !_preferences.isEmpty() )
124 prefs = TDEIO::parsePreferences( _preferences );
126 KServiceTypeProfile::OfferList lst;
131 if ( lst.count() == 0 )
138 KServiceTypeProfile::OfferList::Iterator it = lst.begin();
139 while( it != lst.end() )
141 if ( matchConstraint( constr, (*it).service(), lst ) != 1 )
142 it = lst.remove( it );
150 TQValueList<TDETraderSorter> sorter;
151 KServiceTypeProfile::OfferList::Iterator it = lst.begin();
152 for( ; it != lst.end(); ++it )
154 PreferencesReturn p = matchPreferences( prefs, (*it).service(), lst );
155 if ( p.type == PreferencesReturn::PRT_DOUBLE )
156 sorter.append( TDETraderSorter( (*it).service(), p.f, (*it).preference(), (*it).allowAsDefault() ) );
158 qBubbleSort( sorter );
160 TQValueList<TDETraderSorter>::Iterator it2 = sorter.begin();
161 for( ; it2 != sorter.end(); ++it2 )
162 ret.prepend( (*it2).service() );
166 KServiceTypeProfile::OfferList::Iterator it = lst.begin();
167 for( ; it != lst.end(); ++it )
168 ret.append( (*it).service() );
172 TQString
query = _servicetype;
173 if ( !_genericServiceType.isEmpty() ) {
175 query += _genericServiceType;
177 kdDebug(7014) <<
"query for " <<
query
178 <<
" : returning " << ret.count() <<
" offers" << endl;
virtual OfferList query(const TQString &servicetype, const TQString &constraint=TQString::null, const TQString &preferences=TQString::null) const
The main function in the TDETrader class.