┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphindetailsview.cpp10
-rw-r--r--src/dolphiniconsview.cpp10
2 files changed, 16 insertions, 4 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index dfd7018bb..d7c8c5ab1 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -278,8 +278,14 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
void DolphinDetailsView::keyPressEvent(QKeyEvent* event)
{
QTreeView::keyPressEvent(event);
- if (event->key() == Qt::Key_Return) {
- m_controller->triggerItem(selectionModel()->currentIndex());
+
+ 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);
}
}
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index ed2332c05..d287318d0 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -209,8 +209,14 @@ void DolphinIconsView::paintEvent(QPaintEvent* event)
void DolphinIconsView::keyPressEvent(QKeyEvent* event)
{
KCategorizedView::keyPressEvent(event);
- if (event->key() == Qt::Key_Return) {
- m_controller->triggerItem(selectionModel()->currentIndex());
+
+ 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);
}
}