]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
enable hovering information in the status bar again (has been disabled temporary...
[dolphin.git] / src / dolphinviewcontainer.cpp
index 0b2812a7ce1e7be18426353cf437ae1c237577ec..d792287b51c51e3e83eee059c88136fc87ae1dfe 100644 (file)
@@ -139,6 +139,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
             this, SLOT(openContextMenu(KFileItem*, const KUrl&)));
     connect(m_view, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)),
             m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&)));
+    connect(m_view, SIGNAL(requestItemInfo(const KUrl&)),
+            this, SLOT(showItemInfo(const KUrl&)));
 
     connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
             m_view, SLOT(setUrl(const KUrl&)));
@@ -277,61 +279,6 @@ KFileItem* DolphinViewContainer::fileItem(const QModelIndex index) const
     return m_dirModel->itemForIndex(dirModelIndex);
 }
 
-void DolphinViewContainer::rename(const KUrl& source, const QString& newName)
-{
-    bool ok = false;
-
-    if (newName.isEmpty() || (source.fileName() == newName)) {
-        return;
-    }
-
-    KUrl dest(source.upUrl());
-    dest.addPath(newName);
-
-    const bool destExists = KIO::NetAccess::exists(dest, false, this);
-    if (destExists) {
-        // the destination already exists, hence ask the user
-        // how to proceed...
-        KIO::RenameDialog renameDialog(this,
-                                       i18n("File Already Exists"),
-                                       source.path(),
-                                       dest.path(),
-                                       KIO::M_OVERWRITE);
-        switch (renameDialog.exec()) {
-        case KIO::R_OVERWRITE:
-            // the destination should be overwritten
-            ok = KIO::NetAccess::file_move(source, dest, -1, true);
-            break;
-
-        case KIO::R_RENAME: {
-            // a new name for the destination has been used
-            KUrl newDest(renameDialog.newDestUrl());
-            ok = KIO::NetAccess::file_move(source, newDest);
-            break;
-        }
-
-        default:
-            // the renaming operation has been canceled
-            return;
-        }
-    } else {
-        // no destination exists, hence just move the file to
-        // do the renaming
-        ok = KIO::NetAccess::file_move(source, dest);
-    }
-
-    const QString destFileName = dest.fileName();
-    if (ok) {
-        m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.", source.fileName(), destFileName),
-                                DolphinStatusBar::OperationCompleted);
-
-        KonqOperations::rename(this, source, destFileName);
-    } else {
-        m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName),
-                                DolphinStatusBar::Error);
-    }
-}
-
 DolphinMainWindow* DolphinViewContainer::mainWindow() const
 {
     return m_mainWindow;
@@ -374,6 +321,20 @@ void DolphinViewContainer::updateItemCount()
     QTimer::singleShot(0, this, SLOT(restoreContentsPos()));
 }
 
+void DolphinViewContainer::showItemInfo(const KUrl& url)
+{
+    if (url.isEmpty()) {
+        m_statusBar->clear();
+        return;
+    }
+
+    const QModelIndex index = m_dirModel->indexForUrl(url);
+    const KFileItem* item = m_dirModel->itemForIndex(index);
+    if (item != 0) {
+        m_statusBar->setMessage(item->getStatusBarInfo(), DolphinStatusBar::Default);
+    }
+}
+
 void DolphinViewContainer::showInfoMessage(const QString& msg)
 {
     m_statusBar->setMessage(msg, DolphinStatusBar::Information);