You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdebindings/kjsembed/docs/examples/dcop/rss.js

40 lines
954 B

#!/usr/bin/env kjscmd
function newArticles( articles )
{
var box = new TQVBox(main);
var count = articles.call("count()");
var label = new TQLabel(box);
var list = new KListBox(box);
label.text = count + " articles for " + articles.call("title()");
for( var idx = 0; idx < count; ++idx)
{
var article = articles.call("article(int)", idx);
list.insertItem( article.call( "title()" ));
}
box.show();
return true;
}
var main = new TQHBox(this)
var dcop = new DCOPInterface(this, "news");
dcop.publish("void newArticles(DCOPRef)");
var client = new DCOPClient(this);
var feeds = client.call( "rssservice", "RSSService", "list()" );
for( var idx = 0; idx < feeds.length; ++idx)
{
var doc = client.call( "rssservice", "RSSService", "add(TQString)", feeds[idx] );
client.connectDCOPSignal("rssservice", doc.obj(), "documentUpdated(DCOPRef)",
"news","newArticles(DCOPRef)");
doc.call("refresh()");
}
main.show();
application.exec();