Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / kquitapp / kquitapp.cpp
blob8d5125cdc148904329c70f77e782eb3ce0cc2b19
1 /*
2 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include <QDBusInterface>
21 #include <KAboutData>
22 #include <KCmdLineArgs>
23 #include <KLocale>
25 int main(int argc, char* argv[])
27 KAboutData aboutData( "kquitapp", 0, ki18n("Command line application quitter"),
28 "1.0", ki18n("Quit a D-Bus enabled application easily"), KAboutData::License_GPL,
29 ki18n("(c) 2006, Aaron Seigo") );
30 aboutData.addAuthor(ki18n("Aaron J. Seigo"), ki18n("Current maintainer"), "aseigo@kde.org");
31 KCmdLineArgs::init(argc, argv, &aboutData);
33 KCmdLineOptions options;
34 options.add("service", ki18n("Full service name, overrides application name provided"));
35 options.add("path <path>", ki18n("Path in the D-Bus interface to use"), "/MainApplication");
36 options.add("+application", ki18n("The name of the application to quit"));
37 KCmdLineArgs::addCmdLineOptions(options);
38 KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
40 if (args->count() == 0)
42 args->usage(0);
45 QString service;
46 if (args->isSet("service"))
48 service = args->getOption("service");
50 else
52 service = QString("org.kde.%1").arg(QString(args->arg(0)));
55 QString path("/MainApplication");
56 if (args->isSet("path"))
58 path = args->getOption("path");
61 QDBusInterface interface(service, path);
62 interface.call("quit");
63 return 0;