kiotest.cc
#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)
{
KAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", KAboutData::License_GPL, "");
KCmdLineArgs::init(argc,argv,&aboutData);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
QIOManager qiomanager;
Dispatcher dispatcher(&qiomanager);
KIOInputStream stream;
StdoutWriter writer;
KCmdLineArgs *args = KCmdLineArgs::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();
}
KApplication
KCmdLineArgs
KCmdLineArgs::parsedArgs
static KCmdLineArgs * parsedArgs(const char *id=0)
klocale.h
KCmdLineArgs::count
int count() const
KCmdLineOptions
I18N_NOOP
#define I18N_NOOP(x)
KAboutData
KCmdLineArgs::init
static void init(int _argc, char **_argv, const char *_appname, const char *programName, const char *_description, const char *_version, bool noKApp=false)
KCmdLineArgs::addCmdLineOptions
static void addCmdLineOptions(const KCmdLineOptions *options, const char *name=0, const char *id=0, const char *afterId=0)
KCmdLineArgs::arg
const char * arg(int n) const
KCmdLineArgs::clear
void clear()

KDE Home | KDE Accessibility Home | Description of Access Keys