From 8fa77ff7cf38f084707d9d0d89c695d697499bb5 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Date: Sun, 17 May 2015 16:45:51 -0300
Subject: [PATCH 08/10] Implemented the data method for location information

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
---
 qt-ui/locationinformation.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 38c1492..22f959c 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -18,7 +18,15 @@ int LocationInformationModel::rowCount(const QModelIndex &parent) const
 
 QVariant LocationInformationModel::data(const QModelIndex &index, int role) const
 {
+	if (!index.isValid())
+		return QVariant();
+	struct dive_site *ds = get_dive_site(index.row());
 
+	switch(role) {
+		case Qt::DisplayRole : return qPrintable(ds->name);
+	}
+
+	return QVariant();
 }
 
 void LocationInformationModel::update()
-- 
2.3.2 (Apple Git-55)

