void DolphinView::slotChangeNameFilter(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(); // TODO: this is a workaround for QIconView: the item position // stay as they are by filtering, only an inserting of an item // results to an automatic adjusting of the item position. In Qt4/KDE4 // this workaround should get obsolete due to Interview. KFileView* view = fileView(); if (view == m_iconsView) { KFileItem* first = view->firstFileItem(); if (first != 0) { view->removeItem(first); view->insertItem(first); } } }