X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=3e9783510bd9bd9fcc2aaa3616f256a480a3cf2d;hb=d5f5ce565bf61a020029f52c16fd3ea4f494d23e;hp=398f0a836600c8a64a2721f30b84d27a00635634;hpb=15d94f850d7e82b9f9f65ec162d9db13f750d23f;p=quassel.git diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 398f0a83..3e978351 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -920,10 +920,13 @@ void MainWin::setConnectedState() { wizard->show(); } else { - QtUiSettings s; - BufferId lastUsedBufferId(s.value("LastUsedBufferId").toInt()); - if(lastUsedBufferId.isValid()) - Client::bufferModel()->switchToBuffer(lastUsedBufferId); + // Monolithic always preselects last used buffer - Client only if the connection died + if(Client::coreConnection()->wasReconnect() || Quassel::runMode() == Quassel::Monolithic) { + QtUiSettings s; + BufferId lastUsedBufferId(s.value("LastUsedBufferId").toInt()); + if(lastUsedBufferId.isValid()) + Client::bufferModel()->switchToBuffer(lastUsedBufferId); + } } } @@ -976,7 +979,14 @@ void MainWin::disconnectedFromCore() { } } + // store last active buffer QtUiSettings s; + BufferId lastBufId = _bufferWidget->currentBuffer(); + if(lastBufId.isValid()) { + s.setValue("LastUsedBufferId", lastBufId.toInt()); + // clear the current selection + Client::bufferModel()->standardSelectionModel()->clearSelection(); + } restoreState(s.value("MainWinState").toByteArray()); setDisconnectedState(); } @@ -1302,6 +1312,14 @@ void MainWin::clientNetworkUpdated() { switch(net->connectionState()) { case Network::Initialized: action->setIcon(SmallIcon("network-connect")); + // if we have no currently selected buffer, jump to the first connecting statusbuffer + if(!bufferWidget()->currentBuffer().isValid()) { + QModelIndex idx = Client::networkModel()->networkIndex(net->networkId()); + if(idx.isValid()) { + BufferId statusBufferId = idx.data(NetworkModel::BufferIdRole).value(); + Client::bufferModel()->switchToBuffer(statusBufferId); + } + } break; case Network::Disconnected: action->setIcon(SmallIcon("network-disconnect"));