X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b13d9cea3a024b446e046d0089930b32de37df0a..8eb9b508ca87fb1d634d8b8ba62c054ed04466d2:/src/views/dolphindetailsview.cpp diff --git a/src/views/dolphindetailsview.cpp b/src/views/dolphindetailsview.cpp index 3b197115e..482925aaa 100644 --- a/src/views/dolphindetailsview.cpp +++ b/src/views/dolphindetailsview.cpp @@ -36,10 +36,10 @@ #include "dolphin_detailsmodesettings.h" #include "dolphin_generalsettings.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -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"