Commit 2b8e95ca authored by Aniket Kumar's avatar Aniket Kumar 🤵 Committed by Nicolas Fella
Browse files

[smsapp] Replace custom ListItem with Kirigami's BasicListItem

parent 588c01eb
Pipeline #25156 passed with stage
in 6 minutes and 20 seconds
......@@ -205,6 +205,9 @@ void ConversationListModel::createRowFromMessage(const ConversationMessage& mess
// Get the body that we should display
QString displayBody = message.containsTextBody() ? message.body() : i18n("(Unsupported Message Type)");
// For displaying single line subtitle out of the multiline messages to keep the ListItems consistent
displayBody = displayBody.mid(0, displayBody.indexOf(QStringLiteral("\n")));
// Prepend the sender's name
if (message.isOutgoing()) {
displayBody = i18n("You: %1", displayBody);
......
......@@ -24,7 +24,7 @@ import QtQuick 2.5
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import org.kde.people 1.0
import org.kde.kirigami 2.6 as Kirigami
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kdeconnect 1.0
import org.kde.kdeconnect.sms 1.0
......@@ -227,38 +227,14 @@ Kirigami.ScrollablePage
Keys.forwardTo: [headerItem]
delegate: Kirigami.AbstractListItem
delegate: Kirigami.BasicListItem
{
id: listItem
contentItem: RowLayout {
Kirigami.Icon {
id: iconItem
source: decoration
readonly property int size: Kirigami.Units.iconSizes.smallMedium
Layout.minimumHeight: size
Layout.maximumHeight: size
Layout.minimumWidth: size
selected: listItem.highlighted || listItem.checked || (listItem.pressed && listItem.supportsMouseEvents)
}
icon: decoration
reserveSpaceForIcon: true
label: display
subtitle: toolTip
ColumnLayout {
Label {
Layout.fillWidth: true
font.weight: Font.Bold
text: display
maximumLineCount: 1
elide: Text.ElideRight
textFormat: Text.PlainText
}
Label {
Layout.fillWidth: true
text: toolTip
maximumLineCount: 1
elide: Text.ElideRight
textFormat: Text.PlainText
}
}
}
function startChat() {
applicationWindow().pageStack.push(chatView, {
......@@ -275,7 +251,7 @@ Kirigami.ScrollablePage
view.currentIndex = index
}
// Keep the currently-open chat highlighted even if this element is not focused
highlighted: chatView.conversationId == model.conversationId
highlighted: view.currentIndex == index
}
Component.onCompleted: {
......
Markdown is supported
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