Commit fbd123ad authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Do not repeat work done by KAboutData.setupCommandLine()

That one already calls parser.addHelpOption() and parser.addVersionOption()
parent a94e0552
......@@ -41,8 +41,7 @@ int main(int argc, char *argv[])
i18n("(c) 2016 Kai Uwe Broulik"));
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
aboutData.setupCommandLine(&parser);
QCommandLineOption applicationNameOption(QStringLiteral("application"), i18n("Name of the application that should be associated with this notification"), QStringLiteral("application"));
parser.addOption(applicationNameOption);
......@@ -57,8 +56,6 @@ int main(int argc, char *argv[])
QCommandLineOption persistentOption(QStringLiteral("persistent"), i18n("Keep the notification in the history until the user closes it"));
parser.addOption(persistentOption);
aboutData.setupCommandLine(&parser);
parser.addPositionalArgument(QStringLiteral("body"), i18n("The actual notification body text"));
parser.process(app);
......
......@@ -191,10 +191,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
aboutData.addAuthor(i18n("Matthias Elter"),QString(), "elter@kde.org");
aboutData.addAuthor(i18n("Matthias Ettrich"),QString(), "ettrich@kde.org");
aboutData.addAuthor(i18n("Waldo Bastian"),QString(), "bastian@kde.org");
KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringLiteral("list"), i18n("List all possible modules")));
......@@ -207,7 +206,6 @@ extern "C" Q_DECL_EXPORT int kdemain(int _argc, char *_argv[])
parser.parse(app.arguments());
aboutData.processCommandLine(&parser);
KAboutData::setApplicationData(aboutData);
parser.process(app);
......
......@@ -114,6 +114,7 @@ int main(int argc, char *argv[])
// NOTE: if you change the position of the -u switch, be sure to adjust it
// at the beginning of main()
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addPositionalArgument("command", i18n("Specifies the command to run as separate arguments"));
parser.addOption(QCommandLineOption("c", i18n("Specifies the command to run as one string"), "command"));
parser.addOption(QCommandLineOption("f", i18n("Run command under target uid if <file> is not writable"), "file"));
......@@ -132,9 +133,6 @@ int main(int argc, char *argv[])
parser.addOption(QCommandLineOption("attach", i18nc("Transient means that the kdesu app will be attached to the app specified by the winid so that it is like a dialog box rather than some separate program", "Makes the dialog transient for an X app specified by winid"), "winid"));
parser.addOption(QCommandLineOption("embed", i18n("Embed into a window"), "winid"));
#endif
parser.addHelpOption();
parser.addVersionOption();
//KApplication::disableAutoDcopRegistration();
// kdesu doesn't process SM events, so don't even connect to ksmserver
......@@ -153,7 +151,6 @@ int main(int argc, char *argv[])
#endif
}
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
int result = startApp(parser);
......
......@@ -141,8 +141,6 @@ int main(int argc, char ** argv)
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addHelpOption();
parser.addVersionOption();
parser.addOption(QCommandLineOption(QStringList() << "parent", i18n("Makes the dialog transient for the window specified by winid"), "winid"));
parser.addPositionalArgument("mimetype", i18n("File type to edit (e.g. text/html)"));
......
......@@ -125,8 +125,7 @@ int main( int argc, char **argv )
KAboutData::setApplicationData(data);
QCommandLineParser parser;
parser.addVersionOption();
parser.addHelpOption();
data.setupCommandLine(&parser);
parser.addOption(QCommandLineOption("noninteractive", i18n("Non-interactive use: no message boxes. If you don't want a "
"graphical connection, use --platform offscreen")));
......@@ -150,7 +149,6 @@ int main( int argc, char **argv )
// KCmdLineArgs::addTempFileOption();
data.setupCommandLine(&parser);
parser.process(app);
data.processCommandLine(&parser);
......
......@@ -37,10 +37,9 @@ int main(int argc, char *argv[])
KAboutData aboutData( QLatin1String("kmimetypefinder"), i18n("MIME Type Finder"), QLatin1String(PROJECT_VERSION ));
aboutData.setShortDescription(i18n("Gives the MIME type for a given file"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("c") << QLatin1String("content"), i18n("Use only the file content for determining the MIME type.")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("f") << QLatin1String("filename-only"), i18n("Whether use the file name only for determining the MIME type. Not used if -c is specified.")));
......
......@@ -303,14 +303,10 @@ int main( int argc, char *argv[] )
aboutData.addAuthor( i18n("Matthias Ettrich"), QString(), "ettrich@kde.org" );
aboutData.addAuthor( i18n("David Faure"), QString(), "faure@kde.org" );
aboutData.addAuthor( i18n("Richard J. Moore"), QString(), "rich@kde.org" );
KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("!+command"), i18n("Command to execute")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("service"), i18n("Alternative to <command>: desktop file to start. D-Bus service will be printed to stdout"), QLatin1String("desktopfile")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("url"), i18n("Optional URL to pass <desktopfile>, when using --service"), QLatin1String("url")));
......
......@@ -36,12 +36,10 @@ int main( int argc, char **argv )
aboutData.addAuthor(i18n("David Faure"), QString(), "faure@kde.org");
aboutData.setShortDescription(i18n("A command-line tool for querying the KDE trader system"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("mimetype"), i18n("A MIME type"), QLatin1String("mimetype")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("servicetype"), i18n("A servicetype, like KParts/ReadOnlyPart or KMyApp/Plugin"), QLatin1String("servicetype")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("constraint"), i18n("A constraint expressed in the trader query language"), QLatin1String("constraint")));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment