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.
24 #include <kuniqueapplication.h>
26 #include <kcmdlineargs.h>
27 #include <kaboutdata.h>
29 #include "kmenuedit.h"
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
42 KMenuApplication() { }
44 virtual ~KMenuApplication() { KHotKeys::cleanup(); }
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));
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())
86 menuEdit
= new KMenuEdit();