summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/UserSearch/ContactListDelegate.cpp')
-rw-r--r--Swift/QtUI/UserSearch/ContactListDelegate.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Swift/QtUI/UserSearch/ContactListDelegate.cpp b/Swift/QtUI/UserSearch/ContactListDelegate.cpp
index 29cab83..56c479b 100644
--- a/Swift/QtUI/UserSearch/ContactListDelegate.cpp
+++ b/Swift/QtUI/UserSearch/ContactListDelegate.cpp
@@ -1,33 +1,39 @@
/*
* Copyright (c) 2013 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2014 Kevin Smith and Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
#include <Swift/QtUI/UserSearch/ContactListDelegate.h>
#include <Swift/QtUI/UserSearch/ContactListModel.h>
#include <Swift/Controllers/Contact.h>
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
ContactListDelegate::ContactListDelegate(bool compact) : compact_(compact) {
}
ContactListDelegate::~ContactListDelegate() {
}
void ContactListDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
if (!index.isValid()) {
return;
}
- const Contact* contact = static_cast<Contact*>(index.internalPointer());
+ const Contact::ref contact = static_cast<Contact*>(index.internalPointer())->shared_from_this();
QColor nameColor = index.data(Qt::TextColorRole).value<QColor>();
QString avatarPath = index.data(ContactListModel::AvatarRole).value<QString>();
QIcon presenceIcon =index.data(ChatListRecentItem::PresenceIconRole).isValid() && !index.data(ChatListRecentItem::PresenceIconRole).value<QIcon>().isNull()
? index.data(ChatListRecentItem::PresenceIconRole).value<QIcon>()
: QIcon(":/icons/offline.png");
QString name = P2QSTRING(contact->name);
QString statusText = P2QSTRING(contact->jid.toString());
common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, false, 0, compact_);
}