From 5437674fdfd051df45fa1d441c576ca5827f51ab Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Tue, 21 Jul 2015 21:00:07 +0300 Subject: [PATCH] Fix installing search plugin by drag-n-dropping file. --- src/searchengine/engineselectdlg.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/searchengine/engineselectdlg.cpp b/src/searchengine/engineselectdlg.cpp index 601c1f3b8..ecf050ba5 100644 --- a/src/searchengine/engineselectdlg.cpp +++ b/src/searchengine/engineselectdlg.cpp @@ -78,7 +78,21 @@ engineSelectDlg::~engineSelectDlg() { void engineSelectDlg::dropEvent(QDropEvent *event) { event->acceptProposedAction(); - QStringList files = event->mimeData()->text().split(QString::fromUtf8("\n")); + QStringList files; + if (event->mimeData()->hasUrls()) { + const QList urls = event->mimeData()->urls(); + foreach (const QUrl &url, urls) { + if (!url.isEmpty()) { + if (url.scheme().compare("file", Qt::CaseInsensitive) == 0) + files << url.toLocalFile(); + else + files << url.toString(); + } + } + } + else { + files = event->mimeData()->text().split(QString::fromUtf8("\n")); + } foreach (QString file, files) { qDebug("dropped %s", qPrintable(file)); if (Utils::Misc::isUrl(file)) {