On Friday 01 July 2005 21:08, Florian Merz wrote:
> Hi,
>
> I'm currently playing around with kde a bit I started to work on my own first
> little kioslave but I hit a problem I can't solve myself and the mailinglist
> archives haven't been of much help either:
> I'd like to use KIconLoader to provide themed icons with my kioslave.
> Unfortunately, Qt complains that no QApplication is running and QPixmaps
> can't be created. I remember having read somewhere that Qt uses X pixmaps for
> the QPixmaps and that's why QPixmaps cannot be used without an X application
> to which these pixmaps belong (or something along those lines).
>
> Is there a reasonable way to get QPixmaps working inside a kioslave?


Construct your ioslave without GUI disabled, like in the code below:

static const KCmdLineOptions options[] =
{
{ "+protocol", I18N_NOOP( "Protocol name" ), 0 },
{ "+pool", I18N_NOOP( "Socket name" ), 0 },
{ "+app", I18N_NOOP( "Socket name" ), 0 },
KCmdLineLastOption
};

extern "C" {
int KDE_EXPORT kdemain( int argc, char **argv )
{
putenv(strdup("SESSION_MANAGER="));
KApplication::disableAutoDcopRegistration();
KCmdLineArgs::init(argc, argv, "kio_foobar", 0, 0, 0, 0);
KCmdLineArgs::addCmdLineOptions( options );
KApplication app( true, true ); // note: GUI enabled

KCmdLineArgs *args = KCmdLineArgs:arsedArgs();
MyProtocol slave( args->arg(0), args->arg(1), args->arg(2) );
slave.dispatchLoop();
return 0;
}
}


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


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<