From e5cfe335a943033f92e1a9279aad0d25cd4e8355 Mon Sep 17 00:00:00 2001 From: reionwong Date: Thu, 29 Jul 2021 17:45:04 +0800 Subject: [PATCH] OpenWith: Double click to open the app --- qml/Dialogs/OpenWithDialog.qml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/qml/Dialogs/OpenWithDialog.qml b/qml/Dialogs/OpenWithDialog.qml index ea323e5..adf7587 100644 --- a/qml/Dialogs/OpenWithDialog.qml +++ b/qml/Dialogs/OpenWithDialog.qml @@ -47,6 +47,14 @@ Item { doneButton.focus = true } + function openApp() { + if (defaultCheckBox.checked) + mimeAppManager.setDefaultAppForFile(control.url, listView.model.get(listView.currentIndex).desktopFile) + + launcher.launchApp(listView.model.get(listView.currentIndex).desktopFile, control.url) + main.close() + } + Keys.enabled: true Keys.onEscapePressed: main.close() @@ -89,10 +97,9 @@ Item { id: mouseArea anchors.fill: parent hoverEnabled: true - - onClicked: { - listView.currentIndex = index - } + acceptedButtons: Qt.LeftButton + onDoubleClicked: control.openApp() + onClicked: listView.currentIndex = index } Rectangle { @@ -153,13 +160,7 @@ Item { flat: true text: qsTr("Open") Layout.fillWidth: true - onClicked: { - if (defaultCheckBox.checked) - mimeAppManager.setDefaultAppForFile(control.url, listView.model.get(listView.currentIndex).desktopFile) - - launcher.launchApp(listView.model.get(listView.currentIndex).desktopFile, control.url) - main.close() - } + onClicked: control.openApp() } }