smsapp: Port away from deprecated Kirigami.BasicListItem

This commit is contained in:
Alexander Lohnau 2023-10-12 20:26:53 +02:00
parent aa30937905
commit 8852f342e9

View file

@ -10,7 +10,8 @@ import QtQuick 2.5
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import org.kde.people 1.0 import org.kde.people 1.0
import org.kde.kirigami 2.12 as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigami.delegates as KirigamiDelegates
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
import org.kde.kdeconnect.sms 1.0 import org.kde.kdeconnect.sms 1.0
@ -184,13 +185,13 @@ Kirigami.ScrollablePage
Keys.forwardTo: [headerItem] Keys.forwardTo: [headerItem]
delegate: Kirigami.BasicListItem delegate: KirigamiDelegates.SubtitleDelegate
{ {
id: listItem id: listItem
icon.name: decoration icon.name: decoration
reserveSpaceForIcon: true text: display
label: display
subtitle: toolTip subtitle: toolTip
width: view.width
property var thumbnail: attachmentPreview property var thumbnail: attachmentPreview
@ -205,8 +206,8 @@ Kirigami.ScrollablePage
} }
onClicked: { onClicked: {
startChat();
view.currentIndex = index view.currentIndex = index
startChat();
} }
Kirigami.Icon { Kirigami.Icon {
@ -227,13 +228,13 @@ Kirigami.ScrollablePage
Layout.minimumHeight: size Layout.minimumHeight: size
Layout.maximumHeight: size Layout.maximumHeight: size
Layout.minimumWidth: size Layout.minimumWidth: size
selected: (listItem.highlighted || listItem.checked || (listItem.pressed && listItem.supportsMouseEvents)) selected: (listItem.highlighted || listItem.checked || listItem.pressed)
opacity: 1 opacity: 1
visible: source != undefined visible: source != undefined
} }
// Keep the currently-open chat highlighted even if this element is not focused // Keep the currently-open chat highlighted even if this element is not focused
highlighted: view.currentIndex == index highlighted: ListView.isCurrentItem
} }
Component.onCompleted: { Component.onCompleted: {