summaryrefslogtreecommitdiffstats
path: root/kweather/reportmain.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitae2a03c2941bf92573f89b88ef73f8aa842bea0a (patch)
tree3566563f3fb6ac3cb3496669d8f233062d3091bc /kweather/reportmain.cpp
downloadtdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.tar.gz
tdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kweather/reportmain.cpp')
-rw-r--r--kweather/reportmain.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/kweather/reportmain.cpp b/kweather/reportmain.cpp
new file mode 100644
index 0000000..198263a
--- /dev/null
+++ b/kweather/reportmain.cpp
@@ -0,0 +1,63 @@
+#include "reportview.h"
+
+#include <stdlib.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kdebug.h>
+#include <kaboutdata.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <dcopclient.h>
+
+static KCmdLineOptions options[] =
+{
+ { "+location", I18N_NOOP( "METAR location code for the report" ), 0 },
+ KCmdLineLastOption
+};
+
+extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
+{
+ KAboutData aboutData("reportview", I18N_NOOP("Weather Report"),
+ "0.8", I18N_NOOP("Weather Report for KWeatherService"),
+ KAboutData::License_GPL, "(C) 2002-2003, Ian Reinhart Geiser");
+ aboutData.addAuthor("Ian Reinhart Geiser", I18N_NOOP("Developer"),
+ "geiseri@kde.org");
+ aboutData.addAuthor("Nadeem Hasan", I18N_NOOP("Developer"),
+ "nhasan@kde.org");
+
+ KGlobal::locale()->setMainCatalogue( "kweather" );
+
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options );
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if ( args->count() != 1 )
+ {
+ args->usage();
+ return -1;
+ }
+
+ KApplication app;
+
+ DCOPClient *client = app.dcopClient();
+ client->attach();
+ QString error;
+ if (!client->isApplicationRegistered("KWeatherService"))
+ {
+ if (KApplication::startServiceByDesktopName("kweatherservice",
+ QStringList(), &error))
+ {
+ kdDebug() << "Starting kweatherservice failed: " << error << endl;
+ return -2;
+ }
+ }
+
+ QString reportLocation = args->arg( 0 );
+ reportView *report = new reportView(reportLocation);
+ args->clear();
+ report->exec();
+
+ delete report;
+
+ return 0;
+}