From d46dae87492de0c50edafb05565e92812343d6c7 Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Date: Fri, 8 Jan 2016 16:01:26 -0500
Subject: [PATCH] phonedirectorymodel: revert roledata delegation

Change introduced in 47ab47c2a2300845785cf208e1fb75d789469731,
breaking the RecentModel generation

This also uses the new decorationRole delegate method.

Change-Id: I1c27385bf55e990f0a0ed087696547e245814b19
Tuleap: #170
---
 src/phonedirectorymodel.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/phonedirectorymodel.cpp b/src/phonedirectorymodel.cpp
index 766d2cdf..f6b6df06 100644
--- a/src/phonedirectorymodel.cpp
+++ b/src/phonedirectorymodel.cpp
@@ -104,7 +104,15 @@ QVariant PhoneDirectoryModel::data(const QModelIndex& index, int role ) const
    const ContactMethod* number = d_ptr->m_lNumbers[index.row()];
    switch (static_cast<PhoneDirectoryModelPrivate::Columns>(index.column())) {
       case PhoneDirectoryModelPrivate::Columns::URI:
-         return number->roleData(role);
+         switch (role) {
+            case Qt::DisplayRole:
+               return number->uri();
+            case Qt::DecorationRole :
+               return GlobalInstances::pixmapManipulator().decorationRole(number);
+            case (int) Role::Object:
+               return QVariant::fromValue(const_cast<ContactMethod*>(number));
+         }
+         break;
       case PhoneDirectoryModelPrivate::Columns::TYPE:
          switch (role) {
             case Qt::DisplayRole:
-- 
GitLab