summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-07-03 10:42:32 (GMT)
committerSwift Review <review@swift.im>2014-07-09 13:29:35 (GMT)
commit43fce94494307d1b3a866f5781528c94df7e5bca (patch)
tree13b26494ae618047e0eecd7aa35fad850a58f34c /Swift/Controllers
parent8e0e67a24bfa8d3dcdeef2f177449c2a35901b99 (diff)
downloadswift-43fce94494307d1b3a866f5781528c94df7e5bca.zip
swift-43fce94494307d1b3a866f5781528c94df7e5bca.tar.bz2
Honour 'show offline contacts' toggle when exiting roster search filter
Test-Information: Enter search term and check that toggling "show offline contacts" resets the QtFilterWidget and that the roster list is representative of the "show offline contacts" state. Ensure that "show offline contacts" behaves normally when no search term has been entered. Toggle "show offline contacts" several times to make sure it remains in-sync. Change-Id: Id92a6a65b8f38cf6806f22c175514283e05affa9
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Roster/Roster.cpp9
-rw-r--r--Swift/Controllers/Roster/Roster.h6
2 files changed, 12 insertions, 3 deletions
diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp
index 44cf03d..4dbc453 100644
--- a/Swift/Controllers/Roster/Roster.cpp
+++ b/Swift/Controllers/Roster/Roster.cpp
@@ -197,7 +197,13 @@ void Roster::applyOnAllItems(const RosterItemOperation& operation) {
filterAll();
}
-void Roster::removeFilter(RosterFilter *filter) {
+void Roster::addFilter(RosterFilter* filter) {
+ filters_.push_back(filter);
+ filterAll();
+ onFilterAdded(filter);
+}
+
+void Roster::removeFilter(RosterFilter* filter) {
for (unsigned int i = 0; i < filters_.size(); i++) {
if (filters_[i] == filter) {
filters_.erase(filters_.begin() + i);
@@ -205,6 +211,7 @@ void Roster::removeFilter(RosterFilter *filter) {
}
}
filterAll();
+ onFilterRemoved(filter);
}
void Roster::filterContact(ContactRosterItem* contact, GroupRosterItem* group) {
diff --git a/Swift/Controllers/Roster/Roster.h b/Swift/Controllers/Roster/Roster.h
index b60eafa..9956cb9 100644
--- a/Swift/Controllers/Roster/Roster.h
+++ b/Swift/Controllers/Roster/Roster.h
@@ -38,14 +38,16 @@ class Roster {
void applyOnItems(const RosterItemOperation& operation);
void applyOnAllItems(const RosterItemOperation& operation);
void applyOnItem(const RosterItemOperation& operation, const JID& jid);
- void addFilter(RosterFilter *filter) {filters_.push_back(filter);filterAll();}
- void removeFilter(RosterFilter *filter);
+ void addFilter(RosterFilter* filter);
+ void removeFilter(RosterFilter* filter);
GroupRosterItem* getRoot();
std::vector<RosterFilter*> getFilters() {return filters_;}
boost::signal<void (GroupRosterItem*)> onChildrenChanged;
boost::signal<void (GroupRosterItem*)> onGroupAdded;
boost::signal<void (RosterItem*)> onDataChanged;
boost::signal<void (JID&)> onVCardUpdateRequested;
+ boost::signal<void (RosterFilter* filter)> onFilterAdded;
+ boost::signal<void (RosterFilter* filter)> onFilterRemoved;
GroupRosterItem* getGroup(const std::string& groupName);
void setBlockingSupported(bool isSupported);