userguide/src/HelpProxyModel.cpp
changeset 15 c0dfc135a46c
parent 13 1eb8015a8491
equal deleted inserted replaced
13:1eb8015a8491 15:c0dfc135a46c
    16 */
    16 */
    17 
    17 
    18 #include <QStringList>
    18 #include <QStringList>
    19 #include <QDebug>
    19 #include <QDebug>
    20 
    20 
    21 #include <hbstringutil.h>
    21 #include "HelpUtils.h"
    22 
       
    23 #include "HelpCommon.h"
    22 #include "HelpCommon.h"
    24 #include "HelpProxyModel.h"
    23 #include "HelpProxyModel.h"
    25 
    24 
    26 HelpProxyModel::HelpProxyModel(QObject * parent):QSortFilterProxyModel(parent)
    25 HelpProxyModel::HelpProxyModel(QObject * parent):QSortFilterProxyModel(parent)
    27 {
    26 {
    42 		{			
    41 		{			
    43 			QStringList keywordLst = sourceModel()->data(index, KeywordRole).toStringList();
    42 			QStringList keywordLst = sourceModel()->data(index, KeywordRole).toStringList();
    44 
    43 
    45 			foreach(QString str, keywordLst)
    44 			foreach(QString str, keywordLst)
    46 			{
    45 			{
    47 				if(HbStringUtil::findC(str, filterRegExp().pattern()) != -1)
    46 				if(HelpUtils::findStr(str, filterRegExp().pattern()) != -1)
    48 				{
    47 				{
    49 					return true;
    48 					return true;
    50 				}
    49 				}
       
    50 			}
       
    51 			return false;
       
    52 		}
       
    53 	case Qt::DisplayRole:
       
    54 		{
       
    55 			QString title = sourceModel()->data(index, Qt::DisplayRole).toString();
       
    56 			if(HelpUtils::findStr(title, filterRegExp().pattern()) != -1)
       
    57 			{
       
    58 				return true;
    51 			}
    59 			}
    52 			return false;
    60 			return false;
    53 		}
    61 		}
    54 	default:
    62 	default:
    55 		return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
    63 		return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);