Debugging KParts

David Faure faure at kde.org
Fri Feb 4 16:13:03 GMT 2005


On Monday 31 January 2005 16:33, ian geiser wrote:
> Greetings,
>  In KDevelop we have a problem when users try to build and develop KParts 
> aware applications.  Because of how xmlgui and klibloader operate users must 
> install the application before they can debug it.  Most of the time this is 
> just an annoyance, but on student lab machines its impossible.  Now I know we 
> can play games with KDEDIRS, but I was wondering if there is a simpler way to 
> find the parts when they are in the current working directory?  The issue 
> with the XMLGUI files is about the same mess, but its even worse when you 
> have builddir != srcdir. 

Hmm, what you want is something like KStandardDirs::addResourceDirs( "module", $builddir ),
and addResourceDirs( "services", $srcdir ) to find the .desktop file if the part has never been installed,
but the point is to do those things without modifying the source code, right?

One solution would be to add some code to KStandardDirs::addKDEDefaults(), 
which reads from an env. var ($KDE_BUILDDIR?) set by kdevelop. Doesn't solve
the problem for those who just run ./foo from a shell without using kdevelop though.

So I'd rather see a solution like: adding a stat() in KStandardDirs to check 
if there's a Makefile in the same dir as the binary, read the srcdir and 
builddir from it, and add them to the correct resources.
It sounds a bit fragile to rely on Makefile syntax, but I don't see another way
to do it, which would work with srcdir!=builddir, except hacking libtool to pass
one or two env vars for the first solution.

XMLGUI files are looked in the "data" resource but with a subdir named after the 
instance name, so that one would even need a KXMLGUIClient::setXMLFile hack
(fallback by looking in current dir, if that's enough).

-- 
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