-void BufferModel::synchronizeSelectionModel(MappedSelectionModel *selectionModel) {
- _selectionModelSynchronizer.addSelectionModel(selectionModel);
+void BufferModel::newNetwork(NetworkId id) {
+ const Network *net = Client::network(id);
+ Q_ASSERT(net);
+ connect(net, SIGNAL(connectionStateSet(Network::ConnectionState)),
+ this, SLOT(networkConnectionChanged(Network::ConnectionState)));
+}
+
+void BufferModel::networkConnectionChanged(Network::ConnectionState state) {
+ switch(state) {
+ case Network::Connecting:
+ case Network::Initializing:
+ if(currentIndex().isValid())
+ return;
+ {
+ Network *net = qobject_cast<Network *>(sender());
+ Q_ASSERT(net);
+ setCurrentIndex(mapFromSource(Client::networkModel()->networkIndex(net->networkId())));
+ }
+ break;
+ default:
+ return;
+ }