aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-10-31 16:28:51 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-31 14:58:55 -0700
commit30cf0ba79ae31086664fddbaf24cc0570b00eb1f (patch)
tree8e88ce61cc06d03d433d0e002d15d1a7e84a8f58
parente17fa41192da7dfde92f2bee451f7d67565c39f9 (diff)
downloadsubsurface-30cf0ba79ae31086664fddbaf24cc0570b00eb1f.tar.gz
Implemented the 'repopulate method' for BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/models.cpp18
1 files changed, 18 insertions, 0 deletions
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