From f15233b31f4051ffcd46724854f153477e489d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Tue, 18 Jan 2022 14:10:14 -0500 Subject: [PATCH] draft: Implement new design for the draft indicator GitLab: #427 Change-Id: I73818240946ab7c42eb238c50ca0f38061ff13d9 --- src/conversationlistmodelbase.cpp | 11 ++--------- src/mainview/components/SmartListItemDelegate.qml | 9 +++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/conversationlistmodelbase.cpp b/src/conversationlistmodelbase.cpp index d9cd6f1e..6eb844bc 100644 --- a/src/conversationlistmodelbase.cpp +++ b/src/conversationlistmodelbase.cpp @@ -90,15 +90,8 @@ ConversationListModelBase::dataForItem(item_t item, int role) const return {}; } case Role::Draft: { - if (!item.uid.isEmpty()) { - const auto draft = lrcInstance_->getContentDraft(item.uid, item.accountId); - if (!draft.isEmpty()) { - // Pencil Emoji - uint cp = 0x270F; - auto emojiString = QString::fromUcs4(reinterpret_cast(&cp), 1); - return emojiString + draft; - } - } + if (!item.uid.isEmpty()) + return lrcInstance_->getContentDraft(item.uid, item.accountId); return {}; } case Role::IsRequest: diff --git a/src/mainview/components/SmartListItemDelegate.qml b/src/mainview/components/SmartListItemDelegate.qml index 7891d48c..dcf6a775 100644 --- a/src/mainview/components/SmartListItemDelegate.qml +++ b/src/mainview/components/SmartListItemDelegate.qml @@ -36,6 +36,8 @@ ItemDelegate { property string accountId: "" property string convId: "" + highlighted: ListView.isCurrentItem + onVisibleChanged: { if (visible) return @@ -129,6 +131,13 @@ ItemDelegate { color: JamiTheme.primaryForegroundColor } + // Draft indicator + ResponsiveImage { + visible: Draft && !root.highlighted + source: JamiResources.round_edit_24dp_svg + color: JamiTheme.primaryForegroundColor + } + ColumnLayout { Layout.fillHeight: true spacing: 2