- // 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_proxyModel->setFilterRegExp(nameFilter);
+}
+
+void DolphinColumnWidget::editItem(const KFileItem& item)
+{
+ const QModelIndex dirIndex = m_dolphinModel->indexForItem(item);
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ if (proxyIndex.isValid()) {
+ edit(proxyIndex);
+ }
+}
+
+KFileItem DolphinColumnWidget::itemAt(const QPoint& pos) const
+{
+ KFileItem item;
+ const QModelIndex index = indexAt(pos);
+ if (index.isValid() && (index.column() == DolphinModel::Name)) {
+ const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index);
+ item = m_dolphinModel->itemForIndex(dolphinModelIndex);
+ }
+ return item;
+}
+
+KFileItemList DolphinColumnWidget::selectedItems() const
+{
+ const QItemSelection selection = m_proxyModel->mapSelectionToSource(selectionModel()->selection());
+ KFileItemList itemList;
+
+ const QModelIndexList indexList = selection.indexes();
+ foreach (const QModelIndex &index, indexList) {
+ KFileItem item = m_dolphinModel->itemForIndex(index);
+ if (!item.isNull()) {
+ itemList.append(item);
+ }
+ }
+
+ return itemList;
+}
+
+QMimeData* DolphinColumnWidget::selectionMimeData() const
+{
+ const QItemSelection selection = m_proxyModel->mapSelectionToSource(selectionModel()->selection());
+ return m_dolphinModel->mimeData(selection.indexes());
+}