Ejemplo n.º 1
0
	void VideoFindProxy::Handle (const QString& contents)
	{
		if (Type_ == PTInvalid)
			HandleSearchResults (contents);
		else
			HandleVideoPage (contents);
	}
void applistModel::Search()
{
    LS("applistModel::Search =>>");
    QList<AppEntry> results;
    QString s = m_searchString;

    if(m_appslist != NULL  || m_searchString.isEmpty())
        {
        int rank1results = 0;
        for(int i=0; i < m_appslist->count() ; i++)
            {
            QString appname = m_appslist->at(i).caption;
            if(appname.startsWith(s, Qt::CaseInsensitive))
                {
                AppEntry p = m_appslist->at(i);
                p.iscontact = false;
                if(rank1results <= APPSMODELQUOTA)
                    {
                    rank1results++;
                    p.rank = 1;
                    }
                else
                    {
                    p.rank = 2;
                    }

                results.prepend(p);
                }
            else if(appname.contains(s, Qt::CaseInsensitive))
                {
                AppEntry p = m_appslist->at(i);
                p.iscontact = false;
                p.rank = 3;
                results.append(p);
                }
            else
                {//ignore
                }
            }
        }

    //sort and trim the results before sending.
    qSort(results.begin(), results.end(), appentrylessthan2);

    while(results.count() > MAXRESULTS)
        results.removeLast();

//    for(int j=0;j<results.count();j++)
//        {
//        LS(results[j].caption);
//        LS(results[j].rank);
//        }

    emit HandleSearchResults(s, results, 0, false);
    LS("applistModel::Search << "<<QString::number(results.count()));
}