19 #include <QPluginLoader> |
19 #include <QPluginLoader> |
20 #include <QDebug> |
20 #include <QDebug> |
21 |
21 |
22 #include "hswidgetregistryservice.h" |
22 #include "hswidgetregistryservice.h" |
23 #include "hswidgetregistryservice_p.h" |
23 #include "hswidgetregistryservice_p.h" |
24 #include "hswidgetprovidermanifest.h" |
24 #include "hswidgetcomponentdescriptor.h" |
25 |
25 #include "hswidgetcomponentparser.h" |
26 const char POSTERURI[] = "homescreen.nokia.com/widget/poster/"; |
26 |
27 const char POSTERWIDGETNAME[] = "name"; |
|
28 const char POSTERWIDGETID[] = "posterwidgetid"; |
|
29 const char PUBLISHER[] = "publisher"; |
|
30 const char TEMPLATETYPE[] = "templatetype"; |
|
31 const char CONTENTID[] = "contentid"; |
|
32 const char CONTENTTYPE[] = "contenttype"; |
|
33 |
27 |
34 /*! |
28 /*! |
35 ?Qt_style_documentation |
29 ?Qt_style_documentation |
36 */ |
30 */ |
37 HsWidgetRegistryServicePrivate::HsWidgetRegistryServicePrivate( |
31 HsWidgetRegistryServicePrivate::HsWidgetRegistryServicePrivate( |
159 */ |
153 */ |
160 QList<HsWidgetToken> HsWidgetRegistryServicePrivate::readManifestFile( |
154 QList<HsWidgetToken> HsWidgetRegistryServicePrivate::readManifestFile( |
161 const QString &manifestFilePath) |
155 const QString &manifestFilePath) |
162 { |
156 { |
163 QList<HsWidgetToken> widgets; |
157 QList<HsWidgetToken> widgets; |
164 HsWidgetProviderManifest manifest; |
|
165 QStringList filters("*.manifest"); |
158 QStringList filters("*.manifest"); |
166 QDir dir(manifestFilePath); |
159 QDir dir(manifestFilePath); |
167 QStringList manifestDir = dir.entryList(filters, QDir::Files); |
160 QStringList manifestDir = dir.entryList(filters, QDir::Files); |
168 |
161 |
169 if (!manifestDir.isEmpty()) { |
162 if (!manifestDir.isEmpty()) { |
170 // ? |
163 // ? |
171 QString fileName = manifestDir.first(); |
164 QString fileName = manifestDir.first(); |
|
165 HsWidgetComponentParser componentParser(dir.absoluteFilePath(fileName)); |
|
166 if ( !componentParser.error() ) { |
|
167 HsWidgetToken widgetToken; |
|
168 HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor(); |
|
169 widgetToken.mUri = widgetDescriptor.uri; |
|
170 widgetToken.mLibrary = manifestFilePath + "/" + widgetDescriptor.uri + ".dll"; |
|
171 widgetToken.mTitle = widgetDescriptor.title; |
|
172 if (widgetDescriptor.iconUri.length() > 0 ) { |
|
173 widgetToken.mIconUri = manifestFilePath + "/" + widgetDescriptor.iconUri; |
|
174 } |
|
175 widgetToken.mDescription = widgetDescriptor.description; |
|
176 int widgetUid = dir.dirName().toUInt(0, 16); |
|
177 widgetToken.mUid = widgetUid; |
|
178 widgets << widgetToken; |
|
179 qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \ |
|
180 "widget added: " << fileName; |
|
181 } |
|
182 #if 0 |
172 |
183 |
173 if (fileName != "hsposterwidgetprovider.manifest") { |
184 if (fileName != "hsposterwidgetprovider.manifest") { |
174 // Directory differs from the poster widget's directory |
185 // Directory differs from the poster widget's directory |
175 // which is not supported for the time being. |
186 // which is not supported for the time being. |
176 manifest.loadFromXml(dir.absoluteFilePath(fileName)); |
187 // manifest.loadFromXml(dir.absoluteFilePath(fileName)); |
177 widgets = manifest.widgets(); |
188 // widgets = manifest.widgets(); |
178 int widgetUid = dir.dirName().toUInt(0, 16); |
189 int widgetUid = dir.dirName().toUInt(0, 16); |
179 |
190 |
180 // ? |
191 // ? |
181 for (int i=0; i<widgets.count(); i++) { |
192 for (int i=0; i<widgets.count(); i++) { |
182 widgets[i].mUid = widgetUid; |
193 widgets[i].mUid = widgetUid; |