summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Hein <[email protected]>2017-01-03 18:38:52 +0900
committerEike Hein <[email protected]>2017-01-03 18:44:41 +0900
commit7c2e3b0d3ba872272daf1224dee5bd5ef7ae67c9 (patch)
tree5c4d68d428dbace5ae8af1a2825566de4cf808fe
parent9bf5c40bd897d5b968edb116d85ca2ce36d2d292 (diff)
Run all selected items on Enter/Return.
Summary: Brings FV in line with Dolphin behavior. CCBUG:374030 Reviewers: #plasma, broulik Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D3933
-rw-r--r--containments/desktop/package/contents/ui/FolderView.qml7
-rw-r--r--containments/desktop/plugins/folder/foldermodel.cpp11
-rw-r--r--containments/desktop/plugins/folder/foldermodel.h1
3 files changed, 17 insertions, 2 deletions
diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml
index 431c849..ea88dc4 100644
--- a/containments/desktop/package/contents/ui/FolderView.qml
+++ b/containments/desktop/package/contents/ui/FolderView.qml
@@ -668,8 +668,11 @@ Item {
Keys.onReturnPressed: {
if (currentIndex != -1 && dir.hasSelection()) {
- var func = root.useListViewMode ? dir.cd : dir.run;
- func(positioner.map(currentIndex));
+ if (root.useListViewMode) {
+ dir.cd(positioner.map(currentIndex));
+ } else {
+ dir.runSelected();
+ }
}
}
diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp
index b8bf1c2..d77c6a7 100644
--- a/containments/desktop/plugins/folder/foldermodel.cpp
+++ b/containments/desktop/plugins/folder/foldermodel.cpp
@@ -517,6 +517,17 @@ void FolderModel::run(int row)
new KRun(url, 0);
}
+void FolderModel::runSelected()
+{
+ if (!m_selectionModel->hasSelection()) {
+ return;
+ }
+
+ foreach (const QModelIndex &index, m_selectionModel->selectedIndexes()) {
+ run(index.row());
+ }
+}
+
void FolderModel::rename(int row, const QString& name)
{
if (row < 0) {
diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h
index fec3456..5b744de 100644
--- a/containments/desktop/plugins/folder/foldermodel.h
+++ b/containments/desktop/plugins/folder/foldermodel.h
@@ -163,6 +163,7 @@ class FolderModel : public QSortFilterProxyModel
Q_INVOKABLE void cd(int row);
Q_INVOKABLE void run(int row);
+ Q_INVOKABLE void runSelected();
Q_INVOKABLE void rename(int row, const QString &name);
Q_INVOKABLE int fileExtensionBoundary(int row);