summaryrefslogtreecommitdiffstats
path: root/arts/kde/kiotest.cc
blob: f838c4f779c1c0f95605821e6118b14b4eacc413 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <kmedia2.h>
#include <kcmdlineargs.h>
#include <connect.h>
#include <klocale.h>
#include <kapplication.h>
#include <kaboutdata.h>
#include "qiomanager.h"
#include "artskde.h"

using namespace std;
using namespace Arts;


static KCmdLineOptions options[] =
{
    { "+[URL]", I18N_NOOP("URL to open"), 0 },
    KCmdLineLastOption
};

int main(int argc, char **argv)
{
	TDEAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, "");
							  
	TDECmdLineArgs::init(argc,argv,&aboutData);
	TDECmdLineArgs::addCmdLineOptions(options); 	
	TDEApplication app;
	QIOManager qiomanager;
	Dispatcher dispatcher(&qiomanager);
	TDEIOInputStream stream;
	StdoutWriter writer;

	TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

	if(args->count())
	{
	    if(!stream.openURL(args->arg(0)))
	    {
		printf("can't open url");
		exit(1);
	    }
	}
	else
	    exit(1);
	    
	args->clear();
	
	connect(stream, writer);

	writer.start();
	stream.start();
	
	app.exec();
}