diff --git a/qml/main.qml b/qml/main.qml
index 6f792a5d1..89b93b638 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -34,6 +34,16 @@ Kirigami.ApplicationWindow {
signal leaveRoom(string room);
signal openRoom(string room);
+ function loadInitialRoom() {
+ if (Config.openRoom) {
+ const room = Controller.activeConnection.room(Config.openRoom);
+ pageStack.push(roomPage, { 'currentRoom': room, });
+ } else {
+ // TODO create welcome page
+ }
+ }
+
+
function enterRoom(room) {
if (currentRoom != null) {
currentRoom = null;
@@ -41,6 +51,8 @@ Kirigami.ApplicationWindow {
}
var item = pageStack.push(roomPage, { 'currentRoom': room, });
currentRoom = room;
+ Config.openRoom = room.id;
+ Config.save();
return item;
}
}
@@ -102,6 +114,7 @@ Kirigami.ApplicationWindow {
pageStack.replace("qrc:/imports/NeoChat/Page/LoginPage.qml", {});
} else {
pageStack.replace(roomListComponent, {'activeConnection': Controller.activeConnection});
+ roomManager.loadInitialRoom();
}
}
diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg
index 0bae5ca7a..0a53f2ffb 100644
--- a/src/neochatconfig.kcfg
+++ b/src/neochatconfig.kcfg
@@ -9,7 +9,7 @@
-
+
diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp
index 86ab8c592..0cfebe8ad 100644
--- a/src/roomlistmodel.cpp
+++ b/src/roomlistmodel.cpp
@@ -21,8 +21,8 @@
RoomListModel::RoomListModel(QObject *parent)
: QAbstractListModel(parent)
{
- const auto collaposedSections = NeoChatConfig::collapsedSections();
- for (auto collapsedSection : collaposedSections) {
+ const auto collapsedSections = NeoChatConfig::collapsedSections();
+ for (auto collapsedSection : collapsedSections) {
m_categoryVisibility[collapsedSection] = false;
}
}
@@ -316,13 +316,13 @@ QString RoomListModel::categoryName(int section) const
void RoomListModel::setCategoryVisible(int category, bool visible)
{
beginResetModel();
- auto collaposedSections = NeoChatConfig::collapsedSections();
+ auto collapsedSections = NeoChatConfig::collapsedSections();
if (visible) {
- collaposedSections.removeAll(category);
+ collapsedSections.removeAll(category);
} else {
- collaposedSections.push_back(category);
+ collapsedSections.push_back(category);
}
- NeoChatConfig::setCollapsedSections(collaposedSections);
+ NeoChatConfig::setCollapsedSections(collapsedSections);
NeoChatConfig::self()->save();
m_categoryVisibility[category] = visible;