Compare commits

...

2 commits

Author SHA1 Message Date
Aniket Kumar
22d7be579d kirigami 2.6 to kirigami 2.12 2020-06-27 18:18:32 +02:00
Aniket Kumar
1a29ab19ac replaced with BasicListItem 2020-06-27 18:18:32 +02:00
2 changed files with 10 additions and 31 deletions

View file

@ -205,6 +205,9 @@ void ConversationListModel::createRowFromMessage(const ConversationMessage& mess
// Get the body that we should display // Get the body that we should display
QString displayBody = message.containsTextBody() ? message.body() : i18n("(Unsupported Message Type)"); 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 // Prepend the sender's name
if (message.isOutgoing()) { if (message.isOutgoing()) {
displayBody = i18n("You: %1", displayBody); displayBody = i18n("You: %1", displayBody);

View file

@ -24,7 +24,7 @@ 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.6 as Kirigami import org.kde.kirigami 2.12 as Kirigami
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
@ -227,38 +227,14 @@ Kirigami.ScrollablePage
Keys.forwardTo: [headerItem] Keys.forwardTo: [headerItem]
delegate: Kirigami.AbstractListItem delegate: Kirigami.BasicListItem
{ {
id: listItem id: listItem
contentItem: RowLayout { icon: decoration
Kirigami.Icon { reserveSpaceForIcon: true
id: iconItem label: display
source: decoration subtitle: toolTip
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)
}
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() { function startChat() {
applicationWindow().pageStack.push(chatView, { applicationWindow().pageStack.push(chatView, {
@ -275,7 +251,7 @@ Kirigami.ScrollablePage
view.currentIndex = index view.currentIndex = index
} }
// 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: chatView.conversationId == model.conversationId highlighted: view.currentIndex == index
} }
Component.onCompleted: { Component.onCompleted: {