File Add-nofork-as-compatibility-alias-for-separate.patch of Package konsole

From c6ffcaff557760f46ba5813823868e656b45da0f Mon Sep 17 00:00:00 2001
From: Harald Sitter <sitter@kde.org>
Date: Mon, 19 Dec 2016 09:09:03 +0100
Subject: Add --nofork as compatibility alias for --separate

In previous incarnations of kuniqueapplication it used to inject a common
command option --nofork which is meant to bypass single-instance behavior.
Given that konsole can and is being invoked from scripts they may well want
to ensure that the fork they created is the actual instance of konsole.
i.e. to monitor return values and life time

Presently, since the options are divergent between konsole4 and konsole5,
scripts are either incompatible with older konsoles or with newer konsoles.
To make life easier for everyone add a compat alias --nofork, which
behaves exactly like separate.

(this unbreaks steam, which is a notable recent offender of falling into
 this particular trap)

REVIEW: 129647
CHANGELOG: Added compatibility command option `--nofork` for single-instance behavior
---
 src/Application.cpp | 3 ++-
 src/main.cpp        | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Application.cpp b/src/Application.cpp
index 5b352ec..e04264a 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -74,7 +74,8 @@ void Application::populateCommandLineParser(QCommandLineParser *parser)
     parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("background-mode"),
                                         i18nc("@info:shell", "Start Konsole in the background and bring to the front"
                                               " when Ctrl+Shift+F12 (by default) is pressed")));
-    parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("separate"), i18n("Run in a separate process")));
+    // --nofork is a compatibility alias for separate
+    parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("separate") << QStringLiteral("nofork"), i18n("Run in a separate process")));
     parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("show-menubar"), i18nc("@info:shell", "Show the menubar, overriding the default setting")));
     parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("hide-menubar"), i18nc("@info:shell", "Hide the menubar, overriding the default setting")));
     parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("show-tabbar"), i18nc("@info:shell", "Show the tabbar, overriding the default setting")));
diff --git a/src/main.cpp b/src/main.cpp
index 26d3da9..f4bb5af 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -222,7 +222,10 @@ bool shouldUseNewProcess(int argc, char *argv[])
     }
 
     // if users have explictly requested starting a new process
-    if (arguments.contains(QStringLiteral("--separate"))) {
+    // Support --nofork to retain argument compatibility with older
+    // versions.
+    if (arguments.contains(QStringLiteral("--separate")) ||
+        arguments.contains(QStringLiteral("--nofork"))) {
         return true;
     }
 
-- 
cgit v0.11.2

openSUSE Build Service is sponsored by