OpenWith: Double click to open the app

This commit is contained in:
reionwong 2021-07-29 17:45:04 +08:00
parent a57f67cba2
commit e5cfe335a9

View file

@ -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()
}
}