Commit 21c58773 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[webshortcutsrunner] Fix private browsing with some Firefoxes

Because we can't have nice things the private browsing action in Firefox
sometimes has a %u placeholder for the URL and sometimes doesn't.

The current code only accounts for the case without placeholder, which
is also what Chrome does.

Replace the placeholder if found, otherwise append the URL

(cherry picked from commit a1fdb95d)
parent 46fde8e8
......@@ -154,7 +154,19 @@ void WebshortcutRunner::run(const Plasma::RunnerContext &context, const Plasma::
if (!location.isEmpty()) {
if (match.selectedAction()) {
const auto command = m_privateAction.exec() + QLatin1Char(' ') + KShell::quoteArg(location.toString());
QString command;
// Chrome's exec line does not have a URL placeholder
// Firefox's does, but only sometimes, depending on the distro
// Replace placeholders if found, otherwise append at the end
if (m_privateAction.exec().contains("%u")) {
command = m_privateAction.exec().replace("%u", KShell::quoteArg(location.toString()));
} else if (m_privateAction.exec().contains("%U")) {
command = m_privateAction.exec().replace("%U", KShell::quoteArg(location.toString()));
} else {
command = m_privateAction.exec() + QLatin1Char(' ') + KShell::quoteArg(location.toString());
auto *job = new KIO::CommandLauncherJob(command);
} else {
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