phonebookui/pbkcommonui/src/cntgroupdeletepopupmodel.cpp
changeset 46 efe85016a067
parent 40 b46a585f6909
child 47 7cbcb2896f0e
equal deleted inserted replaced
40:b46a585f6909 46:efe85016a067
    17 
    17 
    18 #include "cntgroupdeletepopupmodel.h"
    18 #include "cntgroupdeletepopupmodel.h"
    19 
    19 
    20 #include <qtcontacts.h>
    20 #include <qtcontacts.h>
    21 #include <hbglobal.h>
    21 #include <hbglobal.h>
       
    22 #include <hbiconitem.h>
    22 
    23 
    23 /*!
    24 /*!
    24 Constructor
    25 Constructor
    25 */
    26 */
    26 CntGroupDeletePopupModel::CntGroupDeletePopupModel(QContactManager *manager, QObject *parent)
    27 CntGroupDeletePopupModel::CntGroupDeletePopupModel(QContactManager *manager, QObject *parent)
    86                 dataList.append(displayList);
    87                 dataList.append(displayList);
    87                 
    88                 
    88                 // contact Id for identification
    89                 // contact Id for identification
    89                 dataList.append(groupContactIds.at(i));
    90                 dataList.append(groupContactIds.at(i));
    90                 
    91                 
       
    92                 // Default if no image for group 
       
    93                 bool icon = false;
       
    94                 QList<QContactAvatar> details = contact.details<QContactAvatar>();
       
    95                 for (int k = 0;k < details.count();k++)
       
    96                 {
       
    97                    if (details.at(k).imageUrl().isValid())
       
    98                    {
       
    99                        dataList.append(QStringList(details.at(k).imageUrl().toString()));
       
   100                        icon = true;
       
   101                        break;
       
   102                    }
       
   103                 }
       
   104                 if(!icon)
       
   105                 {
       
   106                    dataList.append(QStringList("qtg_large_custom"));
       
   107                 }
       
   108 
    91                 mDataPointer->mDataList.append(dataList);
   109                 mDataPointer->mDataList.append(dataList);
    92             }
   110             }
    93         }
   111         }
    94     }
   112     }
    95 }
   113 }
   152     {
   170     {
   153         QStringList list = values[0].toStringList();        
   171         QStringList list = values[0].toStringList();        
   154         return QVariant(list);
   172         return QVariant(list);
   155     }
   173     }
   156     
   174     
       
   175     else if (role == Qt::DecorationRole)
       
   176     {
       
   177         QVariantList icons;
       
   178         for (int i = 0;i < values[2].toStringList().count();i++)
       
   179         {
       
   180             HbIcon icon(values[2].toStringList().at(i));
       
   181             icons.append(icon);
       
   182         }
       
   183         return QVariant(icons);
       
   184     }
       
   185     
   157     else if (role == Qt::UserRole)
   186     else if (role == Qt::UserRole)
   158        {
   187        {
   159            int contactId = values[1].toInt();
   188            int contactId = values[1].toInt();
   160            return QVariant(contactId);
   189            return QVariant(contactId);
   161        }
   190        }