equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QStringList> |
|
19 #include <QDebug> |
|
20 |
|
21 #include <hbstringutil.h> |
|
22 |
|
23 #include "HelpCommon.h" |
|
24 #include "HelpProxyModel.h" |
|
25 |
|
26 HelpProxyModel::HelpProxyModel(QObject * parent):QSortFilterProxyModel(parent) |
|
27 { |
|
28 } |
|
29 |
|
30 HelpProxyModel::~HelpProxyModel() |
|
31 { |
|
32 } |
|
33 |
|
34 bool HelpProxyModel::filterAcceptsRow(int sourceRow, |
|
35 const QModelIndex &sourceParent) const |
|
36 { |
|
37 QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); |
|
38 |
|
39 switch(filterRole()) |
|
40 { |
|
41 case KeywordRole: |
|
42 { |
|
43 QStringList keywordLst = sourceModel()->data(index, KeywordRole).toStringList(); |
|
44 |
|
45 foreach(QString str, keywordLst) |
|
46 { |
|
47 if(HbStringUtil::findC(str, filterRegExp().pattern()) != -1) |
|
48 { |
|
49 return true; |
|
50 } |
|
51 } |
|
52 return false; |
|
53 } |
|
54 default: |
|
55 return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); |
|
56 } |
|
57 } |