+QItemSelection DolphinView::childrenMatchingPattern(const QModelIndex& parent, const QRegExp& pattern) const
+{
+ QItemSelection matchingIndexes;
+ const DolphinSortFilterProxyModel* proxyModel = m_viewAccessor.proxyModel();
+ const DolphinModel* dolphinModel = m_viewAccessor.dirModel();
+
+ const int rowCount = proxyModel->rowCount(parent);
+
+ for (int row = 0; row < rowCount; ++row) {
+ QModelIndex index = proxyModel->index(row, 0, parent);
+ QModelIndex sourceIndex = proxyModel->mapToSource(index);
+
+ if (sourceIndex.isValid() && pattern.exactMatch(dolphinModel->data(sourceIndex).toString())) {
+ matchingIndexes += QItemSelectionRange(index);
+ }
+
+ if (proxyModel->hasChildren(index)) {
+ matchingIndexes += childrenMatchingPattern(index, pattern);
+ }
+ }
+
+ return matchingIndexes;
+}
+