mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
misc: show "deleted message" for deleted message
So that users can know when a message is deleted and can check previous version like any edited version. Change-Id: If3c1daeec930bd4b0f359573b971790199397489
This commit is contained in:
parent
b16131e63a
commit
c7c8e2e8f6
8 changed files with 19 additions and 13 deletions
|
@ -55,8 +55,9 @@ BaseModalDialog {
|
|||
anchors.centerIn: parent
|
||||
|
||||
Text {
|
||||
Layout.preferredWidth: root.width / 4
|
||||
Layout.maximumWidth: root.width / 2
|
||||
Layout.leftMargin: JamiTheme.settingsMarginSize
|
||||
elide: Text.ElideRight
|
||||
|
||||
text: MessagesAdapter.getFormattedDay(modelData.timestamp.toString())
|
||||
+ " - " + MessagesAdapter.getFormattedTime(modelData.timestamp.toString())
|
||||
|
@ -72,7 +73,7 @@ BaseModalDialog {
|
|||
id: metrics
|
||||
elide: Text.ElideRight
|
||||
elideWidth: 3 * rowBody.width / 4 - 2 * JamiTheme.preferredMarginSize
|
||||
text: modelData.body
|
||||
text: modelData.body === "" ? JamiStrings.deletedMessage : modelData.body
|
||||
}
|
||||
|
||||
text: metrics.elidedText
|
||||
|
|
|
@ -31,7 +31,7 @@ Item {
|
|||
property real contentWidth: bubble.width
|
||||
property var emojiTexts: ownEmojiList
|
||||
|
||||
visible: emojis ? emojis.length : false
|
||||
visible: emojis.length && Body !== ""
|
||||
|
||||
property string emojis: {
|
||||
var space = ""
|
||||
|
|
|
@ -88,7 +88,7 @@ Item {
|
|||
id: metrics
|
||||
elide: Text.ElideRight
|
||||
elideWidth: JamiTheme.preferredFieldWidth - JamiTheme.preferredMarginSize
|
||||
text: ReplyToBody
|
||||
text: ReplyToBody === "" && ReplyToAuthor !== "" ? "*(Deleted Message)*" : ReplyToBody
|
||||
}
|
||||
|
||||
textFormat: Text.MarkdownText
|
||||
|
|
|
@ -174,10 +174,10 @@ Control {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: isOutgoing ? optionButtonItem.right : undefined
|
||||
anchors.left: !isOutgoing ? optionButtonItem.left : undefined
|
||||
visible: bubbleArea.bubbleHovered
|
||||
visible: Body !== "" && (bubbleArea.bubbleHovered
|
||||
|| hovered
|
||||
|| reply.hovered
|
||||
|| bgHandler.hovered
|
||||
|| bgHandler.hovered)
|
||||
source: JamiResources.more_vert_24dp_svg
|
||||
width: optionButtonItem.width / 2
|
||||
height: optionButtonItem.height
|
||||
|
@ -202,10 +202,10 @@ Control {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: isOutgoing ? more.left : undefined
|
||||
anchors.left: !isOutgoing ? more.right : undefined
|
||||
visible: bubbleArea.bubbleHovered
|
||||
visible: Body !== "" && (bubbleArea.bubbleHovered
|
||||
|| hovered
|
||||
|| more.hovered
|
||||
|| bgHandler.hovered
|
||||
|| bgHandler.hovered)
|
||||
|
||||
onClicked: {
|
||||
MessagesAdapter.editId = ""
|
||||
|
|
|
@ -58,7 +58,7 @@ SBSMessageBase {
|
|||
|
||||
padding: isEmojiOnly ? 0 : JamiTheme.preferredMarginSize
|
||||
anchors.right: isOutgoing ? parent.right : undefined
|
||||
text: Body
|
||||
text: Body === "" ? "*("+ JamiStrings.deletedMessage +")*" : Body
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
|
||||
HoverHandler {
|
||||
|
|
|
@ -352,6 +352,7 @@ Item {
|
|||
property string backendError: qsTr("This is the error from the backend: %0")
|
||||
property string disabledAccount: qsTr("The account is disabled")
|
||||
property string noNetworkConnectivity: qsTr("No network connectivity")
|
||||
property string deletedMessage: qsTr("Deleted message")
|
||||
|
||||
// Chatview footer
|
||||
property string jumpToLatest: qsTr("Jump to latest")
|
||||
|
|
|
@ -215,8 +215,7 @@ JamiListView {
|
|||
readonly property int mergeType: Interaction.Type.MERGE
|
||||
readonly property int editedType: Interaction.Type.EDITED
|
||||
readonly property int reactionType: Interaction.Type.REACTION
|
||||
expression: Body !== ""
|
||||
&& Type !== mergeType
|
||||
expression: Type !== mergeType
|
||||
&& Type !== editedType
|
||||
&& Type !== reactionType
|
||||
}
|
||||
|
|
|
@ -394,6 +394,8 @@ MessageListModel::roleNames() const
|
|||
bool
|
||||
MessageListModel::isOnlyEmoji(const QString& text) const
|
||||
{
|
||||
if (text.isEmpty())
|
||||
return false;
|
||||
auto codepointList = text.toUcs4();
|
||||
for (QList<uint>::iterator it = codepointList.begin(); it != codepointList.end(); it++) {
|
||||
auto cur = false;
|
||||
|
@ -418,7 +420,7 @@ QVariant
|
|||
MessageListModel::dataForItem(item_t item, int, int role) const
|
||||
{
|
||||
QString replyId = item.second.commit["reply-to"];
|
||||
int repliedMsg;
|
||||
int repliedMsg = -1;
|
||||
if (!replyId.isEmpty() && (role == Role::ReplyToAuthor || role == Role::ReplyToBody)) {
|
||||
repliedMsg = getIndexOfMessage(replyId);
|
||||
}
|
||||
|
@ -695,7 +697,10 @@ MessageListModel::editMessage(const QString& msgId, interaction::Info& info)
|
|||
}
|
||||
info.body = it->rbegin()->body;
|
||||
editedBodies_.erase(it);
|
||||
emitDataChanged(msgId, {MessageList::Role::Body, MessageList::Role::PreviousBodies});
|
||||
emitDataChanged(msgId,
|
||||
{MessageList::Role::Body,
|
||||
MessageList::Role::PreviousBodies,
|
||||
MessageList::Role::IsEmojiOnly});
|
||||
|
||||
// Body changed, replies should update
|
||||
for (const auto& replyId : replyTo_[msgId]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue