From c0fd7f2a19d82e91df1ec795aee7b335b442f0e8 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 13 Nov 2008 17:22:35 +0000 Subject: * show an error message instead of an information message when an invalid dragging is done * show an error message if a folder is dropped on to itself svn path=/trunk/KDE/kdebase/apps/; revision=883836 --- src/draganddrophelper.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/draganddrophelper.cpp') diff --git a/src/draganddrophelper.cpp b/src/draganddrophelper.cpp index d8c55ed12..bdbcfae19 100644 --- a/src/draganddrophelper.cpp +++ b/src/draganddrophelper.cpp @@ -101,13 +101,17 @@ 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 KUrl source = urls.first(); + const KUrl sourceDir = KUrl(source.directory()); + + if ((urls.count() == 1) && (source == destination)) { + emit errorMessage(i18nc("@info:status", "A folder cannot dropped on to itself")); + } else 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); + "The dropped item %2 is already inside the folder %3", + "The dropped items are already inside the folder %3", + urls.count(), source.fileName(), destination.fileName()); + emit errorMessage(msg); } else if (dropToItem) { KonqOperations::doDrop(destItem, destination, event, widget); } else { -- cgit v1.3