Archived:Example Syndication Service in WidSets
tanjaluodes
(Talk | contribs) m |
hamishwillee
(Talk | contribs) |
||
| (2 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | {{Archived}}[[Category:WidSets]][[Category:Code | + | {{Archived}}{{ArticleMetaData <!-- v1.2 --> |
| + | |sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | ||
| + | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
| + | |devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') --> | ||
| + | |sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) --> | ||
| + | |platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later --> | ||
| + | |devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) --> | ||
| + | |dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 --> | ||
| + | |signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer --> | ||
| + | |capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | ||
| + | |keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase --> | ||
| + | |language= <!-- Language category code for non-English topics - e.g. Lang-Chinese --> | ||
| + | |translated-by= <!-- [[User:XXXX]] --> | ||
| + | |translated-from-title= <!-- Title only --> | ||
| + | |translated-from-id= <!-- Id of translated revision --> | ||
| + | |review-by= <!-- After re-review: [[User:username]] --> | ||
| + | |review-timestamp= <!-- After re-review: YYYYMMDD --> | ||
| + | |update-by= <!-- After significant update: [[User:username]]--> | ||
| + | |update-timestamp= <!-- After significant update: YYYYMMDD --> | ||
| + | |creationdate= 20080527 | ||
| + | |author= [[User:Mirsilla]] | ||
| + | }} | ||
| + | [[Category:WidSets]][[Category:Code Snippet]] | ||
{{FNWID}} | {{FNWID}} | ||
| − | This script code uses the Syndication service to fetch the 10 most recent items from the [http:// | + | This script code uses the Syndication service to fetch the 10 most recent items from the [http://digg.com/ www.digg.com] RSS feed. |
''syndication_service.he'' | ''syndication_service.he'' | ||
| Line 71: | Line 93: | ||
<parameter name="widgetname">Syndication Service</parameter> | <parameter name="widgetname">Syndication Service</parameter> | ||
<parameter type="url" name="url" editable="false"> | <parameter type="url" name="url" editable="false"> | ||
| − | <value>http:// | + | <value>http://digg.com//rss/index.xml</value> |
</parameter> | </parameter> | ||
</parameters> | </parameters> | ||
Latest revision as of 07:23, 19 June 2012
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
The article is believed to be still valid for the original topic scope.
The article is believed to be still valid for the original topic scope.
Article Metadata
This script code uses the Syndication service to fetch the 10 most recent items from the www.digg.com RSS feed.
syndication_service.he
class
{
void startWidget()
{
setMinimizedView(createMinimizedView("viewMini", getStyle("default")));
}
Shell openWidget()
{
fetch();
return null;
}
void fetch()
{
//As we do not have any content yet, we want all feed items
//since the year 1970 (usually RSS feeds contain 20-30 items).
Value arg = [
"ts" => 0,
"max" => 10
];
call(null, "syndService", "getItems", arg, ok, nok);
}
void ok(Object state, Value ret)
{
setBubble(null, "Got "+ret.size()+" items");
//print subjects to log
foreach (Value item : ret) {
printf("subject: "+item.title);
}
}
void nok(Object state, String error)
{
setBubble(null, "Syndication get failed: "+error);
}
} //class
widget.xml
<?xml version="1.0" encoding="utf-8"?>
<widget spec_version="2.0">
<info>
<name>example_syndication_service</name>
<version>1.0</version>
<author>example</author>
<clientversion>1.0</clientversion>
<shortdescription>Syndication Service Example</shortdescription>
<longdescription>Syndication Service Example</longdescription>
<tags>example syndicationservice</tags>
</info>
<parameters>
<parameter name="widgetname">Syndication Service</parameter>
<parameter type="url" name="url" editable="false">
<value>http://digg.com//rss/index.xml</value>
</parameter>
</parameters>
<services>
<service type="syndication" id="syndService">
<reference from="url" to="feedurl"/>
</service>
</services>
<resources>
<code src="syndication_service.he"/>
<stylesheet>
mini {
background: solid white;
color: black;
align: vcenter hcenter;
}
maxi {
background: solid white;
padding: 5 5 5 5;
}
flow {
background: solid white;
}
</stylesheet>
</resources>
<layout minimizedheight="2em">
<view id="viewMini" class="mini">
<label class="mini">${widgetname}</label>
</view>
</layout>
</widget>


