homescreenapp/hsutils/src/hsmenueventfactory.cpp
changeset 36 cdae8c6c3876
parent 35 f9ce957a272c
child 39 4e8ebe173323
--- a/homescreenapp/hsutils/src/hsmenueventfactory.cpp	Fri Mar 19 09:27:44 2010 +0200
+++ b/homescreenapp/hsutils/src/hsmenueventfactory.cpp	Fri Apr 16 14:54:01 2010 +0300
@@ -41,20 +41,23 @@
     \param entryTypeName Name of the entry type (e.g. application, widget).
     \param uri Widget uri.
     \param library Widget library path and name.
+    \param attributes Widget params.
     \return Event for adding the widget to homescreen.
 */
 QEvent *HsMenuEventFactory::createAddToHomeScreenEvent(
     int entryId,
     const QString &entryTypeName,
     const QString &uri,
-    const QString &library)
+    const QString &library,
+    QMap<QString, QString>* attributes)
 {
     // get CaEntry type, and if widget get uri and library stored as properties...
     QVariantMap params;
+    QVariantMap widgetParams;
 
     params.insert(itemIdKey(), entryId);
 
-    if (entryTypeName == widgetTypeName()) {
+    if (entryTypeName == widgetTypeName() || entryTypeName == templatedApplicationTypeName()) {
         params.insert(
             widgetUriAttributeName(),
             uri);
@@ -64,6 +67,19 @@
             library);
 
         params.insert(entryTypeNameKey(), entryTypeName);
+        
+        if (entryTypeName == templatedApplicationTypeName()) {
+            QMapIterator<QString, QString> i(*attributes);
+            while (i.hasNext()) {
+                i.next();
+                QString key(i.key());
+                QString value(i.value());
+                if (key.contains(widgetParam())) {
+                    widgetParams.insert(key,value);
+                }
+            }
+            params.insert(widgetParam(),widgetParams);
+        }
     }
 
     return new HsMenuEvent(HsMenuEvent::AddToHomeScreen, params);