diff options
| author | Peter Penz <[email protected]> | 2007-09-09 18:54:32 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-09-09 18:54:32 +0000 |
| commit | ea270709c1ed77978d0b88016ab490fe67b73c56 (patch) | |
| tree | 48639f5227019004a9b5c56d83ff6698eadaa541 /src/dolphindetailsview.cpp | |
| parent | a69d7a39557527794fa871fba3f2909b662c3935 (diff) | |
check whether the current index is valid and whether no other items are selected
svn path=/trunk/KDE/kdebase/apps/; revision=710361
Diffstat (limited to 'src/dolphindetailsview.cpp')
| -rw-r--r-- | src/dolphindetailsview.cpp | 10 |
1 files changed, 8 insertions, 2 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); } } |
