]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* show an error message instead of an information message when an invalid dragging...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 13 Nov 2008 17:22:35 +0000 (17:22 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 13 Nov 2008 17:22:35 +0000 (17:22 +0000)
* show an error message if a folder is dropped on to itself

svn path=/trunk/KDE/kdebase/apps/; revision=883836

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/draganddrophelper.cpp
src/draganddrophelper.h

index 3f0b215cca4b3cb96c4c85b9854b36762de30230..d93ff83e49824dc55e43e73a7ce10b4f9afcfe5c 100644 (file)
@@ -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));
index 8cfdda34a2e8dfba4b3e28506b3fb8024b6ed0f3..46408369623c2919fc8bf62811fa30bc26599d8c 100644 (file)
@@ -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.
index d8c55ed126751db9f1c2cf3b94a3c5048f0eed4f..bdbcfae193c2f33fe87a9a9ec955da7fd4df34e9 100644 (file)
@@ -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 <filename>%2</filename> is already inside the folder <filename>%3</filename>",
+                "The dropped items are already inside the folder <filename>%3</filename>",
+                urls.count(), source.fileName(), destination.fileName());
+            emit errorMessage(msg);
         } else if (dropToItem) {
             KonqOperations::doDrop(destItem, destination, event, widget);
         } else {
index 907dd0c2c0e0c6f569057b4fd757e4516ba5571b..e62897208839ce902b72e72612c15aea02c136ff 100644 (file)
@@ -76,7 +76,7 @@ public:
                   QDropEvent* event,
                   QWidget* widget);
 signals:
-    void informationMessage(const QString& msg);
+    void errorMessage(const QString& msg);
     
 private:
     DragAndDropHelper();