X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fabstractbuffercontainer.cpp;h=8fa435139eeb8dd684a9bbae71e7a123ee1828cd;hp=a12b0315ac205c25c8a7acf23f7aaaff4cb0882e;hb=86bd6b1ffb870e65af6d830a2ea16471c348ed5a;hpb=e1b6d538b7c4cc279f9218614e23adb5d8a81fe5 diff --git a/src/uisupport/abstractbuffercontainer.cpp b/src/uisupport/abstractbuffercontainer.cpp index a12b0315..8fa43513 100644 --- a/src/uisupport/abstractbuffercontainer.cpp +++ b/src/uisupport/abstractbuffercontainer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel IRC Team * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -19,8 +19,8 @@ ***************************************************************************/ #include "abstractbuffercontainer.h" -#include "buffer.h" #include "client.h" +#include "clientbacklogmanager.h" #include "networkmodel.h" AbstractBufferContainer::AbstractBufferContainer(QWidget *parent) @@ -32,7 +32,6 @@ AbstractBufferContainer::AbstractBufferContainer(QWidget *parent) AbstractBufferContainer::~AbstractBufferContainer() { } - void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) { Q_ASSERT(model()); if(!parent.isValid()) { @@ -60,7 +59,6 @@ void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, in } void AbstractBufferContainer::removeBuffer(BufferId bufferId) { - if(Client::buffer(bufferId)) Client::buffer(bufferId)->setVisible(false); if(!_chatViews.contains(bufferId)) return; @@ -74,30 +72,32 @@ void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const Q if(newBufferId != oldBufferId) { setCurrentBuffer(newBufferId); emit currentChanged(newBufferId); + emit currentChanged(current); } } void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) { - AbstractChatView *chatView = 0; - Buffer *prevBuffer = Client::buffer(currentBuffer()); - if(prevBuffer) prevBuffer->setVisible(false); + BufferId prevBufferId = currentBuffer(); + if(prevBufferId.isValid() && _chatViews.contains(prevBufferId)) { + MsgId msgId = _chatViews.value(prevBufferId)->lastMsgId(); + Client::setBufferLastSeenMsg(prevBufferId, msgId); + if(autoSetMarkerLine()) + Client::setBufferMarkerLine(prevBufferId, msgId); + } - Buffer *buf; - if(!bufferId.isValid() || !(buf = Client::buffer(bufferId))) { - if(bufferId.isValid()) - qWarning() << "AbstractBufferContainer::setBuffer(BufferId): Can't show unknown Buffer:" << bufferId; + if(!bufferId.isValid()) { _currentBuffer = 0; showChatView(0); return; } - if(_chatViews.contains(bufferId)) { - chatView = _chatViews[bufferId]; - } else { - chatView = createChatView(bufferId); - _chatViews[bufferId] = chatView; - } + + if(!_chatViews.contains(bufferId)) + _chatViews[bufferId] = createChatView(bufferId); + _currentBuffer = bufferId; showChatView(bufferId); - buf->setVisible(true); + Client::networkModel()->clearBufferActivity(bufferId); + Client::setBufferLastSeenMsg(bufferId, _chatViews[bufferId]->lastMsgId()); + Client::backlogManager()->checkForBacklog(bufferId); setFocus(); }