From 171930fb1d87a664d2b366047e00776595a3ccdb Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 30 Jun 2025 17:49:01 -0400 Subject: [PATCH] Show a message when failing to download a file And optionally show an error message, if libQuotient gets one. This helps in certain rare situations where you just *Cannot* download something. Before, NeoChat would just reset the image or video without telling you anything but now there's a nice big error message telling you what's wrong. --- src/messagecontent/models/messagecontentmodel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/messagecontent/models/messagecontentmodel.cpp b/src/messagecontent/models/messagecontentmodel.cpp index 11281b178..6daa09bdd 100644 --- a/src/messagecontent/models/messagecontentmodel.cpp +++ b/src/messagecontent/models/messagecontentmodel.cpp @@ -111,10 +111,16 @@ void MessageContentModel::initializeModel() Q_EMIT dataChanged(index(0), index(rowCount() - 1), {FileTransferInfoRole}); } }); - connect(m_room, &NeoChatRoom::fileTransferFailed, this, [this](const QString &eventId) { + connect(m_room, &NeoChatRoom::fileTransferFailed, this, [this](const QString &eventId, const QString &errorMessage) { if (eventId == m_eventId) { resetContent(); Q_EMIT dataChanged(index(0), index(rowCount() - 1), {FileTransferInfoRole}); + if (errorMessage.isEmpty()) { + Q_EMIT m_room->showMessage(MessageType::Error, i18nc("@info", "Failed to download file.")); + } else { + Q_EMIT m_room->showMessage(MessageType::Error, + i18nc("@info Failed to download file: [error message]", "Failed to download file:
%1", errorMessage)); + } } }); connect(m_room->editCache(), &ChatBarCache::relationIdChanged, this, [this](const QString &oldEventId, const QString &newEventId) {