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

List:       kde-core-devel
Subject:    Re: very uncool KJSDebugDialog bug
From:       David Faure <faure () kde ! org>
Date:       2004-08-10 8:43:47
Message-ID: 200408101043.47686.faure () kde ! org
[Download RAW message or body]

On Tuesday 10 August 2004 08:34, Ian Reinhart Geiser wrote:
> I have been trying to fix the bug where konqi dialogs span 3 or 4 screens, and 
> found the actual evil cause.  In KJSDebugWin i found this nugget:
>     QString msg = i18n("An error occurred while attempting to run a script on 
> this page.\n\n%1 line %2:\n%3")
>                   .arg(sourceFragment->sourceFile->url)
>                   .arg(sourceFragment->baseLine+ctx.curStmtFirstLine()-1)
>                   .arg(exceptionMsg);
> Now whats evil is if the URL line has a %2 or %3 in it, we get dialog boxes 
> that are pretty impressive in size. 

I don't see how the presence of %2 in the URL makes the result any bigger (only more wrong),
but it's easily fixed with a multi-arg syntax, like

     QString msg = i18n("An error occurred while attempting to run a script on 
 this page.\n\n%1 line %2:\n%3")
                   .arg(sourceFragment->sourceFile->url,
                       QString::number(sourceFragment->baseLine+ctx.curStmtFirstLine()-1)),
                       exceptionMsg);

> http://www.geiseri.com/pics/dialog_before.png
See, the main problem is the length of the URL itself, independently from the %foo mess.
Use KStringHandler::rsqueeze( sourceFragment->sourceFile->url, 80 ), as usual.

> So my question: How could this be effectively solved w/o a string change, or 
> at least a minor one.  This is in about 3 places that i can see, and im not 
> happy with leaving a bug in just because we noticed it this late in the game.
This bug can be in 3.3 - nobody enables KJSDebugWin :) There will be worse
things in 3.3, don't worry about that :)

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
[prev in list] [next in list] [prev in thread] [next in thread] 

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