diff options
| author | Frank Reininghaus <[email protected]> | 2013-07-02 19:27:06 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-07-02 19:27:06 +0200 |
| commit | 508661100fdd41579c7d38a970ab7f495010fb18 (patch) | |
| tree | 6c6a8aa92494c526975a0fc938b8f92e5094616e /src/dolphinviewcontainer.cpp | |
| parent | 4ff5ae361dc398079609d75c8d78be77bd65584d (diff) | |
Fix crash when dropping URLs on the URL navigator's drop down menus
The problem was that the files were copied/moved inside the nested event
loop of the drag, which caused problems if the "File exists" dialog was
shown.
The solution is to make the copy/move operation delayed, such that it is
executed in the main event loop.
Note that dropping files on these menus does apparently not work at the
moment when using the Oxygen style (see bug 310016).
BUG: 192139
BUG: 256338
BUG: 293220
BUG: 309076
FIXED-IN: 4.11.0
REVIEW: 111273
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 71dc5fd7b..1e9e79ae7 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -68,7 +68,9 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_statusBar(0), m_statusBarTimer(0), m_statusBarTimestamp(), - m_autoGrabFocus(true) + m_autoGrabFocus(true), + m_dropDestination(), + m_dropEvent(0) #ifdef KActivities_FOUND , m_activityResourceInstance(0) #endif @@ -597,11 +599,37 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url) void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event) { + m_dropDestination = destination; + + const QMimeData* mimeData = event->mimeData(); + QMimeData* mimeDataCopy = new QMimeData; + foreach (const QString& format, mimeData->formats()) { + mimeDataCopy->setData(format, mimeData->data(format)); + } + + m_dropEvent.reset(new QDropEvent(event->pos(), + event->possibleActions(), + mimeDataCopy, + event->mouseButtons(), + event->keyboardModifiers())); + + QTimer::singleShot(0, this, SLOT(dropUrlsDelayed())); +} + +void DolphinViewContainer::dropUrlsDelayed() +{ + if (m_dropEvent.isNull()) { + return; + } + QString error; - DragAndDropHelper::dropUrls(KFileItem(), destination, event, error); + DragAndDropHelper::dropUrls(KFileItem(), m_dropDestination, m_dropEvent.data(), error); if (!error.isEmpty()) { showMessage(error, Error); } + + delete m_dropEvent->mimeData(); + m_dropEvent.reset(); } void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl) |
