Browse Source

chatgui: fix dual selection highlight and missing online count

- channellist.cpp: selectionChanged guard now checks currentIndex().row()
  is within model->rowCount() to avoid re-selecting stale index after
  model clear, which caused both channels to stay blue when switching.
- chat_sync.c: cs_refresh_channels now posts CHANNEL_PEERS_ONLINE
  for all channels after loading, fixing online count showing only
  on the last connected group.
topo_upd
Evgeny 2 months ago
parent
commit
4ec930c8f0
  1. 3
      tools/chatgui/src/channellist.cpp
  2. 3
      tools/chatgui/transport/chat_sync.c

3
tools/chatgui/src/channellist.cpp

@ -56,7 +56,8 @@ protected:
} }
void selectionChanged(const QItemSelection& sel, const QItemSelection& desel) override { void selectionChanged(const QItemSelection& sel, const QItemSelection& desel) override {
QListView::selectionChanged(sel, desel); QListView::selectionChanged(sel, desel);
if (selectionModel() && !selectionModel()->hasSelection() && currentIndex().isValid()) if (selectionModel() && !selectionModel()->hasSelection() && currentIndex().isValid()
&& currentIndex().row() < model()->rowCount())
selectionModel()->select(currentIndex(), QItemSelectionModel::ClearAndSelect); selectionModel()->select(currentIndex(), QItemSelectionModel::ClearAndSelect);
} }

3
tools/chatgui/transport/chat_sync.c

@ -508,6 +508,9 @@ static void cs_refresh_channels(struct chat_sync* cs) {
memcpy(&cs->channels[i].peer_ids[j], peer_buf + 2 + j * 8, 8); memcpy(&cs->channels[i].peer_ids[j], peer_buf + 2 + j * 8, 8);
} }
} }
for (int i = 0; i < cs->channel_count; i++)
cs_post_channel_online(cs, cs->channels[i].channel_id);
} }
static void refresh_timer_cb(void* arg) { static void refresh_timer_cb(void* arg) {

Loading…
Cancel
Save