add more spacing
[personal-kdebase.git] / workspace / kmenuedit / main.cpp
blob13137f15cabe275d7ce53ac2a00eea3cac7286e2
1 /*
2 * Copyright (C) 2000 Matthias Elter <elter@kde.org>
3 * Copyright (C) 2001-2002 Raffaele Sandrini <sandrini@kde.org)
4 * Copyright (C) 2008 Montel Laurent <montel@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 Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <unistd.h>
24 #include <kuniqueapplication.h>
25 #include <klocale.h>
26 #include <kcmdlineargs.h>
27 #include <kaboutdata.h>
29 #include "kmenuedit.h"
30 #ifndef Q_WS_WIN
31 #include "khotkeys.h"
32 #endif
34 static const char description[] = I18N_NOOP("KDE menu editor");
35 static const char version[] = "0.8";
37 static KMenuEdit *menuEdit = 0;
39 class KMenuApplication : public KUniqueApplication
41 public:
42 KMenuApplication() { }
43 #ifndef Q_WS_WIN
44 virtual ~KMenuApplication() { KHotKeys::cleanup(); }
45 #endif
46 virtual int newInstance()
48 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
49 if (args->count() > 0)
51 menuEdit->selectMenu(args->arg(0));
52 if (args->count() > 1)
54 menuEdit->selectMenuEntry(args->arg(1));
57 args->clear();
58 return KUniqueApplication::newInstance();
63 extern "C" int KDE_EXPORT kdemain( int argc, char **argv )
65 KAboutData aboutData("kmenuedit", 0, ki18n("KDE Menu Editor"),
66 version, ki18n(description), KAboutData::License_GPL,
67 ki18n("(C) 2000-2003, Waldo Bastian, Raffaele Sandrini, Matthias Elter"));
68 aboutData.addAuthor(ki18n("Waldo Bastian"), ki18n("Maintainer"), "bastian@kde.org");
69 aboutData.addAuthor(ki18n("Raffaele Sandrini"), ki18n("Previous Maintainer"), "sandrini@kde.org");
70 aboutData.addAuthor(ki18n("Matthias Elter"), ki18n("Original Author"), "elter@kde.org");
71 aboutData.addAuthor(ki18n("Montel Laurent"), KLocalizedString(), "montel@kde.org");
73 KCmdLineArgs::init( argc, argv, &aboutData );
74 KUniqueApplication::addCmdLineOptions();
76 KCmdLineOptions options;
77 options.add("+[menu]", ki18n("Sub menu to pre-select"));
78 options.add("+[menu-id]", ki18n("Menu entry to pre-select"));
79 KCmdLineArgs::addCmdLineOptions( options );
81 if (!KUniqueApplication::start())
82 return 1;
84 KMenuApplication app;
86 menuEdit = new KMenuEdit();
87 menuEdit->show();
89 return app.exec();