/* * knewstickerstub.cpp * * Copyright (c) 2000, 2001 Frerich Raabe * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the * accompanying file 'COPYING'. */ #include #include #include #include #include #include "configaccess.h" static const char name[] = "knewstickerstub"; static const char verbname[] = I18N_NOOP("KNewsTickerStub"); static const char version[] = "0.3"; static const char description[] = I18N_NOOP("A frontend to the KNewsTicker configuration"); static const char copyright[] = I18N_NOOP("(c)2000, 2001 Frerich Raabe"); static const TDECmdLineOptions options[] = { {"a", 0, 0}, {"addrdf ", I18N_NOOP("Add the RDF/RSS file referenced by "), 0}, TDECmdLineLastOption }; int main(int argc, char **argv) { TDELocale::setMainCatalogue("knewsticker"); TDEAboutData aboutData(name, verbname, version, description, TDEAboutData::License_BSD, copyright); aboutData.addAuthor("Frerich Raabe", I18N_NOOP("Author"), "raabe@kde.org"); TDECmdLineArgs::init(argc, argv, &aboutData); TDECmdLineArgs::addCmdLineOptions(options); TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); TDEApplication app(false, false); DCOPClient *dcopClient = app.dcopClient(); dcopClient->attach(); TDEConfig cfg(TQString::fromLatin1("knewsticker_panelappletrc"), false, false); ConfigAccess configFrontend(&cfg); if (args->isSet("addrdf")) { TQStringList newsSources = configFrontend.newsSources(); // TODO: Use the "Suggest" functionality from addnewssourcedlgimpl.cpp here. TQString name = i18n("Unknown"); if (newsSources.contains(name)) for (unsigned int i = 0; ; i++) if (!newsSources.contains(i18n("Unknown %1").arg(i))) { name = i18n("Unknown %1").arg(i); break; } newsSources += name; TQString sourceFile = TQString(args->getOption("addrdf")); configFrontend.setNewsSource(NewsSourceBase::Data(name, sourceFile)); configFrontend.setNewsSources(newsSources); TQByteArray data; dcopClient->send("knewsticker", "KNewsTicker", "reparseConfig()", data); } args->clear(); return 0; }