┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphindetailsview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-10-05 21:00:44 +0000
committerPeter Penz <[email protected]>2007-10-05 21:00:44 +0000
commit29402a79bc09945ccd96201cbb42027b4c581a00 (patch)
treead3664f888c37b7f331bf1bb856aa130d2d5d0d6 /src/dolphindetailsview.cpp
parent747731077981775cbaefe928068fea4010b6fdb7 (diff)
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
Diffstat (limited to 'src/dolphindetailsview.cpp')
-rw-r--r--src/dolphindetailsview.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 15f108dbb..078f51bf1 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -28,9 +28,11 @@
#include "dolphin_detailsmodesettings.h"
+#include <kdirmodel.h>
#include <klocale.h>
#include <kmenu.h>
+#include <QAbstractProxyModel>
#include <QAction>
#include <QApplication>
#include <QHeaderView>
@@ -383,7 +385,7 @@ void DolphinDetailsView::slotEntered(const QModelIndex& index)
const QPoint pos = viewport()->mapFromGlobal(QCursor::pos());
const int nameColumnWidth = header()->sectionSize(DolphinModel::Name);
if (pos.x() < nameColumnWidth) {
- m_controller->emitItemEntered(index);
+ m_controller->emitItemEntered(itemForIndex(index));
}
else {
m_controller->emitViewportEntered();
@@ -399,6 +401,13 @@ void DolphinDetailsView::updateElasticBand()
setDirtyRegion(dirtyRegion);
}
+QRect DolphinDetailsView::elasticBandRect() const
+{
+ const QPoint pos(contentsPos());
+ const QPoint topLeft(m_elasticBandOrigin.x() - pos.x(), m_elasticBandOrigin.y() - pos.y());
+ return QRect(topLeft, m_elasticBandDestination).normalized();
+}
+
void DolphinDetailsView::zoomIn()
{
if (isZoomInPossible()) {
@@ -431,7 +440,7 @@ void DolphinDetailsView::slotItemActivated(const QModelIndex& index)
m_controller->triggerItem(index);
} else {
clearSelection();
- m_controller->emitItemEntered(index);
+ m_controller->emitItemEntered(itemForIndex(index));
}
}
@@ -518,16 +527,12 @@ QPoint DolphinDetailsView::contentsPos() const
return QPoint(0, y);
}
-QRect DolphinDetailsView::elasticBandRect() const
-{
- const QPoint pos(contentsPos());
- const QPoint topLeft(m_elasticBandOrigin.x() - pos.x(), m_elasticBandOrigin.y() - pos.y());
- return QRect(topLeft, m_elasticBandDestination).normalized();
-}
-
-static bool isValidNameIndex(const QModelIndex& index)
+KFileItem DolphinDetailsView::itemForIndex(const QModelIndex& index) const
{
- return index.isValid() && (index.column() == KDirModel::Name);
+ QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(model());
+ KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
+ const QModelIndex dirIndex = proxyModel->mapToSource(index);
+ return dirModel->itemForIndex(dirIndex);
}
#include "dolphindetailsview.moc"