32 Return true if given entry is cwrt widget and already on homescreen |
32 Return true if given entry is cwrt widget and already on homescreen |
33 */ |
33 */ |
34 bool HsAppLibStateUtils::isCWRTWidgetOnHomeScreen(const CaEntry *entry) |
34 bool HsAppLibStateUtils::isCWRTWidgetOnHomeScreen(const CaEntry *entry) |
35 { |
35 { |
36 bool result = false; |
36 bool result = false; |
37 if (entry->entryTypeName() == applicationTypeName() && |
37 if (entry->entryTypeName() == Hs::applicationTypeName && |
38 entry->attribute(swTypeKey()) == HS_CWRT_APP_TYPE && |
38 entry->attribute(Hs::swTypeKey) == Hs::HS_CWRT_APP_TYPE && |
39 entry->attribute(widgetUriAttributeName()) == |
39 entry->attribute(Hs::widgetUriAttributeName) == |
40 HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE) { |
40 Hs::HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE) { |
41 QVariantHash preferences; |
41 QVariantHash preferences; |
42 QMap<QString, QString> attributes = entry->attributes(); |
42 QMap<QString, QString> attributes = entry->attributes(); |
43 QMapIterator<QString, QString> i(attributes); |
43 QMapIterator<QString, QString> i(attributes); |
44 while (i.hasNext()) { |
44 while (i.hasNext()) { |
45 i.next(); |
45 i.next(); |
46 QString key(i.key()); |
46 QString key(i.key()); |
47 QString value(i.value()); |
47 QString value(i.value()); |
48 if (key.contains(widgetParam())) { |
48 if (key.contains(Hs::widgetParam)) { |
49 preferences.insert(key.remove(widgetParam()),value); |
49 preferences.insert(key.remove(Hs::widgetParam),value); |
50 } |
50 } |
51 } |
51 } |
52 int count(0); |
52 int count(0); |
53 HsContentService::instance()->widgets(HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE,preferences,count); |
53 HsContentService::instance()->widgets(Hs::HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE,preferences,count); |
54 result = count > 0; |
54 result = count > 0; |
55 } |
55 } |
56 return result; |
56 return result; |
57 } |
57 } |