equal
deleted
inserted
replaced
35 |
35 |
36 /*! |
36 /*! |
37 \class HsWidgetComponentRegistry |
37 \class HsWidgetComponentRegistry |
38 \ingroup group_hsdomainmodel |
38 \ingroup group_hsdomainmodel |
39 \brief Homescreen widget component registry. |
39 \brief Homescreen widget component registry. |
|
40 |
|
41 Homescreen widget component registry keeps track of packages from which is(are) |
|
42 created widget(s) to homescreen page(s). Registry updates its content |
|
43 when the installation package is uninstalled/updated or installation location is( or is not) |
|
44 available (media attached/detached). Registry takes care of package registration/unregistration |
|
45 to Qt service framework. |
|
46 |
|
47 Events for all above cases are get from Content Storage. Component registry listens |
|
48 changes of Content Storages' entries (CaEntry) via its service class (CaService). |
40 */ |
49 */ |
41 |
50 |
42 HsWidgetComponentRegistry *HsWidgetComponentRegistry::mInstance = 0; |
51 HsWidgetComponentRegistry *HsWidgetComponentRegistry::mInstance = 0; |
43 |
52 |
44 |
53 |
62 qDeleteAll(mRegistry); |
71 qDeleteAll(mRegistry); |
63 } |
72 } |
64 |
73 |
65 /*! |
74 /*! |
66 Returns component object of the given \a uri. |
75 Returns component object of the given \a uri. |
|
76 Uri is defined in widget manifest file. \see page_widgetsispackage |
67 */ |
77 */ |
68 HsWidgetComponent *HsWidgetComponentRegistry::component(const QString &uri) |
78 HsWidgetComponent *HsWidgetComponentRegistry::component(const QString &uri) |
69 { |
79 { |
70 if (mRegistry.contains(uri)) { |
80 if (mRegistry.contains(uri)) { |
71 return mRegistry.value(uri); |
81 return mRegistry.value(uri); |
75 mRegistry.insert(uri, c.data()); |
85 mRegistry.insert(uri, c.data()); |
76 return c.take(); |
86 return c.take(); |
77 } |
87 } |
78 |
88 |
79 /*! |
89 /*! |
80 Requests widget component to emit 'aboutToInstall' signal to free widget resources when uninstalling the widget. |
90 Requests widget component to emit 'aboutToUninstall' signal to free widget resources when |
|
91 uninstalling the widget's installation package. |
81 */ |
92 */ |
82 void HsWidgetComponentRegistry::uninstallComponent(const HsWidgetComponentDescriptor &componentDescriptor) |
93 void HsWidgetComponentRegistry::uninstallComponent(const HsWidgetComponentDescriptor &componentDescriptor) |
83 { |
94 { |
84 HsWidgetComponent *component = mRegistry.value(componentDescriptor.uri); |
95 HsWidgetComponent *component = mRegistry.value(componentDescriptor.uri); |
85 if (component) { |
96 if (component) { |
86 component->emitAboutToUninstall(); |
97 component->emitAboutToUninstall(); |
87 } |
98 } |
88 |
|
89 } |
99 } |
90 |
100 |
91 /*! |
101 /*! |
92 Constructor |
102 Constructor |
93 */ |
103 */ |
117 registerService(entry,uri); |
127 registerService(entry,uri); |
118 HsWidgetComponent *component = mRegistry.value(uri); |
128 HsWidgetComponent *component = mRegistry.value(uri); |
119 if (component) { |
129 if (component) { |
120 component->emitAvailable(); |
130 component->emitAvailable(); |
121 } |
131 } |
122 |
|
123 } |
132 } |
124 |
133 |
125 /*! |
134 /*! |
126 Called when entry is removed from content service. |
135 Called when entry is removed from content service. |
127 */ |
136 */ |
137 // uninstalled |
146 // uninstalled |
138 QString rootPath = entry.attribute(widgetPathAttributeName()); |
147 QString rootPath = entry.attribute(widgetPathAttributeName()); |
139 mServiceManager.removeService(uri); |
148 mServiceManager.removeService(uri); |
140 QCoreApplication::removeLibraryPath(rootPath); |
149 QCoreApplication::removeLibraryPath(rootPath); |
141 if (component) { |
150 if (component) { |
142 // for now support versions without uinstaller |
151 // for now support versions without uninstaller |
143 component->emitAboutToUninstall(); |
152 component->emitAboutToUninstall(); |
144 component->emitUninstalled(); |
153 component->emitUninstalled(); |
145 mRegistry.take(uri)->deleteLater(); |
154 mRegistry.take(uri)->deleteLater(); |
146 } |
155 } |
147 } |
156 } |
201 break; |
210 break; |
202 |
211 |
203 default: break; |
212 default: break; |
204 } |
213 } |
205 } |
214 } |
206 |
|