(trunk, qt) #5374 handle multifile drag-and-drop in Qt client, patch by kernel_daemon

This commit is contained in:
Jordan Lee 2013-06-09 20:18:47 +00:00
parent d1db86eba9
commit a2ca089cfd
1 changed files with 16 additions and 5 deletions

View File

@ -1407,13 +1407,24 @@ TrMainWindow :: dragEnterEvent (QDragEnterEvent * event)
void
TrMainWindow :: dropEvent (QDropEvent * event)
{
QString key = event->mimeData ()->text ().trimmed ();
const QStringList list = event->mimeData()->text().trimmed().split('\n');
const QUrl url (key);
if (url.scheme () == "file")
key = QUrl::fromPercentEncoding (url.path ().toUtf8 ());
foreach (QString entry, list)
{
QString key = entry.trimmed();
dynamic_cast<MyApp*> (QApplication::instance ())->addTorrent (key);
if (!key.isEmpty())
{
const QUrl url (key);
if (url.scheme () == "file")
key = QUrl::fromPercentEncoding (url.path().toUtf8());
dynamic_cast<MyApp*> (QApplication::instance ())->addTorrent (key);
}
}
qDebug() << "Added " << list.size() << " entries.";
}
/***