Remove controller::joinRoom

Remove controller::joinRoom in favour of using RoomManager::OpenResource
This commit is contained in:
James Graham
2023-11-25 15:07:15 +00:00
parent 704430db7a
commit 201aa82c04
8 changed files with 7 additions and 24 deletions

View File

@@ -370,18 +370,6 @@ void Controller::saveWindowGeometry()
WindowController::instance().saveGeometry(); WindowController::instance().saveGeometry();
} }
// TODO: Remove in favor of RoomManager::joinRoom
void Controller::joinRoom(const QString &alias)
{
if (!alias.contains(":"_ls)) {
Q_EMIT errorOccured(i18n("The room id you are trying to join is not valid"));
return;
}
const auto knownServer = alias.mid(alias.indexOf(":"_ls) + 1);
RoomManager::instance().joinRoom(m_connection, alias, QStringList{knownServer});
}
void Controller::forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item) void Controller::forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item)
{ {
// HACK: Workaround bug QTBUG 93281 // HACK: Workaround bug QTBUG 93281

View File

@@ -100,11 +100,6 @@ public:
*/ */
bool saveAccessTokenToKeyChain(const Quotient::AccountSettings &account, const QByteArray &accessToken); bool saveAccessTokenToKeyChain(const Quotient::AccountSettings &account, const QByteArray &accessToken);
/**
* @brief Join a room.
*/
Q_INVOKABLE void joinRoom(const QString &alias);
[[nodiscard]] bool supportSystemTray() const; [[nodiscard]] bool supportSystemTray() const;
/** /**

View File

@@ -235,7 +235,7 @@ QList<ActionsModel::Action> actions{
return QString(); return QString();
} }
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Joining room <roomname>.", "Joining room %1.", text)); Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Joining room <roomname>.", "Joining room %1.", text));
Controller::instance().joinRoom(text); RoomManager::instance().openResource(text, "join"_ls);
return QString(); return QString();
}, },
false, false,
@@ -290,7 +290,7 @@ QList<ActionsModel::Action> actions{
return QString(); return QString();
} }
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Joining room <roomname>.", "Joining room %1.", text)); Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Joining room <roomname>.", "Joining room %1.", text));
Controller::instance().joinRoom(text); RoomManager::instance().openResource(text, "join"_ls);
return QString(); return QString();
}, },
false, false,

View File

@@ -26,7 +26,7 @@ RowLayout {
if (isJoined) { if (isJoined) {
RoomManager.enterRoom(root.connection.room(roomId)) RoomManager.enterRoom(root.connection.room(roomId))
} else { } else {
Controller.joinRoom(roomId.length > 0 ? roomId : alias) RoomManager.openResource(roomId.length > 0 ? roomId : alias, "join")
} }
}) })
} }

View File

@@ -57,7 +57,7 @@ ColumnLayout {
if (isJoined) { if (isJoined) {
RoomManager.enterRoom(root.connection.room(roomId)); RoomManager.enterRoom(root.connection.room(roomId));
} else { } else {
Controller.joinRoom(roomId.length > 0 ? roomId : alias); RoomManager.openResource(roomId.length > 0 ? roomId : alias, "join");
} }
}) })
exploreTabBar.currentIndex = -1; exploreTabBar.currentIndex = -1;

View File

@@ -66,7 +66,7 @@ Labs.MenuBar {
if (isJoined) { if (isJoined) {
RoomManager.enterRoom(root.connection.room(roomId)) RoomManager.enterRoom(root.connection.room(roomId))
} else { } else {
Controller.joinRoom(roomId) RoomManager.openResource(roomId, "join")
} }
}) })
} }

View File

@@ -191,7 +191,7 @@ Kirigami.Page {
if (isJoined) { if (isJoined) {
RoomManager.enterRoom(root.connection.room(roomId)) RoomManager.enterRoom(root.connection.room(roomId))
} else { } else {
Controller.joinRoom(roomId) RoomManager.openResource(roomId, "join")
} }
}) })
} }

View File

@@ -149,7 +149,7 @@ Item {
if (root.isJoined) { if (root.isJoined) {
root.enterRoom() root.enterRoom()
} else { } else {
Controller.joinRoom(root.roomId) RoomManager.openResource(root.roomId, "join")
} }
} }
} }