From 4bad086152fdb20e78e37702d4c658eafe089ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 8 Dec 2020 01:12:39 +0100 Subject: [PATCH] Enable maps drag&drop --- src/GUI/gui.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 63953cc4..c94dd08a 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -1834,9 +1834,25 @@ void GUI::dragEnterEvent(QDragEnterEvent *event) void GUI::dropEvent(QDropEvent *event) { - QList urls = event->mimeData()->urls(); - for (int i = 0; i < urls.size(); i++) - openFile(urls.at(i).toLocalFile()); + MapAction *lastReady = 0; + QList urls(event->mimeData()->urls()); + + for (int i = 0; i < urls.size(); i++) { + QString file(urls.at(i).toLocalFile()); + + if (!openFile(file, true)) { + MapAction *a; + if (!loadMap(file, a, true)) + openFile(file, false); + else { + if (a) + lastReady = a; + } + } + } + + if (lastReady) + lastReady->trigger(); event->acceptProposedAction(); }