Commit e67730fb authored by Nate Graham's avatar Nate Graham
Browse files

Pre-select the only item in the list lists with single items

When an app asks for permission to see the screen but there is only a
single screen, or permission to see a window but there is only a single
window, the user will be shown a permissions dialog that has a list view
of screens or windows with only one item in it. The user will need to
manually click on that one item before the Share button will become
enabled, which is annoying and somewhat unintuitive.

This commit refines that workflow so that if the permissions dialog is
showing a single item in its list, that single item is pre-selected so
that the user only has to click on the "Share" button.
parent b693418c
Pipeline #126251 passed with stage
in 48 seconds
......@@ -99,5 +99,12 @@ PWD.SystemDialog
standardButtons: QQC2.DialogButtonBox.Ok | QQC2.DialogButtonBox.Cancel
Component.onCompleted: {
dialogButtonBox.standardButton(QQC2.DialogButtonBox.Ok).text = i18n("Share")
// If there's only one thing in the list, pre-select it to save the user a click
if (outputsView.count == 1 && windowsView.count == 0) {
outputsView.model.setData(outputsView.model.index(0, 0), Qt.Checked, Qt.CheckStateRole);
} else if (windowsView.count == 1 && outputsView.count == 0) {
windowsView.model.setData(outputsView.model.index(0, 0), Qt.Checked, Qt.CheckStateRole);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment