From: Peter Penz Date: Sat, 13 Dec 2008 15:15:04 +0000 (+0000) Subject: Especially when using the details view in combination with the split functionality... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/d0c97573d4cee67974758349ddcfc2fee509785d Especially when using the details view in combination with the split functionality, the size of the name column can get too small. Do an optimized resizing in this case (at least for up to 200 items, otherwise the performance penalty is too big). svn path=/trunk/KDE/kdebase/apps/; revision=896446 --- diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 6b4ef44d0..f92a28e79 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -910,9 +910,26 @@ void DolphinDetailsView::resizeColumns() // resize the name column in a way that the whole available width is used columnWidth[KDirModel::Name] = viewport()->width() - requiredWidth; - if (columnWidth[KDirModel::Name] < 120) { - columnWidth[KDirModel::Name] = 120; + + const int minNameWidth = 300; + if (columnWidth[KDirModel::Name] < minNameWidth) { + columnWidth[KDirModel::Name] = minNameWidth; + + // It might be possible that the name column width can be + // decreased without clipping any text. For performance + // reasons the exact necessary width for full visible names is + // only checked for up to 200 items: + const int rowCount = model()->rowCount(); + if (rowCount < 200) { + const int nameWidth = sizeHintForColumn(DolphinModel::Name); + if (nameWidth + requiredWidth <= viewport()->width()) { + columnWidth[KDirModel::Name] = viewport()->width() - requiredWidth; + } else if (nameWidth < minNameWidth) { + columnWidth[KDirModel::Name] = nameWidth; + } + } } + headerView->resizeSection(KDirModel::Name, columnWidth[KDirModel::Name]); }