From 8c9f09b17a7987921b8de2515b9bac96ff3d9e18 Mon Sep 17 00:00:00 2001 From: nowrep Date: Fri, 15 Feb 2013 15:35:23 +0100 Subject: [PATCH] Improved arguments parsing in external download manager. Option to choose where exactly to put url (%d placeholder) instead of just appending it at the end of arguments. --- src/lib/downloads/downloadmanager.cpp | 9 ++++++++- src/lib/preferences/preferences.ui | 7 +++++++ translations/empty.ts | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index e9b441481..9337d92ad 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -75,6 +75,10 @@ void DownloadManager::loadSettings() m_externalExecutable = settings.value("ExternalManagerExecutable", QString()).toString(); m_externalArguments = settings.value("ExternalManagerArguments", QString()).toString(); settings.endGroup(); + + if (!m_externalArguments.contains(QLatin1String("%d"))) { + m_externalArguments.append(QLatin1String(" %d")); + } } void DownloadManager::show() @@ -101,7 +105,10 @@ void DownloadManager::keyPressEvent(QKeyEvent* e) void DownloadManager::startExternalManager(const QUrl &url) { - QzTools::startExternalProcess(m_externalExecutable, m_externalArguments + url.toEncoded()); + QString arguments = m_externalArguments; + arguments.replace(QLatin1String("%d"), url.toEncoded()); + + QzTools::startExternalProcess(m_externalExecutable, arguments); m_lastDownloadOption = ExternalManager; } diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index 6a1965d13..51dd1c867 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -2014,6 +2014,13 @@ + + + + <b>%d</b> will be replaced with URL to be downloaded + + + diff --git a/translations/empty.ts b/translations/empty.ts index 6d19743e5..3640a1500 100644 --- a/translations/empty.ts +++ b/translations/empty.ts @@ -2812,6 +2812,10 @@ Choose cache path... + + <b>%d</b> will be replaced with URL to be downloaded + + QObject