From: Peter Penz Date: Thu, 13 Nov 2008 17:22:35 +0000 (+0000) Subject: * show an error message instead of an information message when an invalid dragging... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/c0fd7f2a19d82e91df1ec795aee7b335b442f0e8?ds=inline * 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 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 3f0b215cc..d93ff83e4 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -115,8 +115,8 @@ DolphinMainWindow::DolphinMainWindow(int id) : this, SLOT(showCommand(CommandType))); connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); - connect(&DragAndDropHelper::instance(), SIGNAL(informationMessage(const QString&)), - this, SLOT(showInformationMessage(const QString&))); + connect(&DragAndDropHelper::instance(), SIGNAL(errorMessage(const QString&)), + this, SLOT(showErrorMessage(const QString&))); } DolphinMainWindow::~DolphinMainWindow() @@ -450,14 +450,6 @@ void DolphinMainWindow::showErrorMessage(const QString& message) } } -void DolphinMainWindow::showInformationMessage(const QString& message) -{ - if (!message.isEmpty()) { - DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); - statusBar->setMessage(message, DolphinStatusBar::Information); - } -} - void DolphinMainWindow::slotUndoAvailable(bool available) { QAction* undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo)); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 8cfdda34a..464083696 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -171,9 +171,6 @@ private slots: /** Shows the error message in the status bar of the active view. */ void showErrorMessage(const QString& message); - /** Shows the information message in the status bar of the active view. */ - void showInformationMessage(const QString& message); - /** * Updates the state of the 'Undo' menu action dependent * from the parameter \a available. 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 { diff --git a/src/draganddrophelper.h b/src/draganddrophelper.h index 907dd0c2c..e62897208 100644 --- a/src/draganddrophelper.h +++ b/src/draganddrophelper.h @@ -76,7 +76,7 @@ public: QDropEvent* event, QWidget* widget); signals: - void informationMessage(const QString& msg); + void errorMessage(const QString& msg); private: DragAndDropHelper();