summaryrefslogtreecommitdiffstats
path: root/librss/testlibrss.cpp
blob: d513b003b57dd04ecef8d5b01ebed0876f488706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "testlibrss.h"

#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <kdebug.h>

using namespace RSS;

void Tester::test()
{
	Loader *loader = Loader::create();
	connect( loader, TQT_SIGNAL( loadingComplete( Loader *, Document, tqStatus ) ),
	         this, TQT_SLOT( slotLoadingComplete( Loader *, Document, tqStatus ) ) );
	loader->loadFrom( "http://sourceforge.net/export/rss2_projnews.php?group_id=29057&rss_fulltext=1", new FileRetriever );
}

void Tester::slotLoadingComplete( Loader *loader, Document doc, tqStatus status )
{
	if ( status == Success )
		kdDebug() << "Successfully retrieverd '" << doc.title() << "'" << endl;

	if ( status != Success )
		kdDebug() << "ERROR " << loader->errorCode() << endl;

	kapp->quit();
}

int main( int argc, char **argv )
{
	KAboutData aboutData( "testlibrss", "testlibrss", "0.1" );
	KCmdLineArgs::init( argc, argv, &aboutData );
	KApplication app;

	Tester tester;
	tester.test();

	return app.exec();
}

#include "testlibrss.moc"