Commit 194cd3fe authored by Elvis Angelaccio's avatar Elvis Angelaccio

mainwindow: don't steal drops for the part

The main window should accept drops only if the part cannot.

To make sure that the part URL will be empty after a failed loading
(e.g. dropping a text file onto an empty ark window), we clear the URL
in Part::slotLoadingFinished() if the job has an error.
parent e079e07d
......@@ -88,7 +88,8 @@ void MainWindow::dragEnterEvent(QDragEnterEvent * event)
return;
}
if (!event->source() && isValidArchiveDrag(event->mimeData())) {
const bool partAcceptsDrops = !m_part->url().isEmpty() && m_part->isReadWrite();
if (!event->source() && isValidArchiveDrag(event->mimeData()) && !partAcceptsDrops) {
event->acceptProposedAction();
}
return;
......
......@@ -60,6 +60,7 @@
#include <KToggleAction>
#include <KLocalizedString>
#include <KXMLGUIFactory>
#include <kparts_version.h>
#include <QAction>
#include <QCursor>
......@@ -891,6 +892,12 @@ void Part::slotLoadingFinished(KJob *job)
m_infoPanel->updateWithDefaults();
emit setWindowCaption(QString());
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 37, 0)
// See https://phabricator.kde.org/D6856
closeUrl();
#else
setUrl(QUrl());
#endif
}
} else {
emit completed();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment