diff options
| author | Peter Penz <[email protected]> | 2007-10-09 22:32:54 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-10-09 22:32:54 +0000 |
| commit | 3b8c3c1b1e2d05d09aca2de0b0bf922fb9530b0d (patch) | |
| tree | e692c3687b65e370a2469669752cf33022d8f675 /src/dolphinview.cpp | |
| parent | 1d4cfd16fd5ceb8f37400d4890807e3c56619971 (diff) | |
Allow filtering of items also for the column view. A filtering of directories is not done yet, but with the latest updates of the column view this could be added now (but it's more a question whether we really want this...).
svn path=/trunk/KDE/kdebase/apps/; revision=723536
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 8361ceb06..59341b65b 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -493,6 +493,38 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl) emit startedPathLoading(url); } +void DolphinView::setNameFilter(const QString& nameFilter) +{ + // The name filter of KDirLister does a 'hard' filtering, which + // means that only the items are shown where the names match + // exactly the filter. This is non-transparent for the user, which + // just wants to have a 'soft' filtering: does the name contain + // the filter string? + QString adjustedFilter(nameFilter); + adjustedFilter.insert(0, '*'); + adjustedFilter.append('*'); + + m_dirLister->setNameFilter(adjustedFilter); + m_dirLister->emitChanges(); + + if (isColumnViewActive()) { + // adjusting the directory lister is not enough in the case of the + // column view, as each column has its own directory lister internally... + m_columnView->setNameFilter(nameFilter); + } +} + +void DolphinView::calculateItemCount(int& fileCount, int& folderCount) +{ + foreach (KFileItem item, m_dirLister->items()) { + if (item.isDir()) { + ++folderCount; + } else { + ++fileCount; + } + } +} + void DolphinView::setUrl(const KUrl& url) { updateView(url, KUrl()); |
