Remove various outdated ifdefs

This commit is contained in:
Tobias Fella
2025-09-11 10:47:23 +02:00
parent 2504ca3f5c
commit c93ce52ba1
7 changed files with 0 additions and 61 deletions

View File

@@ -207,16 +207,10 @@ void ChatBarCache::setAttachmentPath(const QString &attachmentPath)
m_attachmentPath = attachmentPath;
Q_EMIT attachmentPathChanged();
#if (Quotient_VERSION_MINOR < 10 && Quotient_VERSION_PATCH < 3) || Quotient_VERSION_MINOR < 9
m_relationType = None;
const auto oldEventId = std::exchange(m_relationId, QString());
Q_EMIT relationIdChanged(oldEventId, m_relationId);
#else
if (m_relationType == Edit) {
const auto oldEventId = std::exchange(m_relationId, QString());
Q_EMIT relationIdChanged(oldEventId, m_relationId);
}
#endif
}
void ChatBarCache::clearRelations()

View File

@@ -40,9 +40,7 @@
#include <Quotient/events/simplestateevents.h>
#include <Quotient/jobs/downloadfilejob.h>
#include <Quotient/qt_connection_util.h>
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
#include <Quotient/thread.h>
#endif
#include "chatbarcache.h"
#include "clipboard.h"
@@ -286,11 +284,7 @@ QCoro::Task<void> NeoChatRoom::doUploadFile(QUrl url, QString body, std::optiona
content = new EventContent::FileContent(url, fileInfo.size(), mime, fileInfo.fileName());
}
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 2)
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, std::unique_ptr<EventContent::FileContentBase>(content), relatesTo);
#else
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, std::unique_ptr<EventContent::FileContentBase>(content));
#endif
setHasFileUploading(true);
connect(this, &Room::fileTransferCompleted, [this, txnId](const QString &id, FileSourceInfo) {
if (id == txnId) {
@@ -1778,11 +1772,7 @@ bool NeoChatRoom::eventIsThreaded(const QString &eventId) const
return false;
}
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
return event->isThreaded() || threads().contains(eventId);
#else
return event->isThreaded();
#endif
}
QString NeoChatRoom::rootIdForThread(const QString &eventId) const
@@ -1793,11 +1783,9 @@ QString NeoChatRoom::rootIdForThread(const QString &eventId) const
}
auto rootId = event->threadRootEventId();
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
if (rootId.isEmpty() && threads().contains(eventId)) {
rootId = event->id();
}
#endif
return rootId;
}

View File

@@ -180,7 +180,6 @@ void Registration::testHomeserver()
if (m_testServerJob) {
delete m_testServerJob;
}
#if Quotient_VERSION_MINOR > 9 || Quotient_VERSION_PATCH > 2
auto ssoFlow = m_connection->getLoginFlow(LoginFlowTypes::SSO);
if (ssoFlow && ssoFlow->delegatedOidcCompatibility) {
auto session = m_connection->prepareForSso(u"NeoChat"_s);
@@ -214,7 +213,6 @@ void Registration::testHomeserver()
});
return;
}
#endif
m_testServerJob = m_connection->callApi<NeoChatRegisterJob>("user"_L1, std::nullopt, "user"_L1, QString(), QString(), QString(), false);
connect(m_testServerJob.data(), &BaseJob::finished, this, [this]() {

View File

@@ -7,9 +7,7 @@
#include <Quotient/events/roommessageevent.h>
#include <Quotient/events/stickerevent.h>
#include <Quotient/qt_connection_util.h>
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
#include <Quotient/thread.h>
#endif
#include <KLocalizedString>
#include <Kirigami/Platform/PlatformTheme>
@@ -163,17 +161,11 @@ QString EventMessageContentModel::threadRootId() const
return {};
}
auto roomMessageEvent = eventCast<const RoomMessageEvent>(event.first);
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
if (roomMessageEvent && roomMessageEvent->isThreaded()) {
return roomMessageEvent->threadRootEventId();
} else if (m_room->threads().contains(roomMessageEvent->id())) {
return m_eventId;
}
#else
if (roomMessageEvent && roomMessageEvent->isThreaded()) {
return roomMessageEvent->threadRootEventId();
}
#endif
return {};
}
@@ -317,23 +309,15 @@ QList<MessageComponent> EventMessageContentModel::messageContentComponents(bool
}
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
if (m_threadsEnabled && roomMessageEvent
&& ((roomMessageEvent->isThreaded() && roomMessageEvent->id() == roomMessageEvent->threadRootEventId())
|| m_room->threads().contains(roomMessageEvent->id()))) {
#else
if (m_threadsEnabled && roomMessageEvent && roomMessageEvent->isThreaded() && roomMessageEvent->id() == roomMessageEvent->threadRootEventId()) {
#endif
newComponents += MessageComponent{MessageComponentType::Separator, {}, {}};
newComponents += MessageComponent{MessageComponentType::ThreadBody, u"Thread Body"_s, {}};
}
// If the event is already threaded the ThreadModel will handle displaying a chat bar.
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
if (isThreading && roomMessageEvent && !(roomMessageEvent->isThreaded() || m_room->threads().contains(roomMessageEvent->id()))) {
#else
if (isThreading && roomMessageEvent && roomMessageEvent->isThreaded()) {
#endif
newComponents += MessageComponent{MessageComponentType::ChatBar, QString(), {}};
}

View File

@@ -24,11 +24,7 @@ ThreadModel::ThreadModel(const QString &threadRootId, NeoChatRoom *room)
Q_ASSERT(!m_threadRootId.isEmpty());
Q_ASSERT(room);
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 0)
connect(room, &Quotient::Room::pendingEventAdded, this, [this](const Quotient::RoomEvent *event) {
#else
connect(room, &Quotient::Room::pendingEventAboutToAdd, this, [this](Quotient::RoomEvent *event) {
#endif
if (auto roomEvent = eventCast<const Quotient::RoomMessageEvent>(event)) {
if (roomEvent->isThreaded() && roomEvent->threadRootEventId() == m_threadRootId) {
addNewEvent(event);

View File

@@ -8,9 +8,7 @@
#include <Quotient/events/encryptedevent.h>
#include <Quotient/events/roommessageevent.h>
#include <Quotient/events/stickerevent.h>
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
#include <Quotient/thread.h>
#endif
#include <KFormat>
@@ -196,19 +194,12 @@ QVariant MessageModel::data(const QModelIndex &idx, int role) const
}
auto roomMessageEvent = eventCast<const RoomMessageEvent>(&event.value().get());
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
if (m_threadsEnabled && roomMessageEvent && (roomMessageEvent->isThreaded() || m_room->threads().contains(event.value().get().id()))) {
const auto &thread = m_room->threads().value(roomMessageEvent->isThreaded() ? roomMessageEvent->threadRootEventId() : event.value().get().id());
if (thread.latestEventId != event.value().get().id()) {
return EventStatus::Hidden;
}
}
#else
if (roomMessageEvent && roomMessageEvent->isThreaded() && roomMessageEvent->threadRootEventId() != event.value().get().id() && m_threadsEnabled) {
return EventStatus::Hidden;
}
#endif
return EventStatus::Normal;
}

View File

@@ -60,7 +60,6 @@ void TimelineMessageModel::connectNewRoom()
refreshLastUserEvents(i);
}
});
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 0)
connect(m_room, &Room::pendingEventAdded, this, [this](const Quotient::RoomEvent *event) {
Q_EMIT newEventAdded(event);
Q_EMIT newLocalUserEventAdded();
@@ -69,17 +68,6 @@ void TimelineMessageModel::connectNewRoom()
endInsertRows();
}
});
#else
connect(m_room, &Room::pendingEventAboutToAdd, this, [this](Quotient::RoomEvent *event) {
m_initialized = true;
Q_EMIT newEventAdded(event);
if (!m_resetting) {
beginInsertRows({}, 0, 0);
endInsertRows();
}
});
connect(m_room, &Room::pendingEventAdded, this, &TimelineMessageModel::endInsertRows);
#endif
connect(m_room, &Room::pendingEventAboutToMerge, this, [this](RoomEvent *, int i) {
Q_EMIT dataChanged(index(i, 0), index(i, 0), {IsPendingRole});
if (i == 0) {