|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Utils for application library state plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <caentry.h> |
|
19 |
|
20 #include "hsapplibstateutils.h" |
|
21 #include "hscontentservice.h" |
|
22 #include "hsapp_defs.h" |
|
23 |
|
24 /*! |
|
25 \class HsAppLibStateUtils |
|
26 \ingroup group_hsmenustateplugin |
|
27 \brief Utils. |
|
28 Utils for application library state plugin. |
|
29 */ |
|
30 |
|
31 /*! |
|
32 Return true if given entry is cwrt widget and already on homescreen |
|
33 */ |
|
34 bool HsAppLibStateUtils::isCWRTWidgetOnHomeScreen(const CaEntry *entry) |
|
35 { |
|
36 bool result = false; |
|
37 if (entry->entryTypeName() == Hs::applicationTypeName && |
|
38 entry->attribute(Hs::swTypeKey) == Hs::HS_CWRT_APP_TYPE && |
|
39 entry->attribute(Hs::widgetUriAttributeName) == |
|
40 Hs::HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE) { |
|
41 QVariantHash preferences; |
|
42 QMap<QString, QString> attributes = entry->attributes(); |
|
43 QMapIterator<QString, QString> i(attributes); |
|
44 while (i.hasNext()) { |
|
45 i.next(); |
|
46 QString key(i.key()); |
|
47 QString value(i.value()); |
|
48 if (key.contains(Hs::widgetParam)) { |
|
49 preferences.insert(key.remove(Hs::widgetParam),value); |
|
50 } |
|
51 } |
|
52 int count(0); |
|
53 HsContentService::instance()->widgets(Hs::HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE,preferences,count); |
|
54 result = count > 0; |
|
55 } |
|
56 return result; |
|
57 } |