┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Reich <[email protected]>2009-02-08 04:33:00 +0000
committerShaun Reich <[email protected]>2009-02-08 04:33:00 +0000
commit4a5218b3671cfa637d66bc21c231d5d97670a3fc (patch)
tree2ffdc404c3095992930a8c155f19263ecd8410e2
parent95607a31cd72680eabe0c33c56e1922047745b64 (diff)
Added right arrow key usage when in the Column View mode. When a directory is selected, and the right arrow is used, it will navigate into it (like double/single clicking a directory). Note, this only works on directories, not files, it was made this way by intention.
svn path=/trunk/KDE/kdebase/apps/; revision=923057
-rw-r--r--src/dolphincontroller.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp
index 980e16059..820d34a06 100644
--- a/src/dolphincontroller.cpp
+++ b/src/dolphincontroller.cpp
@@ -129,14 +129,36 @@ void DolphinController::handleKeyPressEvent(QKeyEvent* event)
const QItemSelectionModel* selModel = m_itemView->selectionModel();
const QModelIndex currentIndex = selModel->currentIndex();
- 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));
+
+ 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));
+ }
+ }
}
}
}