Show PM file delivery state without invoking group downloads
This commit is contained in:
1 parent
570f3dfab3
commit
1ceb09062f
2 files changed
+4
No files matched your search
@@ -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());
|
||||
|
||||
Reference in new issue
Block a user