very uncool KJSDebugDialog bug

David Faure faure at kde.org
Tue Aug 10 14:51:42 BST 2004


On Tuesday 10 August 2004 15:42, Ian Reinhart Geiser wrote:
> On Tuesday 10 August 2004 04:43 am, David Faure wrote:
> > 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
> >
>  The %3 is the real killer. Try adding "TypeError: Attempted to access 
> 'document' property on undefined object (result of expression 
> objWin.document)" in the middle of an already long url. ;)   In an ideal 
> world all of these are on seperate lines, and the \n's make it all pretty 
> clean.  
I see.

> >      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);
> >
> Im not sure I follow what the QString::number changes?  Could you please 
> explain that a bit more? 

The main change is  arg(a,b,c) instead of arg(a).arg(b).arg(c).
The QString::number is simply there because multi-arg needs strings.
Please try the change, it should fix your problem :)

> Im inclined to disagree that its the main problem, since if the error message 
> is embedded in the URL the sqeeze (what brought me to the conclusion that the 
> real error was the message in the url) will hide the actual error message.  
> If the error message is outside the url though that might fix the reimaining 
> issues with the dialog though.

See above.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list