From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmenuedit/main.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 kmenuedit/main.cpp (limited to 'kmenuedit/main.cpp') diff --git a/kmenuedit/main.cpp b/kmenuedit/main.cpp new file mode 100644 index 000000000..abb4f5968 --- /dev/null +++ b/kmenuedit/main.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2000 Matthias Elter + * Copyright (C) 2001-2002 Raffaele Sandrini + +#include +#include +#include +#include + +#include "kmenuedit.h" +#include "khotkeys.h" + +static const char description[] = I18N_NOOP("KDE menu editor"); +static const char version[] = "0.7"; + +static const KCmdLineOptions options[] = +{ + { "+[menu]", I18N_NOOP("Sub menu to pre-select"), 0 }, + { "+[menu-id]", I18N_NOOP("Menu entry to pre-select"), 0 }, + KCmdLineLastOption +}; + +static KMenuEdit *menuEdit = 0; + +class KMenuApplication : public KUniqueApplication +{ +public: + KMenuApplication() { } + virtual ~KMenuApplication() { KHotKeys::cleanup(); } + + virtual int newInstance() + { + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->count() > 0) + { + menuEdit->selectMenu(QString::fromLocal8Bit(args->arg(0))); + if (args->count() > 1) + { + menuEdit->selectMenuEntry(QString::fromLocal8Bit(args->arg(1))); + } + } + return KUniqueApplication::newInstance(); + } +}; + + +extern "C" int KDE_EXPORT kdemain( int argc, char **argv ) +{ + KAboutData aboutData("kmenuedit", I18N_NOOP("KDE Menu Editor"), + version, description, KAboutData::License_GPL, + "(C) 2000-2003, Waldo Bastian, Raffaele Sandrini, Matthias Elter"); + aboutData.addAuthor("Waldo Bastian", I18N_NOOP("Maintainer"), "bastian@kde.org"); + aboutData.addAuthor("Raffaele Sandrini", I18N_NOOP("Previous Maintainer"), "sandrini@kde.org"); + aboutData.addAuthor("Matthias Elter", I18N_NOOP("Original Author"), "elter@kde.org"); + + KCmdLineArgs::init( argc, argv, &aboutData ); + KUniqueApplication::addCmdLineOptions(); + KCmdLineArgs::addCmdLineOptions( options ); + + if (!KUniqueApplication::start()) + return 1; + + KMenuApplication app; + + menuEdit = new KMenuEdit(false); + menuEdit->show(); + + app.setMainWidget(menuEdit); + return app.exec(); +} -- cgit v1.2.1