]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Especially when using the details view in combination with the split functionality...
authorPeter Penz <peter.penz19@gmail.com>
Sat, 13 Dec 2008 15:15:04 +0000 (15:15 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 13 Dec 2008 15:15:04 +0000 (15:15 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=896446

src/dolphindetailsview.cpp

index 6b4ef44d04bfe462fec331c4cc2ea7e3856843a0..f92a28e79104421191e1f000a89b0ac8b3835a31 100644 (file)
@@ -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]);
 }