┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-02-09 22:05:38 +0100
committerPeter Penz <[email protected]>2011-02-09 22:05:38 +0100
commit8ccc71b33f2adc251412f31873a5d03d3b9c1ca7 (patch)
treefca1f4c1b0cb1df7e2898092768db0d579fb3adc
parent4a9561e6b7e8f1115c7391ef433ba44f8569dc46 (diff)
Assure that RETURN emits itemTriggered() for one file
If only one file is selected, pressing RETURN should behave similar like triggering the item with the mouse. For this the signal itemTriggered() must be emitted. CCBUG: 250475
-rw-r--r--src/views/dolphinviewcontroller.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/views/dolphinviewcontroller.cpp b/src/views/dolphinviewcontroller.cpp
index 672cffe65..e182e48c1 100644
--- a/src/views/dolphinviewcontroller.cpp
+++ b/src/views/dolphinviewcontroller.cpp
@@ -139,10 +139,8 @@ void DolphinViewController::handleKeyPressEvent(QKeyEvent* event)
return;
}
- // Collect the non-directory files into a list and
- // call runPreferredApplications for that list.
- // Several selected directories are opened in separate tabs,
- // one selected directory will get opened in the view.
+ // Collect selected files and selected directories
+ // as two separate lists.
QModelIndexList dirQueue;
const QModelIndexList indexList = selModel->selectedIndexes();
KFileItemList fileOpenList;
@@ -154,14 +152,20 @@ void DolphinViewController::handleKeyPressEvent(QKeyEvent* event)
}
}
- KFileItemActions fileItemActions;
- fileItemActions.runPreferredApplications(fileOpenList, "DesktopEntryName != 'dolphin'");
+ // Handle selected files
+ if (fileOpenList.count() == 1) {
+ emit itemTriggered(fileOpenList.first());
+ } else {
+ KFileItemActions fileItemActions;
+ fileItemActions.runPreferredApplications(fileOpenList, "DesktopEntryName != 'dolphin'");
+ }
- if (dirQueue.length() == 1) {
- // open directory in the view
+ // Handle selected directories
+ if (dirQueue.count() == 1) {
+ // Open directory in the view
emit itemTriggered(itemForIndex(dirQueue[0]));
} else {
- // open directories in separate tabs
+ // Open directories in separate tabs
foreach(const QModelIndex& dir, dirQueue) {
emit tabRequested(itemForIndex(dir).url());
}