-void Client::layoutMsg() {
- if(layoutQueue.count()) {
- Buffer *b = layoutQueue.takeFirst(); // TODO make this the current buffer
- if(b->layoutMsg())
- layoutQueue.append(b); // Buffer has more messages in its queue --> Round Robin
+void Client::setBufferLastSeenMsg(BufferId id, const MsgId &msgId) {
+ if(!bufferSyncer())
+ return;
+ bufferSyncer()->requestSetLastSeenMsg(id, msgId);
+}
+
+void Client::removeBuffer(BufferId id) {
+ if(!bufferSyncer()) return;
+ bufferSyncer()->requestRemoveBuffer(id);
+}
+
+void Client::bufferRemoved(BufferId bufferId) {
+ // select a sane buffer (status buffer)
+ /* we have to manually select a buffer because otherwise inconsitent changes
+ * to the model might occur:
+ * the result of a buffer removal triggers a change in the selection model.
+ * the newly selected buffer might be a channel that hasn't been selected yet
+ * and a new nickview would be created (which never heard of the "rowsAboutToBeRemoved").
+ * this new view (and/or) its sort filter will then only receive a "rowsRemoved" signal.
+ */
+ QModelIndex current = bufferModel()->currentIndex();
+ if(current.data(NetworkModel::BufferIdRole).value<BufferId>() == bufferId) {
+ bufferModel()->setCurrentIndex(current.sibling(0,0));