[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Word-wrap in message boxes.
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-01-15 11:30:03
[Download RAW message or body]

On Tuesday 15 January 2002 10:29, Thomas Zander wrote:
> On Mon, Jan 14, 2002 at 10:58:12PM -0800, Waldo Bastian wrote:
> > On Monday 14 January 2002 10:07 pm, Ellis Whitehead wrote:
> > > Is this really so difficult to write an algorithm for?  Not that I'm
> > > volunteering, but I'd rather go with the problems that were existent in
> > > KMessageBox and see them eventually fixed, rather than continue with the
> > > seemingly poor tradition of hard-coding line breaks.
> > 
> > Whether line-breaks need to be hard-coded or not is a change of the API 
which 
> > is rather tricky because you don't get any compiler warnings/errors for 
it. I 
> > didn't see anyone going over all the dialogs and removing all the 
linefeeds 
> > after word-break was enabled and we currently don't have a decent 
algorithm, 
> > so if we want to have dialogs in 3.0 that don't look a lot worse than 
those 
> > of 2.2 we need a solution now. Whatever direction we go, it will affect 
> > translations so it really needs to be done ASAP.
> 
> IMO single words need the treatment of shortening them to 80 chars max (or 
> whatever the width of the diag), but the QT bugs should not create the API 
> for KDE3. These bugs will be fixed before the QT4 I hope :)
> 
> I was showing KDE2.2 to a friend that has bad eyes, and was surprised about
> the bad way KDE handeled huge fonts (> 20), its still pethethic in KDE3, but 
> auto-line-breaks are _needed_ to fix this in the future.
> 
> Your example of line breaking one word before the manual line break only
> points to a direct example that can be fixed in the line breaking algoritm.

I agree, and I volunteer to implement "squeezing single words (e.g. URLs) if 
longer than the max size for the dialog" in KWordWrap (as well as a mode for 
"only word-wrap at spaces" - it currently wraps at any punctuation sign, 
since this is necessary for desktop icons.

KWordWrap requires the caller to give a maximum size in pixels - I guess we 
could easily guess it from the desktop resolution (e.g. half of the desktop 
width as a maximum).

With KWordWrap::wrappedString, you can get a string with '\n' in it, so it's 
easy to use the result as the label.

Waldo, does this sound like an acceptable solution ?
I guess we'd still need the tooltip when a long url is being squeezed in the 
middle, I can make KWordWrap return that string (with \n in it), I guess.

Hmm, I'll stop volunteering here, otherwise I'll have work for the next year 
;)

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david, http://www.konqueror.org
KDE 3.0: Konquering the Desktops
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic