From: Simon Paul St James Date: Tue, 28 Oct 2008 19:40:51 +0000 (+0000) Subject: Use nameColumnRect rather than duplicating code (change the local variable of the... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/1984e18ad1935a4eb12fc36b892ca6a90ad88503 Use nameColumnRect rather than duplicating code (change the local variable of the same name to prevent clashes!) Use KFileItem::text() instead of KFileItem::name() there, too. svn path=/trunk/KDE/kdebase/apps/; revision=877159 --- diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index efdead0c7..f51d3b034 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -652,8 +652,8 @@ void DolphinDetailsView::updateElasticBandSelection() const int nameColumnX = header()->sectionPosition(DolphinModel::Name); const int nameColumnWidth = header()->sectionSize(DolphinModel::Name); QRect selRect = elasticBandRect().normalized(); - QRect nameColumnRect(nameColumnX, selRect.y(), nameColumnWidth, selRect.height()); - selRect = nameColumnRect.intersect(selRect).normalized(); + QRect nameColumnArea(nameColumnX, selRect.y(), nameColumnWidth, selRect.height()); + selRect = nameColumnArea.intersect(selRect).normalized(); if (selRect.isNull()) { selectionModel()->select(m_band.originalSelection, QItemSelectionModel::ClearAndSelect); @@ -741,9 +741,7 @@ void DolphinDetailsView::updateElasticBandSelection() QModelIndex toggleIndexRangeBegin = QModelIndex(); do { - QRect currIndexRect = visualRect(currIndex); - const QString name = m_controller->itemForIndex(currIndex).name(); - currIndexRect.setWidth(DolphinFileItemDelegate::nameColumnWidth(name, viewOptions())); + QRect currIndexRect = nameColumnRect(currIndex); // Update some optimisation info as we go. const int cr = currIndexRect.right(); @@ -902,7 +900,7 @@ QRect DolphinDetailsView::nameColumnRect(const QModelIndex& index) const QRect rect = visualRect(index); const KFileItem item = m_controller->itemForIndex(index); if (!item.isNull()) { - const int width = DolphinFileItemDelegate::nameColumnWidth(item.name(), viewOptions()); + const int width = DolphinFileItemDelegate::nameColumnWidth(item.text(), viewOptions()); rect.setWidth(width); }