homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenucollectionsitemmodel.cpp
changeset 39 4e8ebe173323
parent 35 f9ce957a272c
child 81 7dd137878ff8
equal deleted inserted replaced
36:cdae8c6c3876 39:4e8ebe173323
    50 {
    50 {
    51     HSMENUTEST_FUNC_ENTRY("HsMenuCollectionsItemModel::data");
    51     HSMENUTEST_FUNC_ENTRY("HsMenuCollectionsItemModel::data");
    52     QVariant variant;
    52     QVariant variant;
    53     if (role == Qt::DisplayRole && secondLineVisibility()) {
    53     if (role == Qt::DisplayRole && secondLineVisibility()) {
    54         QList<QVariant> text;
    54         QList<QVariant> text;
    55         text << entry(index)->text();
    55         QSharedPointer<CaEntry> item = entry(index);
    56         text << getSecondLine(entry(index));
    56         text << item->text();
       
    57         text << getSecondLine(item.data());
    57         variant =  QVariant(text);
    58         variant =  QVariant(text);
    58     } else {
    59     } else {
    59         variant = CaItemModel::data(index, role);
    60         variant = CaItemModel::data(index, role);
    60     }
    61     }
    61     HSMENUTEST_FUNC_EXIT("HsMenuCollectionsItemModel::data");
    62     HSMENUTEST_FUNC_EXIT("HsMenuCollectionsItemModel::data");
    68  (used for certain dynamic collections)
    69  (used for certain dynamic collections)
    69  \param entry of an collection
    70  \param entry of an collection
    70  \retval string with applications names separated by ','
    71  \retval string with applications names separated by ','
    71  no longer than 256 bytes
    72  no longer than 256 bytes
    72  */
    73  */
    73 QString HsMenuCollectionsItemModel::getSecondLine(CaEntry *entry) const
    74 QString HsMenuCollectionsItemModel::getSecondLine(const CaEntry *entry) const
    74 {
    75 {
    75     HSMENUTEST_FUNC_ENTRY("HsMenuCollectionsItemModel::getSecondLine");
    76     HSMENUTEST_FUNC_ENTRY("HsMenuCollectionsItemModel::getSecondLine");
    76     QString result;
    77     QString result;
    77 
    78 
    78     CaQuery query;
    79     CaQuery query;
    85         query.setFlagsOn(VisibleEntryFlag);
    86         query.setFlagsOn(VisibleEntryFlag);
    86     }
    87     }
    87 
    88 
    88     query.setFlagsOff(MissingEntryFlag);
    89     query.setFlagsOff(MissingEntryFlag);
    89 
    90 
    90     QList<CaEntry *> entries = CaService::instance()->getEntries(query);
    91     QList< QSharedPointer<CaEntry> > entries = CaService::instance()->getEntries(query);
    91 
    92 
    92     if (!entries.count()) {
    93     if (!entries.count()) {
    93         result = QString(hbTrId("txt_applib_dblist_downloaded_val_empty"));
    94         result = QString(hbTrId("txt_applib_dblist_downloaded_val_empty"));
    94     }//if
    95     }//if
    95     else {
    96     else {
   116                     break;
   117                     break;
   117                 }
   118                 }
   118             }
   119             }
   119         }
   120         }
   120     }
   121     }
   121     qDeleteAll(entries);
       
   122     HSMENUTEST_FUNC_EXIT("HsMenuCollectionsItemModel::getSecondLine");
   122     HSMENUTEST_FUNC_EXIT("HsMenuCollectionsItemModel::getSecondLine");
   123     return result;
   123     return result;
   124 }
   124 }