149 } |
151 } |
150 |
152 |
151 /*! |
153 /*! |
152 ?Qt_style_documentation |
154 ?Qt_style_documentation |
153 */ |
155 */ |
154 QList<HsWidgetToken> HsWidgetRegistryServicePrivate::readManifestFile( |
156 QList<HsWidgetComponentDescriptor> HsWidgetRegistryServicePrivate::readManifestFile( |
155 const QString &manifestFilePath) |
157 const QString &manifestFilePath) |
156 { |
158 { |
157 QList<HsWidgetToken> widgets; |
159 QList<HsWidgetComponentDescriptor> widgets; |
158 QStringList filters("*.manifest"); |
160 QStringList filters("*.manifest"); |
159 QDir dir(manifestFilePath); |
161 QDir dir(manifestFilePath); |
160 QStringList manifestDir = dir.entryList(filters, QDir::Files); |
162 QStringList manifestDir = dir.entryList(filters, QDir::Files); |
161 |
163 |
162 if (!manifestDir.isEmpty()) { |
164 if (!manifestDir.isEmpty()) { |
163 // ? |
165 // ? |
164 QString fileName = manifestDir.first(); |
166 QString fileName = manifestDir.first(); |
165 HsWidgetComponentParser componentParser(dir.absoluteFilePath(fileName)); |
167 HsWidgetComponentParser componentParser(dir.absoluteFilePath(fileName)); |
166 if ( !componentParser.error() ) { |
168 if ( !componentParser.error() ) { |
167 HsWidgetToken widgetToken; |
169 |
168 HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor(); |
170 HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor(); |
169 widgetToken.mUri = widgetDescriptor.uri; |
171 widgetDescriptor.library = manifestFilePath + "/" + widgetDescriptor.uri + ".dll"; |
170 widgetToken.mLibrary = manifestFilePath + "/" + widgetDescriptor.uri + ".dll"; |
|
171 widgetToken.mTitle = widgetDescriptor.title; |
|
172 if (widgetDescriptor.iconUri.length() > 0 ) { |
172 if (widgetDescriptor.iconUri.length() > 0 ) { |
173 widgetToken.mIconUri = manifestFilePath + "/" + widgetDescriptor.iconUri; |
173 widgetDescriptor.iconUri = manifestFilePath + "/" + widgetDescriptor.iconUri; |
174 } |
174 } |
175 widgetToken.mDescription = widgetDescriptor.description; |
175 if (widgetDescriptor.previewImage.length() > 0 ) { |
|
176 widgetDescriptor.previewImage = manifestFilePath + "/" + widgetDescriptor.previewImage; |
|
177 } |
|
178 |
176 int widgetUid = dir.dirName().toUInt(0, 16); |
179 int widgetUid = dir.dirName().toUInt(0, 16); |
177 widgetToken.mUid = widgetUid; |
180 widgetDescriptor.uid = widgetUid; |
178 widgets << widgetToken; |
181 widgets << widgetDescriptor; |
179 qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \ |
182 qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \ |
180 "widget added: " << fileName; |
183 "widget added: " << fileName; |
181 } |
184 } |
182 #if 0 |
|
183 |
|
184 if (fileName != "hsposterwidgetprovider.manifest") { |
|
185 // Directory differs from the poster widget's directory |
|
186 // which is not supported for the time being. |
|
187 // manifest.loadFromXml(dir.absoluteFilePath(fileName)); |
|
188 // widgets = manifest.widgets(); |
|
189 int widgetUid = dir.dirName().toUInt(0, 16); |
|
190 |
|
191 // ? |
|
192 for (int i=0; i<widgets.count(); i++) { |
|
193 widgets[i].mUid = widgetUid; |
|
194 widgets[i].mLibrary = manifestFilePath + "/" + widgets[i].mLibrary; |
|
195 if (widgets[i].mIconUri != "") { |
|
196 // ? |
|
197 widgets[i].mIconUri = manifestFilePath + "/" + widgets[i].mIconUri; |
|
198 } |
|
199 } |
|
200 |
|
201 qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \ |
|
202 "widget added: " << fileName; |
|
203 } |
|
204 #endif |
|
205 } |
185 } |
206 return widgets; |
186 return widgets; |
207 } |
187 } |
208 |
188 |
209 /*! |
189 /*! |
264 void HsWidgetRegistryServicePrivate::installerStateChanged(int newValue) |
244 void HsWidgetRegistryServicePrivate::installerStateChanged(int newValue) |
265 { |
245 { |
266 Q_UNUSED(newValue); |
246 Q_UNUSED(newValue); |
267 /* |
247 /* |
268 if ((newValue & KSASwisOperationMask) == ESASwisNone) { |
248 if ((newValue & KSASwisOperationMask) == ESASwisNone) { |
269 // ? |
249 // ? |
270 mInstallerObserver.unSubscribe(); |
250 mInstallerObserver.unSubscribe(); |
271 mInstallerObserver.disconnect(); |
251 mInstallerObserver.disconnect(); |
272 QStringList originalList = mManifestDirectories.value(mLatestChangedDirectory); |
252 QStringList originalList = mManifestDirectories.value(mLatestChangedDirectory); |
273 QStringList currentList = readManifestDirectories(mLatestChangedDirectory); |
253 QStringList currentList = readManifestDirectories(mLatestChangedDirectory); |
274 doWidgetAdd(mLatestChangedDirectory, originalList, currentList); |
254 doWidgetAdd(mLatestChangedDirectory, originalList, currentList); |