From 4f3e29ba57286eb8e3cb7c5c3814efc2bbb879ac Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 5 Nov 2024 16:50:06 +0100 Subject: [PATCH] Set default CLI as "show" for secondary application to allow reopening background app from Windows Menu. --- Linphone/core/App.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 08471c84c..1b4c93c5b 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -703,22 +703,27 @@ void App::sendCommand() { auto arguments = mParser->positionalArguments(); if (mParser->isSet("fetch-config")) arguments << "fetch-config=" + mParser->value("fetch-config"); static bool firstStart = true; // We can't erase positional arguments. So we get them on each restart. - if (firstStart && arguments.size() > 0) { + if (firstStart) { firstStart = false; if (isSecondary()) { // Send to primary - lDebug() << "Sending " << arguments; - for (auto i : arguments) { - sendMessage(i.toLocal8Bit(), -1); + if (arguments.size() > 0) { + lDebug() << log().arg("Sending") << arguments; + for (auto i : arguments) { + sendMessage(i.toLocal8Bit(), -1); + } + } else { + lDebug() << log().arg("No arguments. Sending show command"); + sendMessage("show", -1); } - } else { // Execute - lDebug() << "Executing " << arguments; + } else if (arguments.size() > 0) { // Execute + lDebug() << log().arg("Executing ") << arguments; for (auto i : arguments) { QString command(i); receivedMessage(0, i.toLocal8Bit()); } } } else if (isPrimary()) { - lDebug() << "Run waiting process"; + lDebug() << log().arg("Run waiting process"); receivedMessage(0, ""); } }