1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

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.
This commit is contained in:
nowrep 2013-02-15 15:35:23 +01:00
parent e4ebeb3252
commit 8c9f09b17a
3 changed files with 19 additions and 1 deletions

View File

@ -75,6 +75,10 @@ void DownloadManager::loadSettings()
m_externalExecutable = settings.value("ExternalManagerExecutable", QString()).toString(); m_externalExecutable = settings.value("ExternalManagerExecutable", QString()).toString();
m_externalArguments = settings.value("ExternalManagerArguments", QString()).toString(); m_externalArguments = settings.value("ExternalManagerArguments", QString()).toString();
settings.endGroup(); settings.endGroup();
if (!m_externalArguments.contains(QLatin1String("%d"))) {
m_externalArguments.append(QLatin1String(" %d"));
}
} }
void DownloadManager::show() void DownloadManager::show()
@ -101,7 +105,10 @@ void DownloadManager::keyPressEvent(QKeyEvent* e)
void DownloadManager::startExternalManager(const QUrl &url) 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; m_lastDownloadOption = ExternalManager;
} }

View File

@ -2014,6 +2014,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="1">
<widget class="QLabel" name="label_64">
<property name="text">
<string>&lt;b&gt;%d&lt;/b&gt; will be replaced with URL to be downloaded</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="9" column="0" colspan="4"> <item row="9" column="0" colspan="4">

View File

@ -2812,6 +2812,10 @@
<source>Choose cache path...</source> <source>Choose cache path...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>&lt;b&gt;%d&lt;/b&gt; will be replaced with URL to be downloaded</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>QObject</name> <name>QObject</name>