| 1 | /***************************************************************************
|
|---|
| 2 | * Copyright (C) 2004 by Martin Merck *
|
|---|
| 3 | * merck@astro.uni-wuerzburg.de *
|
|---|
| 4 | * *
|
|---|
| 5 | * This software is part of the MAGIC software. *
|
|---|
| 6 | ***************************************************************************/
|
|---|
| 7 |
|
|---|
| 8 | #include "taper.h"
|
|---|
| 9 | #include <kapplication.h>
|
|---|
| 10 | #include <dcopclient.h>
|
|---|
| 11 | #include <kaboutdata.h>
|
|---|
| 12 | #include <kcmdlineargs.h>
|
|---|
| 13 | #include <klocale.h>
|
|---|
| 14 |
|
|---|
| 15 | static const char description[] =
|
|---|
| 16 | I18N_NOOP("A KDE Application");
|
|---|
| 17 |
|
|---|
| 18 | static const char version[] = "0.1";
|
|---|
| 19 |
|
|---|
| 20 | static KCmdLineOptions options[] =
|
|---|
| 21 | {
|
|---|
| 22 | { "+[URL]", I18N_NOOP( "Document to open." ), 0 },
|
|---|
| 23 | KCmdLineLastOption
|
|---|
| 24 | };
|
|---|
| 25 |
|
|---|
| 26 | int main(int argc, char **argv)
|
|---|
| 27 | {
|
|---|
| 28 | KAboutData about("taper", I18N_NOOP("Taper"), version, description,
|
|---|
| 29 | KAboutData::License_Custom, "(C) 2004 Martin Merck", 0, 0, "merck@astro.uni-wuerzburg.de");
|
|---|
| 30 | about.addAuthor( "Martin Merck", 0, "merck@astro.uni-wuerzburg.de" );
|
|---|
| 31 | KCmdLineArgs::init(argc, argv, &about);
|
|---|
| 32 | KCmdLineArgs::addCmdLineOptions(options);
|
|---|
| 33 | KApplication app;
|
|---|
| 34 |
|
|---|
| 35 | // register ourselves as a dcop client
|
|---|
| 36 | app.dcopClient()->registerAs(app.name(), false);
|
|---|
| 37 |
|
|---|
| 38 | // see if we are starting with session management
|
|---|
| 39 | if (app.isRestored())
|
|---|
| 40 | {
|
|---|
| 41 | RESTORE(Taper);
|
|---|
| 42 | }
|
|---|
| 43 | else
|
|---|
| 44 | {
|
|---|
| 45 | // no session.. just start up normally
|
|---|
| 46 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
|---|
| 47 | if (args->count() == 0)
|
|---|
| 48 | {
|
|---|
| 49 | Taper *widget = new Taper;
|
|---|
| 50 | widget->show();
|
|---|
| 51 | }
|
|---|
| 52 | else
|
|---|
| 53 | {
|
|---|
| 54 | int i = 0;
|
|---|
| 55 | for (; i < args->count(); i++)
|
|---|
| 56 | {
|
|---|
| 57 | Taper *widget = new Taper;
|
|---|
| 58 | widget->show();
|
|---|
| 59 | widget->load(args->url(i));
|
|---|
| 60 | }
|
|---|
| 61 | }
|
|---|
| 62 | args->clear();
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | return app.exec();
|
|---|
| 66 | }
|
|---|