X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=2c2a03823b635942a6a67eaf2de190ce4ec52cce;hp=bec3edf1496bcf1e434b675572c22ceb16f54599;hb=d4b7af7050bac6f894a05bff4eab1becaffa27ce;hpb=600a5683c1a8e679b7b63a00d5b1211b5b9771c7 diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index bec3edf1..2c2a0382 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -27,13 +27,11 @@ #include "signalproxy.h" #include "network.h" #include "ircchannel.h" -#include "ircuser.h" #include "buffersettings.h" #include "util.h" // get rid of this (needed for isChannelName) - /***************************************** * Fancy Buffer Items *****************************************/ @@ -70,10 +68,11 @@ bool BufferItem::isActive() const { return qobject_cast(parent())->isActive(); } -bool BufferItem::setActivityLevel(Buffer::ActivityLevel level) { - _activity = level; - emit dataChanged(); - return true; +void BufferItem::setActivityLevel(Buffer::ActivityLevel level) { + if(_activity != level) { + _activity = level; + emit dataChanged(); + } } void BufferItem::updateActivityLevel(Buffer::ActivityLevel level) { @@ -107,7 +106,8 @@ QVariant BufferItem::data(int column, int role) const { bool BufferItem::setData(int column, const QVariant &value, int role) { switch(role) { case NetworkModel::BufferActivityRole: - return setActivityLevel((Buffer::ActivityLevel)value.toInt()); + setActivityLevel((Buffer::ActivityLevel)value.toInt()); + return true; default: return PropertyMapItem::setData(column, value, role); } @@ -136,10 +136,8 @@ void BufferItem::attachIrcChannel(IrcChannel *ircChannel) { connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)), this, SLOT(userModeChanged(IrcUser *))); - if(!ircChannel->ircUsers().isEmpty()) { - qWarning() << "Channel" << ircChannel->name() << "has already users which is quite surprising :)"; + if(!ircChannel->ircUsers().isEmpty()) join(ircChannel->ircUsers()); - } emit dataChanged(); } @@ -254,23 +252,23 @@ void BufferItem::removeUserFromCategory(IrcUser *ircUser) { UserCategoryItem *categoryItem = 0; for(int i = 0; i < childCount(); i++) { categoryItem = qobject_cast(child(i)); - if(success = categoryItem->removeUser(ircUser)) { + if((success = categoryItem->removeUser(ircUser))) { if(categoryItem->childCount() == 0) removeChild(i); break; } } - if(!success) { - qDebug() << "didn't find User:" << ircUser << qHash(ircUser); - qDebug() << "==== Childlist for Item:" << this << id() << bufferName() << "===="; - for(int i = 0; i < childCount(); i++) { - categoryItem = qobject_cast(child(i)); - categoryItem->dumpChildList(); - } - qDebug() << "==== End Of Childlist for Item:" << this << id() << bufferName() << "===="; - } - Q_ASSERT(success); +// if(!success) { +// qDebug() << "didn't find User:" << ircUser << qHash(ircUser); +// qDebug() << "==== Childlist for Item:" << this << id() << bufferName() << "===="; +// for(int i = 0; i < childCount(); i++) { +// categoryItem = qobject_cast(child(i)); +// categoryItem->dumpChildList(); +// } +// qDebug() << "==== End Of Childlist for Item:" << this << id() << bufferName() << "===="; +// } +// Q_ASSERT(success); } void BufferItem::userModeChanged(IrcUser *ircUser) { @@ -312,6 +310,11 @@ QString BufferItem::toolTip(int column) const { toolTip.append(tr("Topic: %1").arg(_topic)); } } + if(_ircChannel) { + QString channelMode = _ircChannel->channelModeString(); // channelModeString is compiled on the fly -> thus cache the result + if(!channelMode.isEmpty()) + toolTip.append(tr("Mode: %1").arg(channelMode)); + } } else { toolTip.append(tr("Not active
Double-click to join")); } @@ -564,14 +567,6 @@ bool IrcUserItem::isActive() const { return false; } -IrcUser *IrcUserItem::ircUser() { - return _ircUser; -} - -quint64 IrcUserItem::id() const { - return _id; -} - QVariant IrcUserItem::data(int column, int role) const { switch(role) { case NetworkModel::ItemActiveRole: