int main(int argc, char **argv) { KAboutData about("khotnewstuff", 0, ki18n("KHotNewStuff"), "0.4"); about.setProgramIconName("get-hot-new-stuff"); KCmdLineArgs *args; KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions op; op.add("+filename", ki18n("Name of .knsrc file to use")); op.add("+filename", ki18n("Name of file to upload")); KCmdLineArgs::addCmdLineOptions(op); args = KCmdLineArgs::parsedArgs(); KApplication i; if (args->count() > 0) { KNS3::UploadDialog dialog(args->arg(0)); if (args->count() > 1) { dialog.setUploadFile(KUrl(args->arg(1))); } dialog.exec(); } else { args->usage(); return -1; } return 0; }
int main(int argc, char** argv) { qsrand(time(0)); KAboutData about("palapeli", 0, ki18nc("The application's name", "Palapeli"), "2.0", ki18n("KDE Jigsaw Puzzle Game"), KAboutData::License_GPL, ki18n("Copyright 2009, 2010, Stefan Majewsky")); about.addAuthor(ki18n("Stefan Majewsky"), KLocalizedString(), "*****@*****.**", "http://majewsky.wordpress.com"); about.addCredit (ki18n ("Johannes Loehnert"), ki18n ("The option to preview the completed puzzle"), "*****@*****.**"); about.setHomepage("https://www.kde.org/applications/games/palapeli/"); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add("+puzzlefile", ki18n("Path to puzzle file (will be opened if -i is not given)")); options.add("i").add("import", ki18n("Import the given puzzle file into the local collection (does nothing if no puzzle file is given)")); options.add("", ki18n("If the -i/--import option is specified, the main window will not be shown after importing the given puzzle.")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); //NOTE: Syntax errors are reported on stderr, while file errors are presented to the user. if (args->isSet("import")) //perform import request new Palapeli::ImportHelper(args); else //no import request, show main window (new Palapeli::MainWindow(args))->show(); return app.exec(); }
int main(int argc, char **argv) { KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("embed <winid>", ki18n("Makes the dialog transient for an X app specified by winid")); options.add("+[URL]", ki18n("URL to install")); KCmdLineArgs::addCmdLineOptions(options); QSet<KUrl> urls; KCmdLineArgs *args(KCmdLineArgs::parsedArgs()); for(int i=0; i < args->count(); i++) urls.insert(args->url(i)); if(urls.count()) { KApplication app; QString opt(args->getOption("embed")); KFI::CInstaller inst(createParent(opt.size() ? opt.toInt(0, 16) : 0)); return inst.install(urls); } return -1; }
int main(int argc, char *argv[]) { QScopedPointer<KAboutData> aboutData( Gwenview::createAboutData( "gwenview", /* appname */ 0, /* catalogName */ ki18n("Gwenview") /* programName */ )); aboutData->setShortDescription(ki18n("An Image Viewer")); KCmdLineArgs::init(argc, argv, aboutData.data()); KCmdLineOptions options; options.add("f", ki18n("Start in fullscreen mode")); options.add("s", ki18n("Start in slideshow mode")); options.add("+[file or folder]", ki18n("A starting file or folder")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; Gwenview::ImageFormats::registerPlugins(); // startHelper must live for the whole life of the application StartHelper startHelper; if (app.isSessionRestored()) { kRestoreMainWindows<Gwenview::MainWindow>(); } else { startHelper.createMainWindow(); } return app.exec(); }
int main(int argc, char ** argv) { KCmdLineOptions options; options.add("+URL1", ki18n("The first URL to play")); options.add("+URL2", ki18n("The second URL to play")); KAboutData about("crossfade", 0, ki18n("Phonon Crossfade Example"), "1.0", KLocalizedString(), KAboutData::License_LGPL); about.addAuthor(ki18n("Matthias Kretz"), KLocalizedString(), "*****@*****.**"); KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::addCmdLineOptions(options); KApplication app; KUrl url1; KUrl url2; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() == 2) { url1 = args->url(0); url2 = args->url(1); if (url1.isValid() && url2.isValid()) { Crossfader xfader(url1, url2); return app.exec(); } } return 1; }
int main(int argc, char *argv[]) { KAboutData about("kapptest", 0, ki18n("kapptest"), "version"); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add("t"); options.add("type <name>", ki18n("The type of shutdown to emulate: Default, None, Reboot, Halt or Logout"), "None"); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KApplication a; KIconLoader::global()->addAppDir("ksmserver"); KSMShutdownFeedback::start(); QString sdtypeOption = args->getOption("type").toLower(); KWorkSpace::ShutdownType sdtype = KWorkSpace::ShutdownTypeDefault; if (sdtypeOption == "reboot") { sdtype = KWorkSpace::ShutdownTypeReboot; } else if (sdtypeOption == "halt") { sdtype = KWorkSpace::ShutdownTypeHalt; } else if (sdtypeOption == "logout") { sdtype = KWorkSpace::ShutdownTypeNone; } QString bopt; (void)KSMShutdownDlg::confirmShutdown( true, true, sdtype, bopt, "default" ); /* (void)KSMShutdownDlg::confirmShutdown( false, false, sdtype, bopt ); */ KSMShutdownFeedback::stop(); }
int main(int argc, char *argv[]) { // kdeinit waits for kcminit to finish, but during KDE startup // only important kcm's are started very early in the login process, // the rest is delayed, so fork and make parent return after the initial phase pipe( ready ); if( fork() != 0 ) { waitForReady(); return 0; } close( ready[ 0 ] ); startup = ( strcmp( argv[ 0 ], "kcminit_startup" ) == 0 ); // started from startkde? KAboutData aboutData( "kcminit", "kcminit", ki18n("KCMInit"), "", ki18n("KCMInit - runs startup initialization for Control Modules.")); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("list", ki18n("List modules that are run at startup")); options.add("+module", ki18n("Configuration module to run")); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KApplication app; QDBusConnection::sessionBus().interface()->registerService( "org.kde.kcminit", QDBusConnectionInterface::DontQueueService ); KLocale::setMainCatalog(0); KCMInit kcminit( KCmdLineArgs::parsedArgs()); return 0; }
int main(int argc, char *argv[]) { KAboutData aboutData( "gwenview", /* appname */ 0, /* catalogName */ ki18n("Gwenview"), /* programName */ GWENVIEW_VERSION); /* version */ aboutData.setShortDescription(ki18n("An Image Viewer")); aboutData.setLicense(KAboutData::License_GPL); aboutData.setCopyrightStatement(ki18n("Copyright 2000-2010 Aurélien Gâteau")); aboutData.addAuthor( ki18n("Aurélien Gâteau"), ki18n("Main developer"), "*****@*****.**"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("f", ki18n("Start in fullscreen mode")); options.add("s", ki18n("Start in slideshow mode")); options.add("+[file or folder]", ki18n("A starting file or folder")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; Gwenview::ImageFormats::registerPlugins(); // startHelper must live for the whole live of the application StartHelper startHelper; if (app.isSessionRestored()) { kRestoreMainWindows<Gwenview::MainWindow>(); } else { startHelper.createMainWindow(); } return app.exec(); }
int main(int argc, char *argv[]) { const KAboutData about( "konstruktor", "konstruktor", ki18n("Part database updater for Konstruktor"), "0.9.0-beta1", ki18n("Updates the part database. Must be called internally by Konstruktor."), KAboutData::License_GPL_V3, ki18n("(c)2006-2011, Park \"segfault\" Joon-Kyu")); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add("+[location]", ki18n("Path to LDraw part library")); options.add("rescan", ki18n("Rescan the entire library")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; int status; try { Konstruktor::DBUpdater updater; status = updater.start(); } catch (const std::runtime_error &e) { QMessageBox::critical(0L, i18n("Error"), QString(e.what())); status = -1; } app.exit(status); return status; }
int main(int argc, char **argv) { KAboutData about("soundkonverter", 0, ki18n("soundKonverter"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2005-2012 Daniel Faust"), KLocalizedString(), 0, "*****@*****.**"); about.addAuthor( ki18n("Daniel Faust"), KLocalizedString(), "*****@*****.**" ); about.addCredit( ki18n("David Vignoni"), ki18n("Nuvola icon theme"), 0, "http://www.icon-king.com" ); about.addCredit( ki18n("Scott Wheeler"), ki18n("TagLib"), "*****@*****.**", "http://ktown.kde.org/~wheeler" ); about.addCredit( ki18n("Marco Nelles"), ki18n("Audex"), 0, "http://opensource.maniatek.de/audex" ); about.addCredit( ki18n("Amarok developers"), ki18n("Amarok"), 0, "http://amarok.kde.org" ); about.addCredit( ki18n("All programmers of audio converters"), ki18n("Backends") ); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add( "replaygain", ki18n("Open the Replay Gain tool an add all given files") ); options.add( "rip <device>", ki18n("List all tracks on the cd drive <device>, 'auto' will search for a cd") ); options.add( "profile <profile>", ki18n("Add all files using the given profile") ); options.add( "format <format>", ki18n("Add all files using the given format") ); options.add( "output <directory>", ki18n("Output all files to <directory>") ); options.add( "invisible", ki18n("Start soundKonverter invisible") ); options.add( "autostart", ki18n("Start the conversion immediately (enabled when using '--invisible')") ); options.add( "autoclose", ki18n("Close soundKonverter after all files are converted (enabled when using '--invisible')") ); options.add( "command <command>", ki18n("Execute <command> after each file has been converted (%i=input file, %o=output file)") ); options.add( "+[files]", ki18n("Audio file(s) to append to the file list") ); KCmdLineArgs::addCmdLineOptions(options); soundKonverterApp::addCmdLineOptions(); if( !soundKonverterApp::start() ) { return 0; } soundKonverterApp app; // mainWin has WDestructiveClose flag by default, so it will delete itself. return app.exec(); }
int main( int argc, char *argv[] ) { KAboutData about("kooka", // appName "", // catalogName ki18n("Kooka"), // programName #if VCS_AVAILABLE (VERSION " (" VCS_TYPE " " VCS_REVISION ")"), #else VERSION, // version #endif ki18n(shortDesc), // shortDescription KAboutData::License_GPL_V2, // licenseType ki18n(copyright), // copyrightStatement ki18n(longDesc), // text "http://techbase.kde.org/Projects/Kooka"); about.addAuthor(ki18n("Jonathan Marten"), ki18n("Current maintainer, KDE4 port"), "*****@*****.**"); about.addAuthor(ki18n("Klaas Freitag"), ki18n("Developer"), "*****@*****.**"); about.addCredit(ki18n("Mat Colton"), ki18n("Graphics, web"), "*****@*****.**"); about.addCredit(ki18n("Ivan Shvedunov"), ki18n("Original kscan application"), "*****@*****.**"); about.addCredit(ki18n("Alex Kempshall"), ki18n("Photocopy facility"), "*****@*****.**"); about.addLicenseText(ki18n(addLicense)); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add("d <device>", ki18n("The SANE device specification (e.g. 'umax:/dev/sg0')")); options.add("g", ki18n("Gallery mode - do not connect to scanner")); KCmdLineArgs::addCmdLineOptions(options); // Add my own options KApplication app; KGlobal::locale()->insertCatalog("libkscan"); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); QString devToUse = args->getOption("d"); if (args->isSet("g")) { devToUse = "gallery"; } kDebug() << "DevToUse is" << devToUse; // TODO: not sure what this did // if (args->count()==1) // { // args->usage(); // // exit(-1); // } // TODO: try ScanGlobal::init(), if that fails no point in carrying on // so show an error box and give up (or can we carry on and run in // gallery mode only?) Kooka *kooka = new Kooka(devToUse.toLocal8Bit()); kooka->show(); app.processEvents(); kooka->startup(); args->clear(); return (app.exec()); }
int main(int argc, char **argv) { KAboutData about("kglobalsettingsclient", 0, ki18n("kglobalsettingsclient"), "version"); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add("p", ki18n("emit paletteChanged()")); options.add("f", ki18n("emit fontChanged()")); options.add("ps", ki18n("emit settingsChanged(SETTINGS_PATH)")); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KComponentData componentData(&about); // for KConfig QApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv(), false ); if (args->isSet("p")) { kDebug() << "emitChange(PaletteChanged)"; KGlobalSettings::self()->emitChange(KGlobalSettings::PaletteChanged); return 0; } else if (args->isSet("f")) { kDebug() << "emitChange(FontChanged)"; KGlobalSettings::self()->emitChange(KGlobalSettings::FontChanged); return 0; } else if (args->isSet("ps")) { kDebug() << "emitChange(SettingsChanged)"; KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_PATHS); return 0; } KCmdLineArgs::usage("No action specified"); return 1; //notreached }
int main( int argc, char **argv ) { KAboutData aboutData("kmenuedit", 0, ki18n("KDE Menu Editor"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2000-2003, Waldo Bastian, Raffaele Sandrini, Matthias Elter")); aboutData.addAuthor(ki18n("Waldo Bastian"), ki18n("Maintainer"), "*****@*****.**"); aboutData.addAuthor(ki18n("Raffaele Sandrini"), ki18n("Previous Maintainer"), "*****@*****.**"); aboutData.addAuthor(ki18n("Matthias Elter"), ki18n("Original Author"), "*****@*****.**"); aboutData.addAuthor(ki18n("Montel Laurent"), KLocalizedString(), "*****@*****.**"); KCmdLineArgs::init( argc, argv, &aboutData ); KUniqueApplication::addCmdLineOptions(); KCmdLineOptions options; options.add("+[menu]", ki18n("Sub menu to pre-select")); options.add("+[menu-id]", ki18n("Menu entry to pre-select")); KCmdLineArgs::addCmdLineOptions( options ); if (!KUniqueApplication::start()) return 1; KMenuApplication app; menuEdit = new KMenuEdit(); menuEdit->show(); return app.exec(); }
int main ( int argc, char *argv[] ) { KAboutData aboutData( "aku", 0, ki18n("aKu"), "SVN", ki18n("The RAR application for KDE4"), KAboutData::License_GPL_V3, ki18n("Copyright (c) 2008")); aboutData.addAuthor(ki18n("Alessandro Diaferia aka \"The Speedy Coder\""), ki18n("Main Developer"), "*****@*****.**"); aboutData.addAuthor(ki18n("Francesco Grieco aka \"The Japanese GUI stylist\""), ki18n("Developer"), "*****@*****.**"); // chiamata per disattivare il report dei bugs a kde4 aboutData.setCustomAuthorText(ki18n(0), ki18n(0)); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("+[archive]", ki18n("Makes aKu open the archive specified")); options.add("extracthere", ki18n("Extracts all files in the archive path")); // FIXME: extracthere <destination> options.add("extractto", ki18n("Extracts all files in a selected path")); KCmdLineArgs::addCmdLineOptions( options ); KApplication app; QString loIcon = KIconLoader().iconPath("aku",-KIconLoader::SizeEnormous ); QApplication::setWindowIcon(KIcon(loIcon)); //QApplication::setWindowIcon( KIcon( "utilities-file-archiver" ) ); ///TEMP ICON QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); MainWindow * mw = new MainWindow(); mw->show(); // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); return app.exec(); }
int main(int argc, char **argv) { KAboutData aboutData("kstartperf", 0, ki18n("KStartPerf"), "1.0", ki18n("Measures start up time of a KDE application"), KAboutData::License_Artistic, ki18n("Copyright (c) 2000 Geert Jansen and libkmapnotify authors")); aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"), "*****@*****.**", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("+command", ki18n("Specifies the command to run")); options.add("!+[args]", ki18n("Arguments to 'command'")); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KComponentData componentData( &aboutData ); QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() ); // Check arguments if (args->count() == 0) { fprintf(stderr, "No command specified!\n"); fprintf(stderr, "usage: kstartperf command [arguments]\n"); exit(1); } // Build command char cmd[1024]; snprintf(cmd, sizeof(cmd), "LD_PRELOAD=%s %s", qPrintable( libkstartperf() ), qPrintable(args->arg(0))); for (int i=1; i<args->count(); i++) { strcat(cmd, " "); strcat(cmd, args->arg(i).toLocal8Bit()); } // Put the current time in the environment variable `KSTARTPERF' struct timeval tv; if (gettimeofday(&tv, 0L) != 0) { perror("gettimeofday()"); exit(1); } char env[100]; sprintf(env, "KSTARTPERF=%ld:%ld", tv.tv_sec, tv.tv_usec); putenv(env); // And exec() the command execl("/bin/sh", "sh", "-c", cmd, (void *)0); perror("execl()"); exit(1); }
void InfoCommand::setupCommandOptions(KCmdLineOptions &options) { AbstractCommand::setupCommandOptions(options); options.add("+[options]", ki18nc("@info:shell", "Options for command")); options.add("+collection|item", ki18nc("@info:shell", "The collection or item")); options.add(":", ki18nc("@info:shell", "Options for command:")); options.add("c").add("collection", ki18nc("@info:shell", "Assume that a collection is specified")); options.add("i").add("item", ki18nc("@info:shell", "Assume that an item is specified")); }
void ExportCommand::setupCommandOptions(KCmdLineOptions& options) { AbstractCommand::setupCommandOptions(options); addOptionsOption(options); options.add("+collection", ki18nc("@info:shell", "The collection to export")); options.add("+file", ki18nc("@info:shell", "The file to export to")); addOptionSeparator(options); addDryRunOption(options); }
void CreateCommand::setupCommandOptions(KCmdLineOptions &options) { AbstractCommand::setupCommandOptions(options); options.add("+[options]", ki18nc("@info:shell", "Options for command")); options.add( "+collection", ki18nc( "@info:shell", "The collection to create, either as a path or a name (with a parent specified)")); options.add(":", ki18nc("@info:shell", "Options for command:")); options.add("p").add("parent <collection>", ki18nc("@info:shell", "Parent collection to create in")); options.add("n").add("dryrun", ki18nc("@info:shell", "Run without making any actual changes")); }
int main(int argc, char **argv) { KAboutData about(QByteArray("microbe"), QByteArray("languages"), ki18n("Microbe"), QByteArray(version), ki18n(description), KAboutData::License_GPL, ki18n("(C) 2004-2005, The KTechLab developers"), KLocalizedString(), QByteArray("http://ktechlab.org"), QByteArray("*****@*****.**") ); about.addAuthor( ki18n("Daniel Clarke"), KLocalizedString(), QByteArray("*****@*****.**") ); about.addAuthor( ki18n("David Saxton"), KLocalizedString(), QByteArray("*****@*****.**") ); about.addAuthor( ki18n("Modified to add pic 16f877,16f627 and 16f628 by George John"), KLocalizedString(), QByteArray("*****@*****.**") ); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions o; o.add( QByteArray("show-source"), ki18n( "Show source code lines in assembly output") ); o.add( QByteArray("nooptimize"), ki18n( "Do not attempt optimization of generated instructions.") ); o.add( QByteArray("+[Input URL]"), ki18n( "Input filename" ) ); o.add( QByteArray("+[Output URL]"), ki18n( "Output filename" ) ); KCmdLineArgs::addCmdLineOptions(o); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() == 2 ) { Microbe mb; // QString s = mb.compile( args->arg(0), args->isSet("show-source"), args->isSet("optimize")); QString s = mb.compile( args->arg(0), args->isSet("optimize")); QString errorReport = mb.errorReport(); if ( !errorReport.isEmpty() ) { kError() << errorReport; return 1; // If there was an error, don't write the output to file. } else { QFile outFile(args->arg(1)); outFile.open(QIODevice::WriteOnly); QDataStream out(&outFile); out << s; return 0; } } else args->usage(); }
// This gets called before entering KApplication::KApplication bool KoApplication::initHack() { KCmdLineOptions options; options.add("print", ki18n("Only print and exit")); options.add("template", ki18n("Open a new document with a template")); options.add("dpi <dpiX,dpiY>", ki18n("Override display DPI")); options.add("export-pdf", ki18n("Only export to PDF and exit")); options.add("export-filename <filename>", ki18n("Filename for export-pdf")); KCmdLineArgs::addCmdLineOptions(options, ki18n("KOffice"), "koffice", "kde"); return true; }
int main( int argc, char **argv ) { KAboutData aboutData( "khc_indexbuilder", 0, ki18n("KHelpCenter Index Builder"), HELPCENTER_VERSION, ki18n("The KDE Help Center"), KAboutData::License_GPL, ki18n("(c) 2003, The KHelpCenter developers") ); aboutData.addAuthor( ki18n("Cornelius Schumacher"), KLocalizedString(), "*****@*****.**" ); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineOptions options; options.add("+cmdfile", ki18n("Document to be indexed")); options.add("+indexdir", ki18n("Index directory")); KCmdLineArgs::addCmdLineOptions( options ); // Note: no KComponentData seems necessary QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if ( args->count() != 2 ) { kDebug(1402) << "Wrong number of arguments."; return 1; } QString cmdFile = args->arg( 0 ); QString indexDir = args->arg( 1 ); kDebug(1402) << "cmdFile: " << cmdFile; kDebug(1402) << "indexDir: " << indexDir; QFile file( indexDir + "/testaccess" ); if ( !file.open( QIODevice::WriteOnly ) || !file.putChar( ' ' ) ) { kDebug(1402) << "access denied"; return 2; } else { kDebug(1402) << "can access"; file.remove(); } IndexBuilder builder(cmdFile); QTimer::singleShot(0, &builder, SLOT(buildIndices())); return app.exec(); }
int main( int argc, char **argv ) { KAboutData aboutData( "testvcalexport", 0, ki18n( "Part of LibKCal's test suite. Checks if export " "to vCalendar still works correctly." ), "0.1" ); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineOptions options; options.add( "verbose", ki18n( "Verbose output" ) ); options.add( "+input", ki18n( "Name of input file" ) ); options.add( "+output", ki18n( "Name of output file" ) ); KCmdLineArgs::addCmdLineOptions( options ); KComponentData componentData( &aboutData ); //QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if ( args->count() != 2 ) { args->usage( "Wrong number of arguments." ); } QString input = args->arg( 0 ); QString output = args->arg( 1 ); QFileInfo outputFileInfo( output ); output = outputFileInfo.absoluteFilePath(); kDebug() << "Input file:" << input; kDebug() << "Output file:" << output; MemoryCalendar::Ptr cal( new MemoryCalendar( KDateTime::UTC ) ); FileStorage instore( cal, input ); if ( !instore.load() ) { return 1; } QString tz = cal->nonKDECustomProperty( "X-LibKCal-Testsuite-OutTZ" ); if ( !tz.isEmpty() ) { cal->setViewTimeZoneId( tz ); } FileStorage outstore( cal, output, new VCalFormat ); if ( !outstore.save() ) { return 1; } return 0; }
int main(int argc, char *argv[]) { KLocalizedString description = ki18n("HTTP Cookie Daemon"); const char version[] = "1.0"; KCmdLineArgs::init(argc, argv, "kcookiejar", "kdelibs4", ki18n("HTTP cookie daemon"), version, description); KCmdLineOptions options; options.add("shutdown", ki18n("Shut down cookie jar")); options.add("remove <domain>", ki18n("Remove cookies for domain")); options.add("remove-all", ki18n("Remove all cookies")); options.add("reload-config", ki18n("Reload configuration file")); KCmdLineArgs::addCmdLineOptions( options ); KComponentData a("kio4"); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); org::kde::KCookieServer *kcookiejar = new org::kde::KCookieServer("org.kde.kded", "/modules/kcookiejar", QDBusConnection::sessionBus()); if (args->isSet("remove-all")) { kcookiejar->deleteAllCookies(); } if (args->isSet("remove")) { QString domain = args->getOption("remove"); kcookiejar->deleteCookiesFromDomain(domain); } if (args->isSet("shutdown")) { org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus()); kded.unloadModule("kcookiejar"); } else if(args->isSet("reload-config")) { kcookiejar->reloadPolicy(); } else { org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus()); kded.loadModule("kcookiejar"); } delete kcookiejar; return 0; }
int main(int argc, char** argv) { KAboutData aboutData( "fractal-viewer", 0, ki18n("Fractal Viewer"), "1.0", ki18n("Test program."), KAboutData::License_GPL, ki18n("(c) 2014 Jordan Melo"), ki18n("Enables the exploration and rendering of fractals."), "http://jmelo.net/", "*****@*****.**" ); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("+[file]", ki18n("Document to open")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; MainWindow* window = new MainWindow(); window->show(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); return app.exec(); }
int main(int argc, char **argv) { const char *version = "0.5"; KLocalizedString description = ki18n("Unit test for .netrc and kionetrc parser."); KCmdLineOptions options; options.add("+command", ki18n("[url1,url2 ,...]")); KCmdLineArgs::init( argc, argv, "kionetrctest", 0, ki18n("KIO-netrc-test"), version, description ); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); int count = args->count(); KApplication app; if ( !count ) args->usage(); else { KUrl u; for( int i=0 ; i < count; i++ ) { u = args->arg(i); if ( !u.isValid() ) { kDebug() << u.url() << " is invalid! Ignoring..."; continue; } output( u ); } } args->clear(); return 0; }
int main(int argc, char *argv[]) { KCmdLineArgs::init(argc, argv, "krootimage", "kdmgreet", ki18n("KRootImage"), QByteArray(), ki18n("Fancy desktop background for kdm")); KCmdLineOptions options; options.add("+config", ki18n("Name of the configuration file")); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (!args->count()) args->usage(); KComponentData inst(KCmdLineArgs::aboutData()); MyApplication app(args->arg(0).toLocal8Bit(), KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv()); args->clear(); app.exec(); app.flush(); // Keep color resources after termination XSetCloseDownMode(QX11Info::display(), RetainTemporary); return 0; }
int main(int argc, char *argv[]) { KAboutData aboutData( "simon", 0, ki18n("Simon"), simon_version, ki18n("<html><head /><body>" "<h2>Development and Distribution</h2>" "<p>Developed in part by the non-profit organization" " <a href=\"http://simon-listens.org\">Simon listens e.V.</a>" " in cooperation with <a href=\"http://cyber-byte.at\">Cyber-Byte EDV Services</a>.</p>" "<h3>Special Thanks To</h3>" "<ul><li>Franz Stieger</li><li>Mathias Stieger</li><li>Phillip Theussl</li><li>Moacyr Prado</li><li>Michael Stieger</li><li>Ralf Herzog</li></ul>" "</body></html>"), KAboutData::License_GPL, ki18n("Copyright (c) 2008-2012 Peter Grasch, Phillip Goriup, Tschernegg Susanne, Bettina Sturmann, Martin Gigerl, Adam Nash, Frederik Gladhorn, Patrick von Reth, Alessadro Buggin, Mario Strametz, Vladislav Sitalo, Yash Shah") ); KCmdLineOptions options; options.add("nosplash", ki18n("Disable Simon's splash screen")); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs::init(argc, argv, &aboutData); SimonApplication app; app.setWindowIcon(KIcon("simon")); app.addLibraryPath(app.applicationDirPath()+"/plugins"); SimonView *pv = new SimonView(); Q_UNUSED(pv); int ret= app.exec(); // pv is deleted automatically return ret; }
int main(int argc, char **argv) { KAboutData aboutData("kppplogview", 0, ki18n("KPPP Log Viewer"), version, ki18n(description), KAboutData::License_GPL, ki18n("(c) 1999-2002, The KPPP Developers")); aboutData.addAuthor(ki18n("Bernd Wuebben"),KLocalizedString(), "*****@*****.**"); aboutData.addAuthor(ki18n("Mario Weilguni")); aboutData.addAuthor(ki18n("Harri Porten"),KLocalizedString(), "*****@*****.**"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions option; option.add("kppp", ki18n("Run in KPPP mode")); KCmdLineArgs::addCmdLineOptions( option ); KApplication a; loadLogs(); TopWidget *w = new TopWidget; w->show(); return a.exec(); }
int main( int argc, char *argv[] ) { KAboutData aboutData( "kopetewallettest", 0, ki18n("kopetewallettest"), "version" ); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineOptions opts; opts.add("+action"); KCmdLineArgs::addCmdLineOptions( opts ); KApplication app( "kopetewallettest" ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); // must register with DCOP or async callbacks will fail _out << "DCOP registration returned " << app.dcopClient()->registerAs(app.name()) << endl; for( int i = 0; i < args->count(); ++i ) { QString arg = args->arg( i ); _out << "Processing " << arg << endl; if( arg == QString::fromLatin1( "open" ) ) openWalletAsync(); if( arg == QString::fromLatin1( "close" ) ) closeWallet(); if( arg == QString::fromLatin1( "delay" ) ) delay(); _out << "Done." << endl; } WalletReciever *r = new WalletReciever; QTimer timer; r->connect( &timer, SIGNAL(timeout()), SLOT(timer()) ); timer.start( 1000 ); _out << "About to start 30 second event loop" << endl; QTimer::singleShot( 30000, qApp, SLOT(quit()) ); return qApp->exec(); }
int main(int argc, char *argv[]) { KCmdLineArgs::init(argc, argv, "testkhtml", 0, ki18n("Testkhtml"), "1.0", ki18n("a basic web browser using the KHTML library")); KCmdLineOptions options; options.add("+file", ki18n("url to open")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() == 0) { KCmdLineArgs::usage(); ::exit( 1 ); } TestKHTML *test = new TestKHTML; if (args->url(0).url().right(4).toLower() == ".xml") { KParts::OpenUrlArguments args(test->doc()->arguments()); args.setMimeType("text/xml"); test->doc()->setArguments(args); } test->openUrl(args->url(0)); test->show(); return app.exec(); }