From c9c3531c0b6da07de8f90761a3d799ace62f8e89 Mon Sep 17 00:00:00 2001 From: Jin Liu Date: Sat, 17 Feb 2024 11:14:46 +0000 Subject: Improve DnD handling in read-only dirs 1. Places panel and tabbar update drag status in read-only dir 2. Don't create drop job in readonly directories --- src/panels/places/placespanel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/panels/places/placespanel.cpp') diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 2c19d8f29..ba3451bd5 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -156,9 +156,13 @@ void PlacesPanel::dragMoveEvent(QDragMoveEvent *event) // Reject drag ontop of a non-writable protocol // We don't know whether we're dropping inbetween or ontop of a place // so still allow internal drag events so that re-arranging still works. - const QUrl url = placesModel->url(index); - if (url.isValid() && !isInternalDrag(event->mimeData()) && !KProtocolManager::supportsWriting(url)) { - event->setDropAction(Qt::IgnoreAction); + if (!isInternalDrag(event->mimeData())) { + const QUrl url = placesModel->url(index); + if (!url.isValid() || !KProtocolManager::supportsWriting(url)) { + event->setDropAction(Qt::IgnoreAction); + } else { + DragAndDropHelper::updateDropAction(event, url); + } } } -- cgit v1.3