From f11c699fa203dd2cde0e85c63a6d186e3fa6a3de Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 26 Oct 2007 17:36:16 +0000 Subject: due to the recent tagging freeze this commit contains several fixes in one: * the filterbar now also filters directories (works also in the column-view :-)) * The "Additional Information" menu entry now also works for showing/hiding the columns of the details view. This also implies that the columns for the details view can now be adjusted per directory -> we have now a consistent behavior between the icons view and details view. Still open: the view properties dialog must be fixed * Don't show a "Nepomuk not available" error message when starting Dolphin and Nepomuk is not available. * Fix issue that the information panel blocked the application because of parsing the full meta data of a huge file. svn path=/trunk/KDE/kdebase/apps/; revision=729704 --- src/dolphincolumnwidget.cpp | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/dolphincolumnwidget.cpp') diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index 7bf644a95..62e79537e 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -122,6 +123,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent, m_proxyModel->setSourceModel(m_dolphinModel); setModel(m_proxyModel); + new KMimeTypeResolver(this, m_dolphinModel); m_dirLister->openUrl(url, KDirLister::NoFlags); } @@ -191,22 +193,7 @@ void DolphinColumnWidget::updateBackground() 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(); + m_proxyModel->setFilterRegExp(nameFilter); } void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event) @@ -242,11 +229,15 @@ void DolphinColumnWidget::dropEvent(QDropEvent* event) { const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); if (!urls.isEmpty()) { - event->acceptProposedAction(); - m_view->m_controller->indicateDroppedUrls(urls, - url(), - indexAt(event->pos()), - event->source()); + const QModelIndex index = indexAt(event->pos()); + if (index.isValid()) { + const KFileItem item = itemForIndex(index); + m_view->m_controller->indicateDroppedUrls(urls, + url(), + item, + event->source()); + event->acceptProposedAction(); + } } QListView::dropEvent(event); m_dragging = false; @@ -335,7 +326,7 @@ void DolphinColumnWidget::selectionChanged(const QItemSelection& selected, const } void DolphinColumnWidget::triggerItem(const QModelIndex& index) { - const KFileItem item = m_dolphinModel->itemForIndex(m_proxyModel->mapToSource(index)); + const KFileItem item = itemForIndex(index); m_view->m_controller->triggerItem(item); } @@ -449,4 +440,11 @@ bool DolphinColumnWidget::isCutItem(const KFileItem& item) const return false; } +KFileItem DolphinColumnWidget::itemForIndex(const QModelIndex& index) const +{ + const QModelIndex dirIndex = m_proxyModel->mapToSource(index); + return m_dolphinModel->itemForIndex(dirIndex); +} + + #include "dolphincolumnwidget.moc" -- cgit v1.3