2
* Copyright (C) 2000 Matthias Elter <elter@kde.org>
3
* Copyright (C) 2001-2002 Raffaele Sandrini <sandrini@kde.org)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include <kuniqueapplication.h>
25
#include <kcmdlineargs.h>
26
#include <kaboutdata.h>
28
#include "kmenuedit.h"
31
static const char description[] = I18N_NOOP("KDE menu editor");
32
static const char version[] = "0.7";
34
static KMenuEdit *menuEdit = 0;
36
class KMenuApplication : public KUniqueApplication
39
KMenuApplication() { }
40
virtual ~KMenuApplication() { KHotKeys::cleanup(); }
42
virtual int newInstance()
44
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
45
if (args->count() > 0)
47
menuEdit->selectMenu(args->arg(0));
48
if (args->count() > 1)
50
menuEdit->selectMenuEntry(args->arg(1));
54
return KUniqueApplication::newInstance();
59
extern "C" int KDE_EXPORT kdemain( int argc, char **argv )
61
KAboutData aboutData("kmenuedit", 0, ki18n("KDE Menu Editor"),
62
version, ki18n(description), KAboutData::License_GPL,
63
ki18n("(C) 2000-2003, Waldo Bastian, Raffaele Sandrini, Matthias Elter"));
64
aboutData.addAuthor(ki18n("Waldo Bastian"), ki18n("Maintainer"), "bastian@kde.org");
65
aboutData.addAuthor(ki18n("Raffaele Sandrini"), ki18n("Previous Maintainer"), "sandrini@kde.org");
66
aboutData.addAuthor(ki18n("Matthias Elter"), ki18n("Original Author"), "elter@kde.org");
68
KCmdLineArgs::init( argc, argv, &aboutData );
69
KUniqueApplication::addCmdLineOptions();
71
KCmdLineOptions options;
72
options.add("+[menu]", ki18n("Sub menu to pre-select"));
73
options.add("+[menu-id]", ki18n("Menu entry to pre-select"));
74
KCmdLineArgs::addCmdLineOptions( options );
76
if (!KUniqueApplication::start())
81
menuEdit = new KMenuEdit(false);
84
app.setMainWidget(menuEdit);