diff options
Diffstat (limited to 'Swift/Controllers/Roster/GroupRosterItem.cpp')
| -rw-r--r-- | Swift/Controllers/Roster/GroupRosterItem.cpp | 25 | 
1 files changed, 20 insertions, 5 deletions
| diff --git a/Swift/Controllers/Roster/GroupRosterItem.cpp b/Swift/Controllers/Roster/GroupRosterItem.cpp index f0a377a..2a7bfa5 100644 --- a/Swift/Controllers/Roster/GroupRosterItem.cpp +++ b/Swift/Controllers/Roster/GroupRosterItem.cpp @@ -12,7 +12,7 @@  namespace Swift { -GroupRosterItem::GroupRosterItem(const std::string& name, GroupRosterItem* parent, bool sortByStatus) : RosterItem(name, parent), sortByStatus_(sortByStatus) { +GroupRosterItem::GroupRosterItem(const std::string& name, GroupRosterItem* parent, bool sortByStatus) : RosterItem(name, parent), sortByStatus_(sortByStatus), manualSort_(false) {  	expanded_ = true;  } @@ -20,6 +20,20 @@ GroupRosterItem::~GroupRosterItem() {  } +void GroupRosterItem::setManualSort(const std::string& manualSortValue) { +	manualSort_ = true; +	bool changed = manualSortValue_ != manualSortValue; +	manualSortValue_ = manualSortValue; +	if (changed) { +		onChildrenChanged(); +		onDataChanged(); +	} +} + +const std::string& GroupRosterItem::getSortableDisplayName() const { +	return manualSort_ ? manualSortValue_ : RosterItem::getSortableDisplayName(); +} +  bool GroupRosterItem::isExpanded() const {  	return expanded_;  } @@ -75,7 +89,7 @@ void GroupRosterItem::removeAll() {  				delete group;  			}  		} -		it++; +		++it;  	}  	children_.clear();  } @@ -103,7 +117,7 @@ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) {  				removed = groupRemoved;  			}  		} -		it++; +		++it;  	}  	onChildrenChanged();  	onDataChanged(); @@ -122,7 +136,7 @@ GroupRosterItem* GroupRosterItem::removeGroupChild(const std::string& groupName)  			it = children_.erase(it);  			continue;  		} -		it++; +		++it;  	}  	onChildrenChanged();  	onDataChanged(); @@ -210,7 +224,8 @@ void GroupRosterItem::handleChildrenChanged(GroupRosterItem* group) {  	} else {  		displayedChildren_.erase(std::remove(displayedChildren_.begin(), displayedChildren_.end(), group), displayedChildren_.end());  	} -	if (oldSize != getDisplayedChildren().size()) { + +	if (oldSize != getDisplayedChildren().size() || sortDisplayed()) {  		onChildrenChanged();  		onDataChanged();  	} | 
 Swift
 Swift