Browse Source

Fix installing search plugin by drag-n-dropping file.

adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
5437674fdf
  1. 16
      src/searchengine/engineselectdlg.cpp

16
src/searchengine/engineselectdlg.cpp

@ -78,7 +78,21 @@ engineSelectDlg::~engineSelectDlg() {
void engineSelectDlg::dropEvent(QDropEvent *event) { void engineSelectDlg::dropEvent(QDropEvent *event) {
event->acceptProposedAction(); event->acceptProposedAction();
QStringList files = event->mimeData()->text().split(QString::fromUtf8("\n")); QStringList files;
if (event->mimeData()->hasUrls()) {
const QList<QUrl> 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) { foreach (QString file, files) {
qDebug("dropped %s", qPrintable(file)); qDebug("dropped %s", qPrintable(file));
if (Utils::Misc::isUrl(file)) { if (Utils::Misc::isUrl(file)) {

Loading…
Cancel
Save