X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=48a6b8c4c31a777d04a4c3ea72b0b3cbe3f86b5d;hp=6d6792ca66a33c7cdec854000bf20408363e0c6b;hb=c4507cf512b6fd04e5c75a7ac00b9c2888fb646f;hpb=a9b3edc811552b39dafb8fb01699490e5bcfb014 diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 6d6792ca..48a6b8c4 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -132,10 +132,7 @@ void BufferItem::attachIrcChannel(IrcChannel *ircChannel) { void BufferItem::ircChannelDestroyed() { emit dataChanged(); - for(int i = 0; i < childCount(); i++) { - emit childDestroyed(i); - removeChild(i); - } + removeAllChilds(); } QString BufferItem::bufferName() const { @@ -203,6 +200,13 @@ void BufferItem::removeUserFromCategory(IrcUser *ircUser) { } void BufferItem::userModeChanged(IrcUser *ircUser) { + Q_ASSERT(_ircChannel); + + UserCategoryItem *categoryItem; + int categoryId = UserCategoryItem::categoryFromModes(_ircChannel->userModes(ircUser)); + if((categoryItem = qobject_cast(childById(qHash(categoryId))))) + return; // already in the right category; + removeUserFromCategory(ircUser); addUserToCategory(ircUser); } @@ -319,7 +323,7 @@ UserCategoryItem::UserCategoryItem(int category, AbstractTreeItem *parent) : PropertyMapItem(QStringList() << "categoryId", parent), _category(category) { - connect(this, SIGNAL(childDestroyed(int)), + connect(this, SIGNAL(childRemoved(int)), this, SLOT(checkNoChilds())); }