From 1ceb09062f9272bedaf8604f7fcd59f45463986b Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 1 Oct 2026 16:22:54 +0300 Subject: [PATCH] Show PM file delivery state without invoking group downloads --- tools/chatgui/src/messagedelegate.cpp | 3 +++ tools/chatgui/src/messagedelegate.h | 1 + 2 files changed, 4 insertions(+) diff --git a/tools/chatgui/src/messagedelegate.cpp b/tools/chatgui/src/messagedelegate.cpp index f7131cc2..ceeb9790 100644 --- a/tools/chatgui/src/messagedelegate.cpp +++ b/tools/chatgui/src/messagedelegate.cpp @@ -140,6 +140,7 @@ bool MessageDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, qint64 msgId = index.data(MsgIdRole).toLongLong(); QString chId = index.data(MsgChannelIdRole).toString(); + if (chId.startsWith(QStringLiteral("dm:"))) return false; /* PM сохраняется через контекстное меню. */ if (dlState == 2) { /* downloaded: open file */ QString fp = index.data(MsgVoiceFileRole).toString(); if (!fp.isEmpty() && QFile::exists(fp)) { @@ -1273,6 +1274,8 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio qint64 fsz = index.data(MsgFileSizeRole).toLongLong(); QString sizeStr = formatFileSize(fsz); QString stateStr = (dlState == 2) ? QString::fromUtf8("\xE2\x9C\x85") : (dlState == 1) ? "Downloading..." : "Download"; + QString deliveryState = index.data(MsgDeliveryStateRole).toString(); + if (!deliveryState.isEmpty()) stateStr = deliveryState; QString info = sizeStr + " \xC2\xB7 " + stateStr; int nameH = QFontMetrics(fileFont).height(); QRect sizeRect(L.textRect.left(), L.textRect.top() + nameH, L.textRect.width(), QFontMetrics(sizeFont).height()); diff --git a/tools/chatgui/src/messagedelegate.h b/tools/chatgui/src/messagedelegate.h index b94c04f9..11af1818 100644 --- a/tools/chatgui/src/messagedelegate.h +++ b/tools/chatgui/src/messagedelegate.h @@ -39,6 +39,7 @@ enum MessageDataRole { MsgVideoWidthRole = Qt::UserRole + 33, MsgVideoHeightRole = Qt::UserRole + 34, MsgVideoDurationMsRole = Qt::UserRole + 35, + MsgDeliveryStateRole = Qt::UserRole + 36, }; class MessageDelegate : public QStyledItemDelegate {