Fix room switch so that if there is no saved text the user ends up with an empty chatbar
This commit is contained in:
@@ -399,12 +399,7 @@ void ModelTest::testCompletionModel()
|
|||||||
tester->setUseFetchMore(true);
|
tester->setUseFetchMore(true);
|
||||||
model->setRoom(room);
|
model->setRoom(room);
|
||||||
model->setAutoCompletionType(CompletionModel::Room);
|
model->setAutoCompletionType(CompletionModel::Room);
|
||||||
<<<<<<< HEAD
|
|
||||||
model->setText(u"foo"_s, u"#foo"_s);
|
|
||||||
auto roomListModel = new RoomListModel(this);
|
auto roomListModel = new RoomListModel(this);
|
||||||
=======
|
|
||||||
auto roomListModel = new RoomListModel();
|
|
||||||
>>>>>>> da60b8068 (Fix merge issues)
|
|
||||||
roomListModel->setConnection(connection);
|
roomListModel->setConnection(connection);
|
||||||
model->setRoomListModel(roomListModel);
|
model->setRoomListModel(roomListModel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,14 @@ ChatBarMessageContentModel::ChatBarMessageContentModel(QObject *parent)
|
|||||||
addAttachment(QUrl(m_room->cacheForType(m_type)->attachmentPath()));
|
addAttachment(QUrl(m_room->cacheForType(m_type)->attachmentPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearModel();
|
||||||
|
|
||||||
const auto textSections = m_room->cacheForType(m_type)->text().split(u"\n\n"_s);
|
const auto textSections = m_room->cacheForType(m_type)->text().split(u"\n\n"_s);
|
||||||
if (textSections.length() == 1 && textSections[0].isEmpty()) {
|
if (textSections.length() == 1 && textSections[0].isEmpty()) {
|
||||||
|
initializeModel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearModel();
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
for (const auto §ion : textSections) {
|
for (const auto §ion : textSections) {
|
||||||
const auto type = MessageComponentType::typeForString(section);
|
const auto type = MessageComponentType::typeForString(section);
|
||||||
|
|||||||
Reference in New Issue
Block a user