Modified FriendListItem User member type.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Thu, 24 Jun 2010 10:22:53 +0000 (13:22 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Thu, 24 Jun 2010 10:22:53 +0000 (13:22 +0300)
src/ui/friendlistitem.cpp
src/ui/friendlistitem.h

index 3cfc7fc..aa211f5 100644 (file)
@@ -69,7 +69,7 @@ const int AEROPLANE_DISTANCE = 5000;///< Aeroplane distance limit for distance i
 FriendListItem::FriendListItem(QWidget *parent)
     : QWidget(parent)
     , m_expanded(false)
-    , m_user(0)
+//    , m_user(0)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -168,14 +168,14 @@ void FriendListItem::setData(User *user)
     qDebug() << __PRETTY_FUNCTION__;
 
     if(user) {
-        m_user = user;
+        m_user = *user;
 
-        if (!m_user->profileImage().isNull())
-            m_findButton->setButtonIcon(m_user->profileImage());
+        if (!m_user.profileImage().isNull())
+            m_findButton->setButtonIcon(m_user.profileImage());
 
         QString unit;
         double value;
-        user->distance(value, unit);
+        m_user.distance(value, unit);
         m_distanceTextLabel->setText(QString::number(value) + " " + unit);
         setDistanceIcon(value, unit);
 
@@ -207,10 +207,10 @@ void FriendListItem::shortenTexts()
     QFontMetrics nameLabelMetrics = m_nameLabel->fontMetrics();
     QFontMetrics otherLabelsMetrics = m_updatedLabel->fontMetrics();
 
-    QString name = m_user->name();
-    QString updated = m_user->timestamp();
-    QString statusText = m_user->note();
-    QString location = m_user->address();
+    QString name = m_user.name();
+    QString updated = m_user.timestamp();
+    QString statusText = m_user.note();
+    QString location = m_user.address();
 
     int nameIndex = name.indexOf('\n');
     int updatedIndex = updated.indexOf('\n');
@@ -250,9 +250,9 @@ void FriendListItem::setText(bool expanded)
     if (expanded) {
         setUpdatesEnabled(false);
         m_nameLabel->setText(m_shortenedName);
-        m_updatedLabel->setText(m_user->timestamp());
-        m_statusTextLabel->setText(m_user->note());
-        m_locationLabel->setText(m_user->address());
+        m_updatedLabel->setText(m_user.timestamp());
+        m_statusTextLabel->setText(m_user.note());
+        m_locationLabel->setText(m_user.address());
         setUpdatesEnabled(true);
     }
     else {
@@ -312,5 +312,5 @@ void FriendListItem::findButtonClicked()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    emit findFriend(m_user->coordinates());
+    emit findFriend(m_user.coordinates());
 }
index cc8496c..f1c20fa 100644 (file)
@@ -149,7 +149,7 @@ private:
     QString m_shortenedUpdated;     ///< Shortened updated text
     QLabel *m_statusTextLabel;      ///< Status text label
     QLabel *m_updatedLabel;         ///< Updated label
-    User *m_user;                    ///< User data
+    User m_user;                    ///< User data
 };
 
 #endif // FRIENDLISTITEM_H