diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index d15811b1..9c2b5250 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -229,6 +229,8 @@ void MainWindow::setupConnects() { m_channelList->setChannelUnreadCount(channelId, m_db->getUnreadCount(channelId, lastReadMsgId)); }); + + connect(qApp, &QApplication::aboutToQuit, m_messageList, &MessageList::saveChannelState); } void MainWindow::setupTray() { diff --git a/tools/chatgui/src/messagelist.h b/tools/chatgui/src/messagelist.h index 0ad6835f..2091061a 100644 --- a/tools/chatgui/src/messagelist.h +++ b/tools/chatgui/src/messagelist.h @@ -18,6 +18,7 @@ public: void loadChannel(const QString& channelId); void refresh(); + void saveChannelState(); void addMessage(const QString& channelId, quint64 authorNodeId, const QByteArray& content, qint64 timestamp); @@ -38,7 +39,6 @@ private: qint64 m_savedTopMsgId = 0; bool m_wasAtBottom = false; - void saveChannelState(); void restoreScrollPosition(const QString& channelId); void updateReadPosition(); };