RoomManger connection
RoomManger should just get it's connection from Controller, no need to involve QML
This commit is contained in:
@@ -318,7 +318,7 @@ void Controller::setActiveConnection(NeoChatConnection *connection)
|
||||
updateBadgeNotificationCount(m_connection, m_connection->badgeNotificationCount());
|
||||
}
|
||||
|
||||
Q_EMIT activeConnectionChanged();
|
||||
Q_EMIT activeConnectionChanged(m_connection);
|
||||
}
|
||||
|
||||
void Controller::listenForNotifications()
|
||||
|
||||
@@ -129,6 +129,6 @@ Q_SIGNALS:
|
||||
void errorOccured(const QString &error, const QString &detail);
|
||||
void connectionAdded(NeoChatConnection *connection);
|
||||
void connectionDropped(NeoChatConnection *connection);
|
||||
void activeConnectionChanged();
|
||||
void activeConnectionChanged(NeoChatConnection *connection);
|
||||
void accountsLoadingChanged();
|
||||
};
|
||||
|
||||
@@ -50,7 +50,6 @@ Kirigami.ApplicationWindow {
|
||||
onConnectionChanged: {
|
||||
CustomEmojiModel.connection = root.connection;
|
||||
MatrixImageProvider.connection = root.connection;
|
||||
RoomManager.connection = root.connection;
|
||||
SpaceHierarchyCache.connection = root.connection;
|
||||
if (ShareHandler.text && root.connection) {
|
||||
root.handleShare();
|
||||
@@ -244,7 +243,6 @@ Kirigami.ApplicationWindow {
|
||||
Component.onCompleted: {
|
||||
CustomEmojiModel.connection = root.connection;
|
||||
MatrixImageProvider.connection = root.connection;
|
||||
RoomManager.connection = root.connection;
|
||||
SpaceHierarchyCache.connection = root.connection;
|
||||
WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
|
||||
if (ShareHandler.text && root.connection) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "roommanager.h"
|
||||
|
||||
#include "chatbarcache.h"
|
||||
#include "controller.h"
|
||||
#include "eventhandler.h"
|
||||
#include "messagecomponenttype.h"
|
||||
#include "models/timelinemodel.h"
|
||||
@@ -42,6 +43,10 @@ RoomManager::RoomManager(QObject *parent)
|
||||
connect(this, &RoomManager::currentRoomChanged, this, [this]() {
|
||||
m_timelineModel->setRoom(m_currentRoom);
|
||||
});
|
||||
|
||||
connect(&Controller::instance(), &Controller::activeConnectionChanged, this, [this](NeoChatConnection *connection) {
|
||||
setConnection(connection);
|
||||
});
|
||||
}
|
||||
|
||||
RoomManager::~RoomManager()
|
||||
@@ -397,11 +402,6 @@ void RoomManager::setChatDocumentHandler(ChatDocumentHandler *handler)
|
||||
Q_EMIT chatDocumentHandlerChanged();
|
||||
}
|
||||
|
||||
NeoChatConnection *RoomManager::connection() const
|
||||
{
|
||||
return m_connection;
|
||||
}
|
||||
|
||||
void RoomManager::setConnection(NeoChatConnection *connection)
|
||||
{
|
||||
if (m_connection == connection) {
|
||||
|
||||
@@ -45,8 +45,6 @@ class RoomManager : public QObject, public UriResolverBase
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
|
||||
Q_PROPERTY(NeoChatConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
|
||||
/**
|
||||
* @brief The current open room in NeoChat, if any.
|
||||
*
|
||||
@@ -204,7 +202,9 @@ public:
|
||||
bool directChatsActive() const;
|
||||
void setDirectChatsActive(bool directChatsActive);
|
||||
|
||||
NeoChatConnection *connection() const;
|
||||
/**
|
||||
* @brief Set the current connection
|
||||
*/
|
||||
void setConnection(NeoChatConnection *connection);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
Reference in New Issue
Block a user