homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp
changeset 62 341166945d65
parent 51 4785f57bf3d4
child 63 52b0f64eeb51
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
    90  \retval HsMenuItemModel: installed model
    90  \retval HsMenuItemModel: installed model
    91  */
    91  */
    92 HsMenuItemModel *HsMenuService::getInstalledModel(
    92 HsMenuItemModel *HsMenuService::getInstalledModel(
    93     HsSortAttribute sortAttribute)
    93     HsSortAttribute sortAttribute)
    94 {
    94 {
    95     //TODO get proper items 
    95     //TODO get proper items
    96     qDebug() << "HsMenuService::getInstalledModel" << "sortAttribute:"
    96     qDebug() << "HsMenuService::getInstalledModel" << "sortAttribute:"
    97              << sortAttribute;
    97              << sortAttribute;
    98     HSMENUTEST_FUNC_ENTRY("HsMenuService::getInstalledModel");
    98     HSMENUTEST_FUNC_ENTRY("HsMenuService::getInstalledModel");
    99     CaQuery query;
    99     CaQuery query;
   100     query.addEntryTypeName(packageTypeName());
   100     query.addEntryTypeName(packageTypeName());
   183 
   183 
   184 /*!
   184 /*!
   185  Executes action on an item
   185  Executes action on an item
   186  \param entryId of this item
   186  \param entryId of this item
   187  \param actionName string with action name
   187  \param actionName string with action name
   188  \retval boolean error code
   188  \retval int error code, 0 if no error
   189  */
   189  */
   190 bool HsMenuService::executeAction(int entryId, const QString &actionName)
   190 int HsMenuService::executeAction(int entryId, const QString &actionName)
   191 {
   191 {
   192     qDebug() << "HsMenuService::executeAction entryId:" << entryId
   192     qDebug() << "HsMenuService::executeAction entryId:" << entryId
   193              << "actionName:" << actionName;
   193              << "actionName:" << actionName;
   194 
   194     int ret = CaService::instance()->executeCommand(entryId, actionName);
   195     return CaService::instance()->executeCommand(entryId, actionName);
   195 
       
   196 /*    // if its remove action we need to mark all items 
       
   197     // that are being uninstalled
       
   198     if (actionName == caCmdRemove && ret == 0) {
       
   199         QSharedPointer<CaEntry> entry(
       
   200                 CaService::instance()->getEntry(entryId));
       
   201         if (!entry.isNull()) {
       
   202             QString componentId = entry->attribute(
       
   203                     componentIdAttributeName());
       
   204             
       
   205             CaQuery query;
       
   206             query.setAttribute(componentIdAttributeName(), componentId);
       
   207             QList< QSharedPointer<CaEntry> > entries 
       
   208                     = CaService::instance()->getEntries(query);
       
   209             
       
   210             for (int i = 0; i < entries.count(); i++) {
       
   211                 entries[i]->setFlags(
       
   212                         entries.first()->flags()| UninstallEntryFlag);
       
   213                 CaService::instance()->updateEntry(*entries[i]);
       
   214             }
       
   215         }
       
   216     }*/
       
   217     return ret;
   196 }
   218 }
   197 
   219 
   198 /*!
   220 /*!
   199  Launch task switcher
   221  Launch task switcher
   200  \retval boolean launching status
   222  \retval boolean launching status
   387     return CaService::instance()->touch(* entry);
   409     return CaService::instance()->touch(* entry);
   388 }
   410 }
   389 
   411 
   390 /*!
   412 /*!
   391  Launch SoftwareUpdateApplication
   413  Launch SoftwareUpdateApplication
   392  \retval boolean launching status
   414  \retval int launching status, 0 if no errors
   393  */
   415  */
   394 bool HsMenuService::launchSoftwareUpdate()
   416 int HsMenuService::launchSoftwareUpdate()
   395 {
   417 {
   396     qDebug() << "HsMenuService::launchSoftwareUpdate";
   418     qDebug() << "HsMenuService::launchSoftwareUpdate";
   397     QScopedPointer<CaEntry> tsEntry(new CaEntry);
   419     QScopedPointer<CaEntry> tsEntry(new CaEntry);
   398     tsEntry->setEntryTypeName(applicationTypeName());
   420     tsEntry->setEntryTypeName(applicationTypeName());
   399     tsEntry->setAttribute(
   421     tsEntry->setAttribute(
   400             applicationUidEntryKey(), QString::number(softwareUpdateApplicationUid)); 
   422             applicationUidEntryKey(), QString::number(softwareUpdateApplicationUid));
   401     int retval = CaService::instance()->executeCommand(*tsEntry, 
   423     int retval = CaService::instance()->executeCommand(*tsEntry,
   402             openActionIdentifier());
   424             openActionIdentifier());
   403     return retval;
   425     return retval;
   404 }
   426 }