]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphindetailsview.cpp
Use capitalized KDE includes
[dolphin.git] / src / views / dolphindetailsview.cpp
index 3b197115e6fc75fb6ef4d2901ef165a42ddf54d2..482925aaa3ee7cb1175885b6e162910227fd468b 100644 (file)
 #include "dolphin_detailsmodesettings.h"
 #include "dolphin_generalsettings.h"
 
-#include <kdirmodel.h>
-#include <kdirlister.h>
-#include <klocale.h>
-#include <kmenu.h>
+#include <KDirModel>
+#include <KDirLister>
+#include <KLocale>
+#include <KMenu>
 
 #include <QApplication>
 #include <QHeaderView>
@@ -52,7 +52,6 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent,
     DolphinTreeView(parent),
     m_autoResize(true),
     m_dolphinViewController(dolphinViewController),
-    m_viewModeController(viewModeController),
     m_extensionsFactory(0),
     m_expandableFoldersAction(0),
     m_expandedUrls(),
@@ -67,7 +66,6 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent,
     setLayoutDirection(Qt::LeftToRight);
     setAcceptDrops(true);
     setSortingEnabled(true);
-    setUniformRowHeights(true);
     setSelectionBehavior(SelectItems);
     setDragDropMode(QAbstractItemView::DragDrop);
     setDropIndicatorShown(false);
@@ -138,7 +136,6 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent,
             this, SLOT(slotShowPreviewChanged()));
 
 
-    setFocus();
     viewport()->installEventFilter(this);
 
     connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)),
@@ -223,20 +220,14 @@ void DolphinDetailsView::startDrag(Qt::DropActions supportedActions)
 
 void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event)
 {
-    if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) {
-        event->acceptProposedAction();
-    }
+    event->acceptProposedAction();
     DolphinTreeView::dragEnterEvent(event);
 }
 
 void DolphinDetailsView::dragMoveEvent(QDragMoveEvent* event)
 {
     DolphinTreeView::dragMoveEvent(event);
-
-    if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) {
-        // Accept URL drops, independently from the destination item
-        event->acceptProposedAction();
-    }
+    event->acceptProposedAction();
 }
 
 void DolphinDetailsView::dropEvent(QDropEvent* event)
@@ -246,7 +237,7 @@ void DolphinDetailsView::dropEvent(QDropEvent* event)
     if (index.isValid() && (index.column() == DolphinModel::Name)) {
         item = m_dolphinViewController->itemForIndex(index);
     }
-    m_dolphinViewController->indicateDroppedUrls(item, m_viewModeController->url(), event);
+    m_dolphinViewController->indicateDroppedUrls(item, event);
     DolphinTreeView::dropEvent(event);
 }
 
@@ -299,7 +290,10 @@ QRect DolphinDetailsView::visualRect(const QModelIndex& index) const
     const KFileItem item = m_dolphinViewController->itemForIndex(index);
     if (!item.isNull()) {
         const int width = DolphinFileItemDelegate::nameColumnWidth(item.text(), viewOptions());
-        rect.setWidth(width);
+
+        if (width < rect.width()) {
+            rect.setWidth(width);
+        }
     }
 
     return rect;
@@ -675,8 +669,12 @@ KFileItemDelegate::Information DolphinDetailsView::infoForColumn(int columnIndex
 
 void DolphinDetailsView::adjustMaximumSizeForEditing(const QModelIndex& index)
 {
-    // Make sure that the full width of the "Name" column is available for "Rename Inline"
-    m_extensionsFactory->fileItemDelegate()->setMaximumSize(QTreeView::visualRect(index).size());
+    // Make sure that the full width of the "Name" column is available for "Rename Inline".
+    // Before we do that, we have to check if m_extensionsFactory has been initialised because
+    // it is possible that we end up here before the constructor is finished (see bug 257035)
+    if (m_extensionsFactory) {
+        m_extensionsFactory->fileItemDelegate()->setMaximumSize(QTreeView::visualRect(index).size());
+    }
 }
 
 #include "dolphindetailsview.moc"