aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-10-31 17:40:11 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-31 14:58:56 -0700
commit8399d6f977170227c7f7dd0a57c34d0f9e01dd60 (patch)
tree1f7bd49cef1ef0a78a247e5856dabbb8291d25cd
parent1a4e69a3bba6c50d6b92f47cf673e7ccc2b770e9 (diff)
downloadsubsurface-8399d6f977170227c7f7dd0a57c34d0f9e01dd60.tar.gz
Repopulate method on LocationFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/models.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 88c2c4331..6f1ace9b9 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -2498,7 +2498,24 @@ LocationFilterModel *LocationFilterModel::instance()
void LocationFilterModel::repopulate()
{
-
+ QStringList list;
+ struct dive *dive;
+ int i = 0;
+ for_each_dive (i, dive)
+ {
+ QString location(dive->location);
+ if (!location.isEmpty() && !list.contains(location)) {
+ list.append(location);
+ }
+ }
+ qSort(list);
+ list << tr("No Location set");
+ setStringList(list);
+ delete[] checkState;
+ checkState = new bool[list.count()];
+ memset(checkState, false, list.count());
+ checkState[list.count() - 1] = false;
+ anyChecked = false;
}
bool LocationFilterModel::setData(const QModelIndex &index, const QVariant &value, int role)