diff options
| author | Kevin Smith <git@kismith.co.uk> | 2010-05-14 22:11:54 (GMT) | 
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2010-05-14 22:11:54 (GMT) | 
| commit | 1f48a865bc052b12c3a156426bd1ebdd5955c74e (patch) | |
| tree | 3cf40b78dab6364a4d00f925f66e9a6cbe7b596f /Swift/QtUI/Roster/RosterModel.cpp | |
| parent | e10a0c0902b503bbffdc802aa238c8b6ac4fe210 (diff) | |
| download | swift-contrib-1f48a865bc052b12c3a156426bd1ebdd5955c74e.zip swift-contrib-1f48a865bc052b12c3a156426bd1ebdd5955c74e.tar.bz2  | |
Start roster groups expanded.
Resolves: #343
Diffstat (limited to 'Swift/QtUI/Roster/RosterModel.cpp')
| -rw-r--r-- | Swift/QtUI/Roster/RosterModel.cpp | 14 | 
1 files changed, 11 insertions, 3 deletions
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index d5b4002..00a032d 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -38,10 +38,15 @@ void RosterModel::setRoster(Roster* roster) {  }  void RosterModel::handleGroupAdded(GroupRosterItem* group) { -	view_->setExpanded(index(group), true); +	emit itemExpanded(index(group), group->isExpanded());  } -void RosterModel::handleChildrenChanged(GroupRosterItem* /*group*/) { +void RosterModel::handleChildrenChanged(GroupRosterItem* group) { +	foreach (RosterItem* item, group->getDisplayedChildren()) { +		GroupRosterItem* child = dynamic_cast<GroupRosterItem*>(item); +		if (!child) continue; +		emit itemExpanded(index(child), child->isExpanded()); +	}  	emit layoutChanged();  }							   @@ -49,7 +54,10 @@ void RosterModel::handleDataChanged(RosterItem* item) {  	Q_ASSERT(item);  	QModelIndex modelIndex = index(item);  	if (modelIndex.isValid()) { -		//emit itemExpanded(modelIndex, item->isExpanded()); +		GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(item); +		if (group) { +			emit itemExpanded(modelIndex, group->isExpanded()); +		}  		emit dataChanged(modelIndex, modelIndex);  	}  }  | 
 Swift