From 6d9dca7da83f2a139ed2a38eb93034123e588923 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Wed, 15 Feb 2023 22:24:10 +0100 Subject: [PATCH] Show a warning when a file is too large to download BUG: 465527 --- src/controller.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controller.cpp b/src/controller.cpp index 13db25c1c..7679d2953 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #ifdef QUOTIENT_07 @@ -610,6 +611,11 @@ void Controller::setActiveConnection(Connection *connection) m_isOnline = true; Q_EMIT isOnlineChanged(true); }); + connect(connection, &Connection::requestFailed, this, [=](BaseJob *job) { + if (dynamic_cast(job) && job->jsonData()["errcode"].toString() == "M_TOO_LARGE"_ls) { + RoomManager::instance().warning(i18n("File too large to download."), i18n("Contact your matrix server administrator for support.")); + } + }); } else { NeoChatConfig::self()->setActiveConnection(QString()); }