diff options
| author | Peter Penz <[email protected]> | 2009-02-08 07:15:26 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-02-08 07:15:26 +0000 |
| commit | 2f0a6a86d6e5cac7e08e95490fef866f3517e563 (patch) | |
| tree | 5af119e4e9d088608ca9c0378572d92124f8cd8b /src | |
| parent | 4a5218b3671cfa637d66bc21c231d5d97670a3fc (diff) | |
Revert SVN commit 923057: This code should not be part of DolphinController, it should be handled in the column view itself.
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=923072
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphincontroller.cpp | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index 820d34a06..980e16059 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -129,36 +129,14 @@ void DolphinController::handleKeyPressEvent(QKeyEvent* event) const QItemSelectionModel* selModel = m_itemView->selectionModel(); const QModelIndex currentIndex = selModel->currentIndex(); - - if (currentIndex.isValid() && selModel->selectedIndexes().count() > 0) { - const int key = event->key(); - - if ((key == Qt::Key_Return) || (key == Qt::Key_Enter) || (key == Qt::Key_Right)) { - - const QModelIndexList indexList = selModel->selectedIndexes(); - const bool isColumnView = m_dolphinView->mode() == m_dolphinView->ColumnView; - - if (key == Qt::Key_Right) { - if (isColumnView) { - // If it is the right arrow key and in the column view-only. - KFileItem curFileItem; - foreach(const QModelIndex& index, indexList) { - curFileItem = itemForIndex(index); - if (!curFileItem.isFile()) { - /* We want - * to make sure that the selected item - * is only a folder. If we did not have this check, it would be possible to use - * the right arrow to open a file when in the column view */ - emit itemTriggered(curFileItem); - } - } - } - } else { - //Else it is Return or Enter keypress, so it is okay to perform the action of triggering, on files also. - foreach(const QModelIndex& index, indexList) { - emit itemTriggered(itemForIndex(index)); - } - } + const bool trigger = currentIndex.isValid() + && ((event->key() == Qt::Key_Return) + || (event->key() == Qt::Key_Enter)) + && (selModel->selectedIndexes().count() > 0); + if (trigger) { + const QModelIndexList indexList = selModel->selectedIndexes(); + foreach (const QModelIndex& index, indexList) { + emit itemTriggered(itemForIndex(index)); } } } |
