Commit 74c6b71e authored by Ashvin Nihalani's avatar Ashvin Nihalani Committed by Nicolas Fella
Browse files

UI Improvements

Removed Clutter Single Party Conversation
Added Name ti Multiparty
Changed Default Icon in Conversation List
parent 1315d9b9
Pipeline #25973 passed with stage
in 12 minutes and 56 seconds
......@@ -34,14 +34,15 @@ Item {
property string selectedText
property date dateTime
property string name
property bool multiTarget
signal messageCopyRequested(string message)
Kirigami.Avatar {
id: avatar
width: Kirigami.Units.gridUnit * 2
width: visible ? Kirigami.Units.gridUnit * 2 : 0
height: width
visible: !root.sentByMe
visible: !root.sentByMe && multiTarget
name: root.name
anchors.left: parent.left
......@@ -103,6 +104,16 @@ Item {
height: childrenRect.height
property int contentWidth: Math.max(messageLabel.implicitWidth, dateLabel.implicitWidth)
Label {
id: authorLabel
width: parent.width
text: root.name
leftPadding: Kirigami.Units.largeSpacing
topPadding: Kirigami.Units.smallSpacing
visible: multiTarget
color: Kirigami.Theme.disabledTextColor
horizontalAlignment: messageLabel.horizontalAlignment
}
TextEdit {
id: messageLabel
......@@ -110,7 +121,7 @@ Item {
readOnly: true
leftPadding: Kirigami.Units.largeSpacing
rightPadding: Kirigami.Units.largeSpacing
topPadding: Kirigami.Units.largeSpacing
topPadding: authorLabel.visible ? 0 : Kirigami.Units.largeSpacing
width: parent.width
horizontalAlignment: root.sentByMe ? Text.AlignRight : Text.AlignLeft
wrapMode: Text.Wrap
......
......@@ -123,6 +123,7 @@ Kirigami.ScrollablePage
messageBody: model.display
sentByMe: model.fromMe
dateTime: new Date(model.date)
multiTarget: isMultitarget
width: viewport.width
......
......@@ -28,6 +28,7 @@
#include <QString>
#include <QStandardPaths>
#include <QHash>
#include <QtDebug>
#include <KPeople/PersonData>
#include <KPeople/PersonsModel>
......@@ -292,12 +293,21 @@ QIcon SmsHelper::getIconForAddresses(const QList<ConversationAddress>& addresses
QList<QPixmap> icons;
for (const ConversationAddress& address : addresses) {
const auto personData = SmsHelper::lookupPersonByAddress(address.address());
static const QIcon defaultIcon = QIcon::fromTheme(QStringLiteral("im-user"));
static const QPixmap defaultAvatar = defaultIcon.pixmap(defaultIcon.actualSize(QSize(32, 32)));
QPixmap avatar;
if (personData) {
icons.append(personData->photo());
const QVariant pic = personData->contactCustomProperty(QStringLiteral("picture"));
if (pic.canConvert<QImage>()) {
avatar = QPixmap::fromImage(pic.value<QImage>());
}
if (avatar.isNull()) {
icons.append(defaultAvatar);
} else {
icons.append(avatar);
}
} else {
static QString dummyAvatar = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/kpeople/dummy_avatar.png"));
icons.append(QPixmap(dummyAvatar));
icons.append(defaultAvatar);
}
}
......
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