From e9ae80694875f869892f13f4fcaf1170a00dea41 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/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kommander/pluginmanager/main.cpp | 101 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 kommander/pluginmanager/main.cpp (limited to 'kommander/pluginmanager/main.cpp') diff --git a/kommander/pluginmanager/main.cpp b/kommander/pluginmanager/main.cpp new file mode 100644 index 00000000..cdbf9cd5 --- /dev/null +++ b/kommander/pluginmanager/main.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** + main.cpp - Kommander plugin manager interface + ------------------- + begin : Tue Aug 13 09:31:50 EST 2002 + copyright : (C) 2004 Marc Britton + (C) 2005 Michal Rudolf + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/* KDE INCLUDES */ +#include +#include +#include +#include +#include +#include +#include + +/* QT INCLUDES */ +#include + +/* OTHER INCLUDES */ +#include "pluginmanager.h" +#include "mainwindow.h" +#include "kommanderversion.h" + +#include +using namespace std; + +static const char *description = + I18N_NOOP("kmdr-plugins is a component of the Kommander dialog system that manages installed plugins."); +// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE + + +static KCmdLineOptions options[] = +{ + { "a", 0, 0}, + { "add ", I18N_NOOP("Register given library"), 0}, + { "r", 0, 0}, + { "remove ", I18N_NOOP("Remove given library"), 0}, + { "c", 0, 0}, + { "check", I18N_NOOP("Check all installed plugins and remove those missing"), 0}, + { "l", 0, 0}, + { "list", I18N_NOOP("List all installed plugins"), 0}, + KCmdLineLastOption +}; + +int main(int argc, char *argv[]) +{ + KLocale::setMainCatalogue("kommander"); + KAboutData aboutData( "kmdr-plugins", I18N_NOOP("Kommander Plugin Manager"), + KOMMANDER_VERSION, description, KAboutData::License_GPL, + "(C) 2004-2005 Kommander authors"); + aboutData.addAuthor("Marc Britton", "Original author", "consume@optusnet.com.au"); + aboutData.addAuthor("Eric Laffoon", "Project manager", "eric@kdewebdev.org"); + aboutData.addAuthor("Michal Rudolf", "Current maintainer", "mrudolf@kdewebdev.org"); + KCmdLineArgs::init(argc, argv, &aboutData); + KCmdLineArgs::addCmdLineOptions(options); // Add our own options. + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + KApplication app; + + if (!args->getOption("add").isNull() || !args->getOption("remove").isNull() || args->isSet("check") || args->isSet("list")) + { + PluginManager P; + if (args->isSet("check")) + P.verify(); + + QCStringList items = args->getOptionList("add"); + for (QCStringList::ConstIterator it = items.begin(); it != items.end(); ++it) + if (!P.add(*it)) + cerr << i18n("Error adding plugin '%1'").arg(*it).local8Bit(); + + items = args->getOptionList("remove"); + for (QCStringList::ConstIterator it = items.begin(); it != items.end(); ++it) + if (!P.remove(*it)) + cerr << i18n("Error removing plugin '%1'").arg(*it).local8Bit(); + + if (args->isSet("list")) + { + QStringList plugins = P.items(); + for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) + cout << (*it).local8Bit() << "\n"; + } + } + else + { + MainWindow *mw = new MainWindow(); + app.setMainWidget(mw); + mw->show(); + return app.exec(); + } +} -- cgit v1.2.1