1 #include <kapplication.h>
2 #include <dcopclient.h>
4 #include <qdatastream.h>
6 #include <qstringlist.h>
10 #include <kcmdlineargs.h>
11 #include <ktoolinvocation.h>
13 class rssIface : virtual public DCOPObject
18 rssIface( KApplication *app)
20 // get our DCOP client and attach so that we may use it
21 DCOPClient *client = app->dcopClient();
25 kdDebug() << "Looking for rss service..." << endl;
26 if (!client->isApplicationRegistered("rssservice"))
28 kdDebug() << "Could not find service so I am starting it..." << endl;
29 if(KToolInvocation::startServiceByName("rssservice",QStringList(), &error, &appID ))
31 kdDebug() << "Starting rssservice failed with message: " << error << endl;
35 kdDebug ()<< "Accessing rssservice..." << endl;
37 if (!connectDCOPSignal(0,0, "documentUpdated(DCOPRef)",
38 "refresh(DCOPRef)",false))
39 kdDebug() << "Could not attach signal..." << endl;
41 kdDebug() << "attached dcop signals..." << endl;
43 QString url("http://freshmeat.net/backend/fm.rdf");
44 DCOPRef m_rssservice("rssservice","RSSService");
45 m_rssservice.call("load(QString)", url);
46 QStringList returnList = m_rssservice.call("list()");
47 DCOPRef doc = m_rssservice.call("document(QString)", returnList[0]);
48 QString title = doc.call("title()");
49 QString link = doc.call("link()");
50 QString description = doc.call("description()");
51 kdDebug() << title << endl;
52 kdDebug() << link << endl;
53 kdDebug() << description << endl;
57 virtual void refresh(DCOPRef doc)
59 QString title = doc.call("title()");
60 QString link = doc.call("link()");
61 QString description = doc.call("description()");
62 kdDebug() << title << endl;
63 kdDebug() << link << endl;
64 kdDebug() << description << endl;
71 int main(int argc
, char **argv
)
73 KCmdLineArgs::init( argc
, argv
, "client", 0, 0, 0, 0 );
74 KApplication
*app
= new KApplication(false);