mirror of
https://github.com/transmission/transmission
synced 2025-01-31 11:23:40 +00:00
#5543: Add a warning panel with id of duplicate torrent (patch by rb07 + personal touch)
This commit is contained in:
parent
629281a1e2
commit
f83872849a
1 changed files with 13 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkProxy>
|
||||
#include <QNetworkProxyFactory>
|
||||
|
@ -91,13 +92,23 @@ namespace
|
|||
void
|
||||
FileAdded::executed (int64_t tag, const QString& result, tr_variant * arguments)
|
||||
{
|
||||
Q_UNUSED (arguments);
|
||||
|
||||
if (tag != myTag)
|
||||
return;
|
||||
|
||||
if (result == "success")
|
||||
{
|
||||
tr_variant * dup;
|
||||
const char * str;
|
||||
if (tr_variantDictFindDict (arguments, TR_KEY_torrent_duplicate, &dup) &&
|
||||
tr_variantDictFindStr (dup, TR_KEY_name, &str, NULL))
|
||||
{
|
||||
const QString myFilename = QFileInfo (myName).fileName ();
|
||||
const QString name = QString::fromUtf8 (str);
|
||||
QMessageBox::warning (QApplication::activeWindow (),
|
||||
tr ("Add Torrent"),
|
||||
tr ("<p><b>Unable to add \"%1\".</b></p><p>It is a duplicate of \"%2\" which is already added.</p>").arg (myFilename).arg (name));
|
||||
}
|
||||
|
||||
if (!myDelFile.isEmpty ())
|
||||
{
|
||||
QFile file (myDelFile);
|
||||
|
|
Loading…
Reference in a new issue