chatgui: save scroll/read position on app quit via aboutToQuit

Make saveChannelState() public, connect to QApplication::aboutToQuit so
state is persisted on SIGINT, tray quit, or any other shutdown.
This commit is contained in:
Evgeny committed 2026-07-24 03:24:54 +03:00
1 parent 1ac58854bb
commit 2ff2e66d5e
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -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() {
+1 -1
View File
@@ -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();
};