diff options
author | Jon Ander Peñalba <jonan88@gmail.com> | 2010-08-16 11:43:57 +0200 |
---|---|---|
committer | Jon Ander Peñalba <jonan88@gmail.com> | 2010-08-16 11:43:57 +0200 |
commit | d14423159aa1b9873af4d6c0ec7d470ce8dc54c5 (patch) | |
tree | 912704ce10a8e00244ec8b72466a7f0faefc94d5 /src/bookmarks/bookmarksproxy.cpp | |
parent | Bug when closing the 'New Folder' dialog fixed. (diff) | |
download | rekonq-d14423159aa1b9873af4d6c0ec7d470ce8dc54c5.tar.xz |
Made the bookmark search case insensitive and added some comments to the BookmarksProxy class.
Diffstat (limited to 'src/bookmarks/bookmarksproxy.cpp')
-rw-r--r-- | src/bookmarks/bookmarksproxy.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bookmarks/bookmarksproxy.cpp b/src/bookmarks/bookmarksproxy.cpp index 4e4b4f06..1e4da877 100644 --- a/src/bookmarks/bookmarksproxy.cpp +++ b/src/bookmarks/bookmarksproxy.cpp @@ -27,19 +27,18 @@ // Self Includes #include "bookmarksproxy.h" -#include "bookmarksproxy.moc" BookmarksProxy::BookmarksProxy(QObject *parent) : QSortFilterProxyModel(parent) { + setFilterCaseSensitivity(Qt::CaseInsensitive); } -bool BookmarksProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +bool BookmarksProxy::filterAcceptsRow(const int source_row, const QModelIndex &source_parent) const { - QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); - return recursiveMatch(idx); + return recursiveMatch( sourceModel()->index(source_row, 0, source_parent) ); } @@ -48,10 +47,12 @@ bool BookmarksProxy::recursiveMatch(const QModelIndex &index) const if (index.data().toString().contains(filterRegExp())) return true; - for (int childRow = 0; childRow < sourceModel()->rowCount(index); ++childRow) + int numChildren = sourceModel()->rowCount(index); + for (int childRow = 0; childRow < numChildren; ++childRow) { if (recursiveMatch(sourceModel()->index(childRow, 0, index))) return true; } + return false; } |