+void BufferModel::switchToBuffer(const BufferId &bufferId) {
+ QModelIndex source_index = Client::networkModel()->bufferIndex(bufferId);
+ setCurrentIndex(mapFromSource(source_index));
+}
+
+void BufferModel::switchToBufferIndex(const QModelIndex &bufferIdx) {
+ // we accept indexes that directly belong to us or our parent - nothing else
+ if(bufferIdx.model() == this) {
+ setCurrentIndex(bufferIdx);
+ return;
+ }
+
+ if(bufferIdx.model() == sourceModel()) {
+ setCurrentIndex(mapFromSource(bufferIdx));
+ return;
+ }
+
+ qWarning() << "BufferModel::switchToBufferIndex(const QModelIndex &):" << bufferIdx << "does not belong to BufferModel or NetworkModel";
+}
+