diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #if HAVE_X11 @@ -122,6 +123,24 @@ parser.addOption(threadOption); parser.addOption(dialogOption); + // Add all unknown options but make sure to print a warning. + // This enables older DrKonqi's to run by newer KCrash instances with + // possibly different/new options. + // KCrash can always send all options it knows to send and be sure that + // DrKonqi will not explode on them. If an option is not known here it's + // either too old or too new. + // + // To implement this smartly we'll ::parse all arguments, and then ::process + // them again once we have injected no-op options for all unknown ones. + // This allows ::process to still do common argument handling for --version + // as well as standard error handling. + if (!parser.parse(qa.arguments())) { + for (const QString &option : parser.unknownOptionNames()) { + qWarning() << "Unknown option" << option << " - ignoring it."; + parser.addOption(QCommandLineOption(option)); + } + } + parser.process(qa); aboutData.processCommandLine(&parser);