summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-05-26 16:29:44 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-05-26 17:24:07 (GMT)
commite497af7cd28d2cf58d81ed8fd351b5d5ccfa56a4 (patch)
treee2fbb5b2c5f4b5fe3aa884bf551379ac2c6478c8 /Swiften/Roster
parentc77cbf3d4cdcfce47639006f023715483f6f0dc1 (diff)
downloadswift-e497af7cd28d2cf58d81ed8fd351b5d5ccfa56a4.zip
swift-e497af7cd28d2cf58d81ed8fd351b5d5ccfa56a4.tar.bz2
Don't let roster groups open and close on their own.
Resolves: #368
Diffstat (limited to 'Swiften/Roster')
-rw-r--r--Swiften/Roster/GroupRosterItem.cpp12
-rw-r--r--Swiften/Roster/Roster.cpp4
2 files changed, 9 insertions, 7 deletions
diff --git a/Swiften/Roster/GroupRosterItem.cpp b/Swiften/Roster/GroupRosterItem.cpp
index 7ce57d2..e5490e2 100644
--- a/Swiften/Roster/GroupRosterItem.cpp
+++ b/Swiften/Roster/GroupRosterItem.cpp
@@ -24,6 +24,12 @@ bool GroupRosterItem::isExpanded() const {
return expanded_;
}
+/**
+ This has no effect, and is only used by the UI.
+ If reTransmit is specified, dataChanged will be emitted on a change -
+ This may be undesireable if called from the UI, so you can use reTransmit=false
+ to avoid a loop in this case.
+ */
void GroupRosterItem::setExpanded(bool expanded) {
expanded_ = expanded;
}
@@ -33,7 +39,6 @@ const std::vector<RosterItem*>& GroupRosterItem::getChildren() const {
}
const std::vector<RosterItem*>& GroupRosterItem::getDisplayedChildren() const {
-// std::cout << "Fetching displayed children for " << getDisplayName() << " and found " << displayedChildren_.size() << std::endl;
return displayedChildren_;
}
@@ -110,7 +115,6 @@ bool GroupRosterItem::itemLessThan(const RosterItem* left, const RosterItem* rig
if (rightContact) {
return true;
}
-// std::cout << "Comparing groups " << left->getSortableDisplayName() << " and " << right->getSortableDisplayName() << std::endl;
return left->getSortableDisplayName() < right->getSortableDisplayName();
}
}
@@ -131,8 +135,8 @@ void GroupRosterItem::setDisplayed(RosterItem* item, bool displayed) {
} else {
displayedChildren_.erase(std::remove(displayedChildren_.begin(), displayedChildren_.end(), item), displayedChildren_.end());
}
- onDataChanged();
onChildrenChanged();
+ onDataChanged();
}
void GroupRosterItem::handleDataChanged(RosterItem* /*item*/) {
@@ -158,8 +162,8 @@ void GroupRosterItem::handleChildrenChanged(GroupRosterItem* group) {
displayedChildren_.erase(std::remove(displayedChildren_.begin(), displayedChildren_.end(), group), displayedChildren_.end());
}
if (oldSize != getDisplayedChildren().size()) {
- onDataChanged();
onChildrenChanged();
+ onDataChanged();
}
}
diff --git a/Swiften/Roster/Roster.cpp b/Swiften/Roster/Roster.cpp
index caf2b5e..a83ea89 100644
--- a/Swiften/Roster/Roster.cpp
+++ b/Swiften/Roster/Roster.cpp
@@ -23,6 +23,7 @@ namespace Swift {
Roster::Roster() {
root_ = new GroupRosterItem("Dummy-Root", NULL);
+ root_->onChildrenChanged.connect(boost::bind(&Roster::handleChildrenChanged, this, root_));
}
Roster::~Roster() {
@@ -52,7 +53,6 @@ GroupRosterItem* Roster::getGroup(const String& groupName) {
}
GroupRosterItem* group = new GroupRosterItem(groupName, root_);
root_->addChild(group);
-// std::cout << "Added " << groupName << " to root" << std::endl;
group->onChildrenChanged.connect(boost::bind(&Roster::handleChildrenChanged, this, group));
group->onDataChanged.connect(boost::bind(&Roster::handleDataChanged, this, group));
return group;
@@ -155,9 +155,7 @@ void Roster::filterContact(ContactRosterItem* contact, GroupRosterItem* group) {
}
group->setDisplayed(contact, filters_.size() == 0 || !hide);
int newDisplayedSize = group->getDisplayedChildren().size();
-// std::cout << ", new size = " << newDisplayedSize << std::endl;
if (oldDisplayedSize == 0 && newDisplayedSize > 0) {
-// std::cout << "Newly created" << std::endl;
onGroupAdded(group);
}
}