From: Harsh Chouraria J Date: Mon, 11 Jan 2010 12:08:38 +0000 (+0000) Subject: BUG:222186 X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/c8ad5fd5b615f7d1a5ed1e793bfc367f7d3966b3 BUG:222186 With respect to the action done on hitting the "Return/Enter" key: * Fix the behavior for multiple-item opening, when they have directories among them. * Open multiple directories in background tabs. svn path=/trunk/KDE/kdebase/apps/; revision=1073019 --- diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index 408abd501..0bbf0557a 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -175,9 +175,28 @@ void DolphinController::handleKeyPressEvent(QKeyEvent* event) || (event->key() == Qt::Key_Enter)) && !selModel->selectedIndexes().isEmpty(); if (trigger) { + QModelIndexList dirQueue; const QModelIndexList indexList = selModel->selectedIndexes(); foreach (const QModelIndex& index, indexList) { - emit itemTriggered(itemForIndex(index)); + // Trigger non-directories immediately. + if (!itemForIndex(index).isDir()) { + emit itemTriggered(itemForIndex(index)); + } else { + // Keep storing the directory indexes for trigger later. + dirQueue << index; + } + } + // Trigger directories - Tabs if multiple, else normal. + if (!dirQueue.isEmpty()) { + if (dirQueue.length() == 1) { + // For single directory selection, open normally. + emit itemTriggered(itemForIndex(dirQueue[0])); + } else { + foreach(const QModelIndex& dir, dirQueue) { + // Since its a valid directory - open a tab. + emit tabRequested(itemForIndex(dir).url()); + } + } } } }