homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp
changeset 62 341166945d65
parent 51 4785f57bf3d4
child 63 52b0f64eeb51
--- a/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp	Thu Jun 24 13:11:40 2010 +0100
+++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp	Fri Jun 25 19:19:22 2010 +0300
@@ -92,7 +92,7 @@
 HsMenuItemModel *HsMenuService::getInstalledModel(
     HsSortAttribute sortAttribute)
 {
-    //TODO get proper items 
+    //TODO get proper items
     qDebug() << "HsMenuService::getInstalledModel" << "sortAttribute:"
              << sortAttribute;
     HSMENUTEST_FUNC_ENTRY("HsMenuService::getInstalledModel");
@@ -185,14 +185,36 @@
  Executes action on an item
  \param entryId of this item
  \param actionName string with action name
- \retval boolean error code
+ \retval int error code, 0 if no error
  */
-bool HsMenuService::executeAction(int entryId, const QString &actionName)
+int HsMenuService::executeAction(int entryId, const QString &actionName)
 {
     qDebug() << "HsMenuService::executeAction entryId:" << entryId
              << "actionName:" << actionName;
+    int ret = CaService::instance()->executeCommand(entryId, actionName);
 
-    return CaService::instance()->executeCommand(entryId, actionName);
+/*    // if its remove action we need to mark all items 
+    // that are being uninstalled
+    if (actionName == caCmdRemove && ret == 0) {
+        QSharedPointer<CaEntry> entry(
+                CaService::instance()->getEntry(entryId));
+        if (!entry.isNull()) {
+            QString componentId = entry->attribute(
+                    componentIdAttributeName());
+            
+            CaQuery query;
+            query.setAttribute(componentIdAttributeName(), componentId);
+            QList< QSharedPointer<CaEntry> > entries 
+                    = CaService::instance()->getEntries(query);
+            
+            for (int i = 0; i < entries.count(); i++) {
+                entries[i]->setFlags(
+                        entries.first()->flags()| UninstallEntryFlag);
+                CaService::instance()->updateEntry(*entries[i]);
+            }
+        }
+    }*/
+    return ret;
 }
 
 /*!
@@ -389,16 +411,16 @@
 
 /*!
  Launch SoftwareUpdateApplication
- \retval boolean launching status
+ \retval int launching status, 0 if no errors
  */
-bool HsMenuService::launchSoftwareUpdate()
+int HsMenuService::launchSoftwareUpdate()
 {
     qDebug() << "HsMenuService::launchSoftwareUpdate";
     QScopedPointer<CaEntry> tsEntry(new CaEntry);
     tsEntry->setEntryTypeName(applicationTypeName());
     tsEntry->setAttribute(
-            applicationUidEntryKey(), QString::number(softwareUpdateApplicationUid)); 
-    int retval = CaService::instance()->executeCommand(*tsEntry, 
+            applicationUidEntryKey(), QString::number(softwareUpdateApplicationUid));
+    int retval = CaService::instance()->executeCommand(*tsEntry,
             openActionIdentifier());
     return retval;
 }