KParts::URLArgs split up

David Faure faure at kde.org
Mon Jul 9 16:59:43 BST 2007


The KParts API hasn't had yet the kde4 cleanup that it deserves. With 
deadlines approaching I had more or less given up on changing more kdelibs 
API, but more recently I have received more and more comments about how 
broken/hackish some parts of that API are... to the point where people were 
thinking of bypassing it completely, which defeats the whole point of a 
unique component model.

So here's a kdelibs patch which addresses the issue of KParts::URLArgs being
1) hidden in the browser extension stuff even though some of it is unrelated 
to browsers and is needed by almost all parts (like reload, xOffset, yOffset, 
mimeType and KIO job metadata)
2) cluttered with actual browser-specific stuff (and by that I mean stuff that 
is only used by KHTML and Konqueror, basically).

Solution: splitting up URLArgs into
1) KParts::OpenUrlArguments - now available at the KParts::ReadOnlyPart level
2) KParts::BrowserArguments - still available in the BrowserExtension, where 
it belongs.

Ideally I would want all parts other than khtml to not need a BrowserExtension 
anymore, and the URLArgs split up is a step in that direction (the main 
reason for it to still be needed after that is the enabling/disabling of 
actions, a whole other topic in itself ;), and the fact that openUrlRequest 
is in BrowserExtension, I'd like to have a no-browser-args version of it in 
ReadOnlyPart, but that will be for another time).

On the other hand the split up does make things a little bit more verbose in 
khtml which needs both args almost everywhere, but I think that's a fair price
to pay for every other part to be simpler to write -- and it also allows more
browserextension changes later when they only affect kdelibs+konqueror.

This split up also addresses a request that I got some time ago by the 
kpdf/okular developers: making ReadOnlyPart aware of the mimeType that it's 
currently displaying. This is now available in any part by using 
arguments().mimeType(), provided that the host sets it before calling openUrl 
or that the part sets it while opening the url.

The patch at http://web.davidfaure.fr/kde/kdelibs_urlargs_splitup.diff 
ports kdelibs (including adding KDE4PORTING.html entries).
The interesting read is kparts/part.h and . I also wrote a porting script to 
automate the stuff that can be automated (but not all the porting can be 
automated). However I didn't have time to port the rest of the code and I'm 
on vacations this week. Well, this gives us a week (until Monday 16) to 
discuss this change :)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert_args.pl
Type: application/x-perl
Size: 2737 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070709/48a7b56a/attachment.bin>


More information about the kde-core-devel mailing list