┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincolumnwidget.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-02-21 11:56:31 +0000
committerPeter Penz <[email protected]>2008-02-21 11:56:31 +0000
commite287058acb772b55b679a694062361d3fb0e8f89 (patch)
tree624ba47b804fbddecd0e3d52a992a0f58223ee58 /src/dolphincolumnwidget.cpp
parentc73591380173b52504aaceb74314f617b2e04f6c (diff)
Prevent code duplication by moving the duplications into the DolphinController.
Maybe it might be a good idea to let the DolphinController be aware also about his QAbstractItemView -> it might be possible to directly connect signals of the dolphin view implementations with the controller. I'll check this... (I did not backport this cleanup as I think it has too many changes to be handled as bugfix) CCMAIL: [email protected] CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=777719
Diffstat (limited to 'src/dolphincolumnwidget.cpp')
-rw-r--r--src/dolphincolumnwidget.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp
index f8db0e865..6f4f10d36 100644
--- a/src/dolphincolumnwidget.cpp
+++ b/src/dolphincolumnwidget.cpp
@@ -277,7 +277,7 @@ void DolphinColumnWidget::dragMoveEvent(QDragMoveEvent* event)
m_dropRect.setSize(QSize()); // set as invalid
if (index.isValid()) {
- const KFileItem item = itemForIndex(index);
+ const KFileItem item = m_view->m_controller->itemForIndex(index, this);
if (!item.isNull() && item.isDir()) {
m_dropRect = visualRect(index);
}
@@ -295,7 +295,7 @@ void DolphinColumnWidget::dropEvent(QDropEvent* event)
const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
if (!urls.isEmpty()) {
const QModelIndex index = indexAt(event->pos());
- const KFileItem item = itemForIndex(index);
+ const KFileItem item = m_view->m_controller->itemForIndex(index, this);
m_view->m_controller->indicateDroppedUrls(urls,
url(),
item);
@@ -344,21 +344,7 @@ void DolphinColumnWidget::mousePressEvent(QMouseEvent* event)
void DolphinColumnWidget::keyPressEvent(QKeyEvent* event)
{
QListView::keyPressEvent(event);
-
- const QItemSelectionModel* selModel = selectionModel();
- const QModelIndex currentIndex = selModel->currentIndex();
- const bool trigger = currentIndex.isValid()
- && (event->key() == Qt::Key_Return)
- && (selModel->selectedIndexes().count() > 0);
- if(trigger) {
- const QModelIndexList indexList = selModel->selectedIndexes();
- foreach (const QModelIndex &index, indexList) {
- KFileItem item = itemForIndex(index);
- if (!item.isNull()) {
- triggerItem(index);
- }
- }
- }
+ m_view->m_controller->handleKeyPressEvent(event, this);
}
void DolphinColumnWidget::contextMenuEvent(QContextMenuEvent* event)
@@ -400,15 +386,12 @@ void DolphinColumnWidget::selectionChanged(const QItemSelection& selected, const
void DolphinColumnWidget::triggerItem(const QModelIndex& index)
{
- const KFileItem item = itemForIndex(index);
- m_view->m_controller->triggerItem(item);
+ m_view->m_controller->triggerItem(index, this);
}
void DolphinColumnWidget::slotEntered(const QModelIndex& index)
{
- const QModelIndex dirIndex = m_proxyModel->mapToSource(index);
- const KFileItem item = m_dolphinModel->itemForIndex(dirIndex);
- m_view->m_controller->emitItemEntered(item);
+ m_view->m_controller->emitItemEntered(index, this);
}
void DolphinColumnWidget::requestActivation()
@@ -473,11 +456,4 @@ void DolphinColumnWidget::deactivate()
updateBackground();
}
-KFileItem DolphinColumnWidget::itemForIndex(const QModelIndex& index) const
-{
- const QModelIndex dirIndex = m_proxyModel->mapToSource(index);
- return m_dolphinModel->itemForIndex(dirIndex);
-}
-
-
#include "dolphincolumnwidget.moc"