┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphiniconsview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-10-05 22:32:13 +0000
committerPeter Penz <[email protected]>2007-10-05 22:32:13 +0000
commit77a576335ca8ef6a8921b766c43b07b6eb65e80f (patch)
tree87196284c274a8300c15cec9ad6a2308025fdbc3 /src/dolphiniconsview.cpp
parent7a62507d3dea468b3f1709f1c37470eafa766303 (diff)
fixed most regressions due to the previous column-view refactoring
svn path=/trunk/KDE/kdebase/apps/; revision=721706
Diffstat (limited to 'src/dolphiniconsview.cpp')
-rw-r--r--src/dolphiniconsview.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index 042c9a76c..f1ad25e3d 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -54,10 +54,10 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
// RETURN-key in keyPressEvent().
if (KGlobalSettings::singleClick()) {
connect(this, SIGNAL(clicked(const QModelIndex&)),
- controller, SLOT(triggerItem(const QModelIndex&)));
+ this, SLOT(triggerItem(const QModelIndex&)));
} else {
connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- controller, SLOT(triggerItem(const QModelIndex&)));
+ this, SLOT(triggerItem(const QModelIndex&)));
}
connect(this, SIGNAL(viewportEntered()),
controller, SLOT(emitViewportEntered()));
@@ -222,22 +222,22 @@ void DolphinIconsView::keyPressEvent(QKeyEvent* event)
const QItemSelectionModel* selModel = selectionModel();
const QModelIndex currentIndex = selModel->currentIndex();
- const bool triggerItem = currentIndex.isValid()
- && (event->key() == Qt::Key_Return)
- && (selModel->selectedIndexes().count() <= 1);
- if (triggerItem) {
- m_controller->triggerItem(currentIndex);
+ const bool trigger = currentIndex.isValid()
+ && (event->key() == Qt::Key_Return)
+ && (selModel->selectedIndexes().count() <= 1);
+ if (trigger) {
+ triggerItem(currentIndex);
}
}
-void DolphinIconsView::slotEntered(const QModelIndex& index)
+void DolphinIconsView::triggerItem(const QModelIndex& index)
{
- QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(model());
- KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
- const QModelIndex dirIndex = proxyModel->mapToSource(index);
+ m_controller->triggerItem(itemForIndex(index));
+}
- const KFileItem item = dirModel->itemForIndex(dirIndex);
- m_controller->emitItemEntered(item);
+void DolphinIconsView::slotEntered(const QModelIndex& index)
+{
+ m_controller->emitItemEntered(itemForIndex(index));
}
void DolphinIconsView::slotShowPreviewChanged(bool showPreview)
@@ -393,4 +393,13 @@ void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount)
m_controller->setZoomOutPossible(isZoomOutPossible());
}
+KFileItem DolphinIconsView::itemForIndex(const QModelIndex& index) const
+{
+ QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(model());
+ KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
+ const QModelIndex dirIndex = proxyModel->mapToSource(index);
+ return dirModel->itemForIndex(dirIndex);
+}
+
+
#include "dolphiniconsview.moc"