From 30cf0ba79ae31086664fddbaf24cc0570b00eb1f Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 31 Oct 2014 16:28:51 -0200 Subject: Implemented the 'repopulate method' for BuddyFilter Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index ff92fda46..4f13d3b12 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -2375,6 +2375,24 @@ Qt::ItemFlags BuddyFilterModel::flags(const QModelIndex &index) const void BuddyFilterModel::repopulate() { + QStringList list; + struct dive *dive; + int i = 0; + for_each_dive (i, dive) + { + QString buddy(dive->buddy); + if (!list.contains(buddy)) { + list.append(buddy); + } + } + setStringList(list); + list << tr("No Buddies"); + setStringList(list); + delete[] checkState; + checkState = new bool[list.count()]; + memset(checkState, false, list.count()); + checkState[list.count() - 1] = false; + anyChecked = false; } QVariant BuddyFilterModel::data(const QModelIndex &index, int role) const -- cgit v1.2.3-70-g09d2