From 29402a79bc09945ccd96201cbb42027b4c581a00 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 5 Oct 2007 21:00:44 +0000 Subject: Refactored DolphinColumnWidget so that it does not need a hierarchical KDirLister. This simplifies the code a lot and also bypasses the current problems with the KDirLister cache when working on hierarchical directories in parallel. There are some minor regressions which will be fixed, but all in all some improvements are visible already: - the loading of columns is a lot faster - preview in columns is working - no side effects in combination with the treeview-panel because of caching svn path=/trunk/KDE/kdebase/apps/; revision=721678 --- src/dolphiniconsview.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/dolphiniconsview.cpp') diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 6b584612c..042c9a76c 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -26,6 +26,7 @@ #include "dolphin_iconsmodesettings.h" #include +#include #include #include @@ -58,8 +59,6 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle connect(this, SIGNAL(doubleClicked(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); } - connect(this, SIGNAL(entered(const QModelIndex&)), - controller, SLOT(emitItemEntered(const QModelIndex&))); connect(this, SIGNAL(viewportEntered()), controller, SLOT(emitViewportEntered())); connect(controller, SIGNAL(showPreviewChanged(bool)), @@ -71,6 +70,9 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle connect(controller, SIGNAL(zoomOut()), this, SLOT(zoomOut())); + connect(this, SIGNAL(entered(const QModelIndex&)), + this, SLOT(slotEntered(const QModelIndex&))); + // apply the icons mode settings to the widget const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); Q_ASSERT(settings != 0); @@ -228,6 +230,16 @@ void DolphinIconsView::keyPressEvent(QKeyEvent* event) } } +void DolphinIconsView::slotEntered(const QModelIndex& index) +{ + QAbstractProxyModel* proxyModel = static_cast(model()); + KDirModel* dirModel = static_cast(proxyModel->sourceModel()); + const QModelIndex dirIndex = proxyModel->mapToSource(index); + + const KFileItem item = dirModel->itemForIndex(dirIndex); + m_controller->emitItemEntered(item); +} + void DolphinIconsView::slotShowPreviewChanged(bool showPreview) { updateGridSize(showPreview, m_controller->additionalInfoCount()); -- cgit v1.3