X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fbuffer.cpp;h=b533dd6c14e89a1468845e38b0d852e7196238f3;hb=d47cd9b56ba10dc6e20baeabbd2b51305824b8c2;hp=304d9ecb72c6e65af36d05c371650335a55ebfef;hpb=7795adca52f35204f8c354da6fcc5d8e8ee35531;p=quassel.git diff --git a/src/client/buffer.cpp b/src/client/buffer.cpp index 304d9ecb..b533dd6c 100644 --- a/src/client/buffer.cpp +++ b/src/client/buffer.cpp @@ -23,6 +23,7 @@ #include "client.h" #include "ircchannel.h" +#include "nickmodel.h" #include "util.h" @@ -30,7 +31,7 @@ Buffer::Buffer(BufferInfo bufferid, QObject *parent) : QObject(parent), _bufferInfo(bufferid), _active(false), - _ircChannel(0) + _ircChannel(0), _nickModel(0) { if(bufferid.buffer().isEmpty()) _type = StatusType; @@ -39,6 +40,7 @@ Buffer::Buffer(BufferInfo bufferid, QObject *parent) else _type = QueryType; + _nickModel = new NickModel(0, this); /* QSettings s; s.beginGroup(QString("GUI/BufferStates/%1/%2").arg(netname).arg(bufname)); @@ -105,12 +107,12 @@ QVariantMap Buffer::nickList() const { } QString Buffer::topic() const { - // FIXME check if we got a networkInfo() object + if(ircChannel()) return ircChannel()->topic(); return QString(); } QString Buffer::ownNick() const { - // FIXME check if we got a networkInfo() object + // FIXME if(ircChannel()) return ircChannel()->ownNick(); return QString(); } @@ -149,6 +151,10 @@ void Buffer::processUserInput(QString msg) { emit userInput(_bufferInfo, msg); } +NickModel *Buffer::nickModel() const { + return _nickModel; +} + IrcChannel *Buffer::ircChannel() const { return _ircChannel; } @@ -156,21 +162,18 @@ IrcChannel *Buffer::ircChannel() const { void Buffer::setIrcChannel(IrcChannel *ircchan) { if(_ircChannel) { disconnect(_ircChannel, 0, this, 0); - // TODO: remove model etc } _ircChannel = ircchan; if(_ircChannel) { + emit topicSet(_ircChannel->topic()); + connect(_ircChannel, SIGNAL(topicSet(QString)), this, SIGNAL(topicSet(QString))); connect(_ircChannel, SIGNAL(destroyed()), this, SLOT(setIrcChannel())); } + _nickModel->setIrcChannel(ircChannel()); } // no longer needed // back reference: -// void Buffer::setTopic(QString t) { -// _topic = t; -// emit topicSet(t); -// emit bufferUpdated(this); -// } // void Buffer::addNick(QString nick, QVariantMap props) { // if(nick == ownNick()) setActive(true);