Merge branch 'master' into locationlistview
[situare] / src / ui / locationlistitem.cpp
index b0112e3..fb8306b 100644 (file)
@@ -12,10 +12,6 @@ LocationListItem::LocationListItem()
     qDebug() << __PRETTY_FUNCTION__;
 
     setSubitemTextWidth(LOCATION_SUBITEM_TEXT_MAX_WIDTH);
-    addSubItem(QString("Hei pitka teksti hep hep hep hep hep hep hep hep hep hep hep hep"),
-               QPixmap(":/res/images/clock.png"));
-    addSubItem(QString("Hep"));
-    addSubItem(QString("Jep"), QPixmap(":/res/images/compass.png"));
 }
 
 GeoCoordinate LocationListItem::coordinates()
@@ -36,6 +32,26 @@ void LocationListItem::setLocationData(const Location &location)
 {
     m_location = location;
 
-    setName(shortenText("blaah bavlsdfasdfhldsaf dsafldsaf ldsa lfadsl fl sadf",
-                        ITEM_WIDTH - 3*MARGIN, ListItem::TEXT_SIZE_NORMAL));
+    QStringList addressComponents = m_location.addressComponents();
+
+    if (addressComponents.count() > 0)
+        setName(shortenText(addressComponents.at(0), ITEM_WIDTH - 3*MARGIN,
+                            ListItem::TEXT_SIZE_NORMAL));
+
+    QString addressTail;
+
+    for (int i = 1; i < addressComponents.count(); ++i) {
+        addressTail.append(addressComponents.at(i));
+
+        if (i < (addressComponents.count() - 1))
+            addressTail.append(", ");
+    }
+
+    addSubItem(addressTail, QPixmap(":/res/images/compass.png"));
+
+}
+
+void LocationListItem::bounds(GeoCoordinate &swBound, GeoCoordinate &neBound)
+{
+    m_location.bounds(swBound, neBound);
 }