From 3b8c3c1b1e2d05d09aca2de0b0bf922fb9530b0d Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 9 Oct 2007 22:32:54 +0000 Subject: 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 --- src/dolphincolumnwidget.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/dolphincolumnwidget.cpp') diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index 380573629..92fbd4e79 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -190,6 +190,26 @@ void DolphinColumnWidget::updateBackground() update(); } +void DolphinColumnWidget::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(); +} + +QString DolphinColumnWidget::nameFilter() const +{ + return m_dirLister->nameFilter(); +} + void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event) { if (event->mimeData()->hasUrls()) { -- cgit v1.3