]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/draganddrophelper.cpp
assure that no expensive operations are done when the Information Panel has been...
[dolphin.git] / src / draganddrophelper.cpp
index d8c55ed126751db9f1c2cf3b94a3c5048f0eed4f..ff319dfb8b3988670f05ef44c94cf1eec996bfbc 100644 (file)
@@ -101,13 +101,24 @@ void DragAndDropHelper::dropUrls(const KFileItem& destItem,
         QDBusConnection::sessionBus().call(message);
     } else {                                
         const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
-        const KUrl sourceDir = KUrl(urls.first().directory());
-        if (sourceDir == destination) {
-            const QString msg = i18ncp("@info:status",
-                                       "The dropped item is already inside the folder %2",
-                                       "The dropped items are already inside the folder %2",
-                                       urls.count(), destination.fileName());
-            emit informationMessage(msg);
+        const KUrl source = urls.first();
+        const KUrl sourceDir = KUrl(source.directory());
+        const bool singleSelection = (urls.count() == 1);
+
+        if (singleSelection && (source == destination)) {
+            emit errorMessage(i18nc("@info:status", "A folder cannot be dropped into itself"));
+        } else if (sourceDir == destination) {
+            QString msg;
+            if (singleSelection) {
+                msg = i18nc("@info:status",
+                            "The dropped item <filename>%1</filename> is already inside "
+                            "the folder <filename>%2</filename>", source.fileName(), destination.fileName());
+            } else {
+                msg = i18nc("@info:status",
+                            "The dropped items are already inside the folder <filename>%1</filename>",
+                            destination.fileName());
+            }
+            emit errorMessage(msg);
         } else if (dropToItem) {
             KonqOperations::doDrop(destItem, destination, event, widget);
         } else {