As automatic buffer selection on startup clears the activity,
this will hopefully be the best solution without another clientsetting..
All versions will select the statusbuffer of a connecting network if
no valid buffer is currently selected.
Monolithic version will always start with the last selected buffer.
There is just no activity until next start.
Client will now only preselect the last buffer if the connection was not
closed by the user.
If the connection was closed manually or after fresh client start,
the statusbuffer of some connected network will be shown.
_wantReconnect(false),
_progressMinimum(0),
_progressMaximum(-1),
_wantReconnect(false),
_progressMinimum(0),
_progressMaximum(-1),
+ _progressValue(-1),
+ _wasReconnect(false),
+ _requestedDisconnect(false)
{
qRegisterMetaType<ConnectionState>("CoreConnection::ConnectionState");
}
{
qRegisterMetaType<ConnectionState>("CoreConnection::ConnectionState");
}
void CoreConnection::coreSocketDisconnected() {
// qDebug() << Q_FUNC_INFO;
void CoreConnection::coreSocketDisconnected() {
// qDebug() << Q_FUNC_INFO;
+ _wasReconnect = !_requestedDisconnect;
resetConnection(true);
// FIXME handle disconnects gracefully
}
resetConnection(true);
// FIXME handle disconnects gracefully
}
}
void CoreConnection::disconnectFromCore() {
}
void CoreConnection::disconnectFromCore() {
+ _requestedDisconnect = true;
disconnectFromCore(QString(), false); // requested disconnect, so don't try to reconnect
}
disconnectFromCore(QString(), false); // requested disconnect, so don't try to reconnect
}
if(!wantReconnect)
_reconnectTimer.stop();
if(!wantReconnect)
_reconnectTimer.stop();
+ _wasReconnect = wantReconnect; // store if disconnect was requested
+
if(errorString.isEmpty())
emit connectionError(tr("Disconnected"));
else
if(errorString.isEmpty())
emit connectionError(tr("Disconnected"));
else
_socket->deleteLater();
_socket = 0;
}
_socket->deleteLater();
_socket = 0;
}
+ _requestedDisconnect = false;
_blockSize = 0;
_coreMsgBuffer.clear();
_blockSize = 0;
_coreMsgBuffer.clear();
inline int progressValue() const;
inline QString progressText() const;
inline int progressValue() const;
inline QString progressText() const;
+ //! Check if we consider the last connect as reconnect
+ inline bool wasReconnect() const { return _wasReconnect; }
+
#ifdef HAVE_SSL
inline const QSslSocket *sslSocket() const;
#endif
#ifdef HAVE_SSL
inline const QSslSocket *sslSocket() const;
#endif
QString _progressText;
QString _coreInfoString(const QVariantMap &);
QString _progressText;
QString _coreInfoString(const QVariantMap &);
+ bool _wasReconnect;
+ bool _requestedDisconnect;
inline CoreAccountModel *accountModel() const;
inline CoreAccountModel *accountModel() const;
- 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);
+ }
+ // store last active buffer
- BufferId lastBufId = Client::bufferModel()->currentBuffer();
+ BufferId lastBufId = _bufferWidget->currentBuffer();
if(lastBufId.isValid()) {
s.setValue("LastUsedBufferId", lastBufId.toInt());
if(lastBufId.isValid()) {
s.setValue("LastUsedBufferId", lastBufId.toInt());
+ // clear the current selection
Client::bufferModel()->standardSelectionModel()->clearSelection();
}
restoreState(s.value("MainWinState").toByteArray());
Client::bufferModel()->standardSelectionModel()->clearSelection();
}
restoreState(s.value("MainWinState").toByteArray());
switch(net->connectionState()) {
case Network::Initialized:
action->setIcon(SmallIcon("network-connect"));
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<BufferId>();
+ Client::bufferModel()->switchToBuffer(statusBufferId);
+ }
+ }
break;
case Network::Disconnected:
action->setIcon(SmallIcon("network-disconnect"));
break;
case Network::Disconnected:
action->setIcon(SmallIcon("network-disconnect"));
_chatViews.take(bufferId);
}
_chatViews.take(bufferId);
}
+/*
+ Switching to first buffer is now handled in MainWin::clientNetworkUpdated()
+
void AbstractBufferContainer::rowsInserted(const QModelIndex &parent, int start, int end) {
Q_UNUSED(end)
void AbstractBufferContainer::rowsInserted(const QModelIndex &parent, int start, int end) {
Q_UNUSED(end)
setCurrentBuffer(id);
}
}
setCurrentBuffer(id);
}
}
void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
Q_UNUSED(previous)
void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
Q_UNUSED(previous)
protected slots:
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
protected slots:
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
- virtual void rowsInserted(const QModelIndex &parent, int start, int end);
//! Show the given chat view
/** This method is called when the given chat view should be displayed. Use this e.g. for
//! Show the given chat view
/** This method is called when the given chat view should be displayed. Use this e.g. for