homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp
changeset 77 4b195f3bea29
parent 61 2b1b11a301d2
child 85 35368b604b28
equal deleted inserted replaced
61:2b1b11a301d2 77:4b195f3bea29
    32 
    32 
    33 // ======== MEMBER FUNCTIONS ========
    33 // ======== MEMBER FUNCTIONS ========
    34 
    34 
    35 // Initialization of a static member variable.
    35 // Initialization of a static member variable.
    36 int HsMenuService::mAllCollectionsId = 0;
    36 int HsMenuService::mAllCollectionsId = 0;
    37 
    37 const char COLLECTION_TITLE_NAME[] = "title_name";
       
    38 const char COLLECTION_SHORT_NAME[] = "short_name";
    38 /*!
    39 /*!
    39  Returns all applications model
    40  Returns all applications model
    40  \param sortAttribute ::  SortAttribute
    41  \param sortAttribute ::  SortAttribute
    41  \retval HsMenuItemModel: AllApplicationsModel
    42  \retval HsMenuItemModel: AllApplicationsModel
    42  */
    43  */
    61     return model;
    62     return model;
    62 }
    63 }
    63 
    64 
    64 /*!
    65 /*!
    65  Returns all collections model
    66  Returns all collections model
    66  \param sortAttribute ::  SortAttribute
       
    67  \param details : switch to return details or not
       
    68  \retval HsMenuItemModel: all collections model
    67  \retval HsMenuItemModel: all collections model
    69  */
    68  */
    70 HsMenuItemModel *HsMenuService::getAllCollectionsModel(
    69 HsMenuItemModel *HsMenuService::getAllCollectionsModel()
    71     HsSortAttribute sortAttribute)
    70 {
    72 {
    71     qDebug() << "HsMenuService::getAllCollectionsModel";
    73     qDebug() << "HsMenuService::getAllCollectionsModel" << "sortAttribute:"
       
    74              << sortAttribute;
       
    75     HSMENUTEST_FUNC_ENTRY("HsMenuService::getAllCollectionsModel");
    72     HSMENUTEST_FUNC_ENTRY("HsMenuService::getAllCollectionsModel");
    76     CaQuery query;
    73     CaQuery query;
    77     query.setParentId(allCollectionsId());
    74     query.setParentId(allCollectionsId());
    78     query.setFlagsOn(VisibleEntryFlag);
    75     query.setFlagsOn(VisibleEntryFlag);
    79     query.setFlagsOff(MissingEntryFlag);
    76     query.setFlagsOff(MissingEntryFlag);
    80     query.setSort(HsMenuServiceUtils::sortBy(sortAttribute),
       
    81                   HsMenuServiceUtils::sortOrder(sortAttribute));
       
    82     HsMenuItemModel *model = new HsMenuCollectionsItemModel(query);
    77     HsMenuItemModel *model = new HsMenuCollectionsItemModel(query);
    83     HSMENUTEST_FUNC_EXIT("HsMenuService::getAllCollectionsModel");
    78     HSMENUTEST_FUNC_EXIT("HsMenuService::getAllCollectionsModel");
    84     return model;
    79     return model;
    85 }
    80 }
    86 
    81 
   274     if (collection) {
   269     if (collection) {
   275         qDebug() << "HsMenuService::renameCollection collection"
   270         qDebug() << "HsMenuService::renameCollection collection"
   276                  << collection;
   271                  << collection;
   277 
   272 
   278         collection->setText(newCollectionName);
   273         collection->setText(newCollectionName);
       
   274         collection->setAttribute(COLLECTION_TITLE_NAME, newCollectionName);
       
   275         collection->setAttribute(COLLECTION_SHORT_NAME, newCollectionName);
   279         result = CaService::instance()->updateEntry(*collection);
   276         result = CaService::instance()->updateEntry(*collection);
   280     }
   277     }
   281     HSMENUTEST_FUNC_EXIT("HsMenuService::renameCollection");
   278     HSMENUTEST_FUNC_EXIT("HsMenuService::renameCollection");
   282     return result;
   279     return result;
   283 }
   280 }