Commit abc37a6a authored by Harald Sitter's avatar Harald Sitter 🚔

always support all command line options

with the current way options are handled we'd always have a tight lock
between kcrash and drkonqi making it unnecessarily difficult to add
new options because newer kcrashes cannot simply pass them regardless of
drkonqi's version.

- drkonqi 5.20 adds --displayName
- kcrash 5.70 adds support for passing --displayName
- kcrash now needs to somehow determine the precise version of drkonqi
  because passing --displayName to 5.19 or below results in exit1

by having drkonqi ignore unknown options we can eliminate this restriction
as kcrash can then simply always pass all arguments it knows (which it
needs to do for the entire so-series; 5.70 needs to still work with
plasma 5.0 in theory)

NB: 5.x still needs some variant of version checking as kcrash needs to
find out if drkonqi has this new behavior. come 6.x we would be able to
ignore versions entirely in kcrash

Test Plan: passing arbitrary cli options no longer causes drkonqi to exit in error

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision:
parent cbf29d79
......@@ -33,6 +33,7 @@
#include <KAboutData>
#include <KLocalizedString>
#include <QCommandLineParser>
#include <QDebug>
#include <config-drkonqi.h>
#if HAVE_X11
......@@ -122,6 +123,24 @@ int main(int argc, char* argv[])
// 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.";
Markdown is supported
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