1 /***************************************************************************
3 * Copyright (C) 2002-2003 Ian Reinhart Geiser <geiseri@kde.org> *
4 * Copyright (C) 2002-2003 Nadeem Hasan <nhasan@kde.org> *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 ***************************************************************************/
22 #include "reportview.h"
25 #include <kcmdlineargs.h>
27 #include <kapplication.h>
28 #include <kaboutdata.h>
31 #include <ktoolinvocation.h>
33 #include <QtDBus/QDBusConnection>
34 #include <QtDBus/QDBusConnectionInterface>
36 extern "C" KDE_EXPORT
int kdemain(int argc
, char *argv
[])
38 KAboutData
aboutData("reportview", 0, ki18n("Weather Report"),
39 "0.8", ki18n("Weather Report for KWeatherService"),
40 KAboutData::License_GPL
, ki18n("(C) 2002-2003, Ian Reinhart Geiser"));
41 aboutData
.addAuthor(ki18n("Ian Reinhart Geiser"), ki18n("Developer"),
43 aboutData
.addAuthor(ki18n("Nadeem Hasan"), ki18n("Developer"),
46 KGlobal::locale()->setMainCatalog( "kweather" );
48 KCmdLineArgs::init( argc
, argv
, &aboutData
);
50 KCmdLineOptions options
;
51 options
.add("+location", ki18n( "METAR location code for the report" ));
52 KCmdLineArgs::addCmdLineOptions( options
);
53 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
55 if ( args
->count() != 1 )
64 if(!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.KWeatherService"))
66 if (KToolInvocation::startServiceByDesktopName("kweatherservice",
67 QStringList(), &error
))
69 kDebug() << "Starting kweatherservice failed: " << error
;
74 QString reportLocation
= args
->arg( 0 );
76 reportView
*report
= new reportView(reportLocation
);