Allow pressing enter/return on "Add Account" in account switcher dialog

Because "Add Account" is a "fake item" by being the footer, it should be
the null fallback when accessing currentItem.
This commit is contained in:
Joshua Goins
2025-09-11 11:21:43 +02:00
parent 17b632eb78
commit 812e5beee6

View File

@@ -95,8 +95,8 @@ Kirigami.Dialog {
accountView.decrementCurrentIndex();
}
}
Keys.onEnterPressed: (accountView.currentItem as Delegates.RoundedItemDelegate).clicked()
Keys.onReturnPressed: (accountView.currentItem as Delegates.RoundedItemDelegate).clicked()
Keys.onEnterPressed: (accountView.currentItem as Delegates.RoundedItemDelegate ?? accountView.footerItem).clicked()
Keys.onReturnPressed: (accountView.currentItem as Delegates.RoundedItemDelegate ?? accountView.footerItem).clicked()
onVisibleChanged: {
for (let i = 0; i < accountView.count; i++) {