summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <peter.penz19@gmail.com>2011-02-09 21:04:59 (GMT)
committerPeter Penz <peter.penz19@gmail.com>2011-02-09 21:04:59 (GMT)
commitec05ba261fffa6d9a4d301e5ee64d3922a6d020d (patch)
tree8bed11f621fea427338413796bd2170ccb88c2b1
parent6bb8f5ba17be70237972f805e54b3d6491bb6574 (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. BUG: 250475
-rw-r--r--dolphin/src/views/dolphinviewcontroller.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/dolphin/src/views/dolphinviewcontroller.cpp b/dolphin/src/views/dolphinviewcontroller.cpp
index 6e25700..00a21c2 100644
--- a/dolphin/src/views/dolphinviewcontroller.cpp
+++ b/dolphin/src/views/dolphinviewcontroller.cpp
@@ -128,7 +128,7 @@ QList<QAction*> DolphinViewController::versionControlActions(const KFileItemList
void DolphinViewController::handleKeyPressEvent(QKeyEvent* event)
{
- if (m_itemView == 0) {
+ if (!m_itemView) {
return;
}
@@ -141,10 +141,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;
@@ -156,14 +154,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());
}