From dc0236254abc9f11210e101a3089b8d9afff262b Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 26 Apr 2010 15:50:59 +0000 Subject: [PATCH] use KFileItemActions::runPreferredApplications to handle Key_Enter on multiple selected files. Rewritten to make a direct method call rather than using a signal from 'this'. REVIEW: 3163 CCMAIL: toddrme2178@gmail.com svn path=/trunk/KDE/kdebase/apps/; revision=1119117 --- src/dolphinviewcontroller.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dolphinviewcontroller.cpp b/src/dolphinviewcontroller.cpp index 4ce83f968..6ef32f07f 100644 --- a/src/dolphinviewcontroller.cpp +++ b/src/dolphinviewcontroller.cpp @@ -21,6 +21,7 @@ #include "zoomlevelinfo.h" #include +#include #include #include #include @@ -138,19 +139,24 @@ void DolphinViewController::handleKeyPressEvent(QKeyEvent* event) return; } - // Emit the signal itemTriggered() for all selected files. + // 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. QModelIndexList dirQueue; const QModelIndexList indexList = selModel->selectedIndexes(); + KFileItemList fileOpenList; foreach (const QModelIndex& index, indexList) { if (itemForIndex(index).isDir()) { dirQueue << index; } else { - emit itemTriggered(itemForIndex(index)); + fileOpenList << itemForIndex(index); } } + KFileItemActions fileItemActions; + fileItemActions.runPreferredApplications(fileOpenList, "DesktopEntryName != 'dolphin'"); + if (dirQueue.length() == 1) { // open directory in the view emit itemTriggered(itemForIndex(dirQueue[0])); -- 2.47.3