]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
* Move code from DolphinDropController to DragAndDropHelper.
[dolphin.git] / src / dolphinview.cpp
index 25d0cc1995d60a60e164b0cb6764fa6a7293998c..cd9b67bb7725a1e4857c79f3f47e4c8167c426a2 100644 (file)
@@ -31,7 +31,6 @@
 #include <kactioncollection.h>
 #include <kcolorscheme.h>
 #include <kdirlister.h>
-#include <kfileitemdelegate.h>
 #include <kfilepreviewgenerator.h>
 #include <kiconeffect.h>
 #include <klocale.h>
 #include <ktoggleaction.h>
 #include <kurl.h>
 
-#include "dolphindropcontroller.h"
 #include "dolphinmodel.h"
 #include "dolphincolumnview.h"
 #include "dolphincontroller.h"
+#include "dolphinfileitemdelegate.h"
 #include "dolphinsortfilterproxymodel.h"
 #include "dolphindetailsview.h"
 #include "dolphin_detailsmodesettings.h"
 #include "dolphiniconsview.h"
 #include "dolphinsettings.h"
 #include "dolphin_generalsettings.h"
+#include "draganddrophelper.h"
 #include "folderexpander.h"
 #include "renamedialog.h"
 #include "tooltipmanager.h"
@@ -126,7 +126,7 @@ DolphinView::DolphinView(QWidget* parent,
             this, SLOT(clearHoverInformation()));
 
     connect(m_dirLister, SIGNAL(redirection(KUrl, KUrl)),
-            this, SLOT(slotRedirection(KUrl, KUrl)));
+            this, SIGNAL(redirection(KUrl, KUrl)));
     connect(m_dirLister, SIGNAL(completed()),
             this, SLOT(restoreCurrentItem()));
 
@@ -871,7 +871,7 @@ void DolphinView::dropUrls(const KFileItem& destItem,
                            const KUrl& destPath,
                            QDropEvent* event)
 {
-    DolphinDropController::dropUrls(destItem, destPath, event, this);
+    DragAndDropHelper::dropUrls(destItem, destPath, event, this);
 }
 
 void DolphinView::updateSorting(DolphinView::Sorting sorting)
@@ -1022,18 +1022,11 @@ void DolphinView::slotDeleteFileFinished(KJob* job)
 {
     if (job->error() == 0) {
         emit operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
-    } else {
+    } else if (job->error() != KIO::ERR_USER_CANCELED) {
         emit errorMessage(job->errorString());
     }
 }
 
-void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
-{
-    if (oldUrl == m_controller->url()) {
-        m_controller->setUrl(newUrl);
-    }
-}
-
 void DolphinView::slotRequestUrlChange(const KUrl& url)
 {
     emit requestUrlChange(url);
@@ -1209,8 +1202,9 @@ void DolphinView::createView()
 
     m_controller->setItemView(view);
 
-    m_fileItemDelegate = new KFileItemDelegate(view);
+    m_fileItemDelegate = new DolphinFileItemDelegate(view);
     m_fileItemDelegate->setShowToolTipWhenElided(false);
+    m_fileItemDelegate->setMinimizedNameColumn(m_mode == DetailsView);
     view->setItemDelegate(m_fileItemDelegate);
 
     view->setModel(m_proxyModel);
@@ -1231,6 +1225,8 @@ void DolphinView::createView()
 
     if (DolphinSettings::instance().generalSettings()->showToolTips()) {
         m_toolTipManager = new ToolTipManager(view, m_proxyModel);
+        connect(m_controller, SIGNAL(hideToolTip()),
+                m_toolTipManager, SLOT(hideTip()));
     }
 
     m_topLayout->insertWidget(1, view);
@@ -1310,7 +1306,7 @@ void DolphinView::pasteToUrl(const KUrl& url)
 }
 
 void DolphinView::updateZoomLevel(int oldZoomLevel)
-{       
+{
     const int newZoomLevel = ZoomLevelInfo::zoomLevelForIconSize(itemView()->iconSize());
     if (oldZoomLevel != newZoomLevel) {
         m_controller->setZoomLevel(newZoomLevel);
@@ -1321,10 +1317,15 @@ void DolphinView::updateZoomLevel(int oldZoomLevel)
 KUrl::List DolphinView::simplifiedSelectedUrls() const
 {
     KUrl::List list = selectedUrls();
-    if ((m_detailsView != 0) && m_detailsView->itemsExpandable()) {
+    if (itemsExpandable() ) {
         list = KonqOperations::simplifiedUrlList(list);
     }
     return list;
 }
 
+bool DolphinView::itemsExpandable() const
+{
+    return (m_detailsView != 0) && m_detailsView->itemsExpandable();
+}
+
 #include "dolphinview.moc"