Space Home Page
Add a space homepage with the ability to both create new room and add existing rooms to the space. This uses a tree model for the space hierarchy and will go to any number of levels. The user should only see the add options if they have appropriate permissions. This MR also combines the create space and room pages and adds a lot of optional functionality for managing space children. 
This commit is contained in:
@@ -179,7 +179,11 @@ void RoomManager::openRoomForActiveConnection()
|
||||
const auto room = qobject_cast<NeoChatRoom *>(Controller::instance().activeConnection()->room(roomId));
|
||||
|
||||
if (room) {
|
||||
enterRoom(room);
|
||||
if (room->isSpace()) {
|
||||
enterSpaceHome(room);
|
||||
} else {
|
||||
enterRoom(room);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,6 +226,34 @@ void RoomManager::openWindow(NeoChatRoom *room)
|
||||
Q_EMIT openRoomInNewWindow(room);
|
||||
}
|
||||
|
||||
void RoomManager::enterSpaceHome(NeoChatRoom *spaceRoom)
|
||||
{
|
||||
if (!spaceRoom->isSpace()) {
|
||||
return;
|
||||
}
|
||||
// If replacing a normal room message timeline make sure any edit is cancelled.
|
||||
if (m_currentRoom && !m_currentRoom->chatBoxEditId().isEmpty()) {
|
||||
m_currentRoom->setChatBoxEditId({});
|
||||
}
|
||||
// Save the chatbar text for the current room if any before switching
|
||||
if (m_currentRoom && m_chatDocumentHandler) {
|
||||
if (m_chatDocumentHandler->document()) {
|
||||
m_currentRoom->setSavedText(m_chatDocumentHandler->document()->textDocument()->toPlainText());
|
||||
}
|
||||
}
|
||||
m_lastCurrentRoom = std::exchange(m_currentRoom, spaceRoom);
|
||||
Q_EMIT currentRoomChanged();
|
||||
|
||||
if (!m_lastCurrentRoom) {
|
||||
Q_EMIT pushSpaceHome(spaceRoom);
|
||||
} else {
|
||||
Q_EMIT replaceSpaceHome(m_currentRoom);
|
||||
}
|
||||
|
||||
// Save last open room
|
||||
m_lastRoomConfig.writeEntry(Controller::instance().activeConnection()->userId(), spaceRoom->id());
|
||||
}
|
||||
|
||||
UriResolveResult RoomManager::visitUser(User *user, const QString &action)
|
||||
{
|
||||
if (action == "mention"_ls || action.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user