Summary: | Filenames can get truncated too early | ||
---|---|---|---|
Product: | [Applications] dolphin | Reporter: | Christoph Feck <cfeck> |
Component: | view-engine: icons mode | Assignee: | Dolphin Bug Assignee <dolphin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | emmanuelpescosta099 |
Priority: | NOR | ||
Version: | 4.10.90 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kde-baseapps/82d42b8dcc9fea455d1e1cd6c060c4a2c178358e | Version Fixed In: | 4.11.1 |
Sentry Crash Report: | |||
Attachments: |
Screen shot showing the issue
Screen shot showing the issue Proposed patch |
Created attachment 80908 [details]
Screen shot showing the issue
This issue is also visible with larger icons and much more room for the text, as shown here. The marked icon has the filename "GK-Blutalkoholkonzentration.pdf", but not a single letter is visible under the icon.
Thanks for reporting, I can confirm this issue (when limiting the number of lines and setting the width to "Small"). I looked for the right place in the code and found some things which seem strange. I'll attach a patch in a minute. Created attachment 80916 [details] Proposed patch I'd appreciate it if you could test this patch. I'm not 100% sure, but it might also fix bug 304558. Thanks, the patch works so far, it looks like it can display as many characters as possible. The hover/selection rectangle needs the same fix, though. The patch works for me too and it also fixes bug 304558. Git commit 82d42b8dcc9fea455d1e1cd6c060c4a2c178358e by Frank Reininghaus. Committed on 25/08/2013 at 14:24. Pushed by freininghaus into branch 'KDE/4.11'. Fix filename trucation issues in Icons View with maximum number of lines When the name of a file is too long to be shown inside the maximum number of lines, the last line is elided. However, there were several problems before this commit: (a) "lastTextLine", which contains the text to be elided, was not assigned the complete remaining text, but only the part that would be put into the last line if there were more lines following. This may be less than what would fit into the line because we try to not break the text at random points. (b) QFontMetrics::elidedText() was not given the width that is available for the last line (that would be maxWidth), but only the width that would be occupied by the text if there were more lines following (line.naturalTextWidth()). (c) The variable "nameWidth", which is required to calculate the QRectF that is reserved for the name, was not updated correctly. The result is that the text was sometimes trucated too early (especially if there would be a line break early in the text if we had more lines available), that there may be insufficient space to show the "...", and that the hover/selection rectangle might be too narrow. Related: bug 304558 FIXED-IN: 4.11.1 REVIEW: 112265 M +5 -2 dolphin/src/kitemviews/kstandarditemlistwidget.cpp http://commits.kde.org/kde-baseapps/82d42b8dcc9fea455d1e1cd6c060c4a2c178358e |
Created attachment 80907 [details] Screen shot showing the issue Some filenames get truncated too early, leaving either only a single letter with three dots, no letter but three dots, or no name at all (marked "ln-funktionen.txt" at bottom-left). From looking at the truncated names, the truncation algorithm has problems with names of the form "xx-xxxxxxxxxxxxxxxx.txt". If the part before the hyphen is longer, such as "xxxxxxxx-xxxxxxxx.txt", it displays more of the filename. (attached screen shot is from today's master, but the bug is not a recent regression)