kioslave: use QApplication instead of KApplication in the thumbnail slave

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-14 16:30:55 +02:00
parent 4dc0be1da4
commit aabd7af209

View file

@ -61,9 +61,6 @@
#include <iostream> #include <iostream>
// Use correctly KComponentData instead of KApplication (but then no QPixmap)
#undef USE_KINSTANCE
// Recognized metadata entries: // Recognized metadata entries:
// mimeType - the mime type of the file, used for the overlay icon if any // mimeType - the mime type of the file, used for the overlay icon if any
// width - maximum width for the thumbnail // width - maximum width for the thumbnail
@ -94,26 +91,16 @@ int main(int argc, char **argv)
nice( 5 ); nice( 5 );
#endif #endif
#ifdef USE_KINSTANCE kDebug(7115) << "Starting" << ::getpid();
KComponentData componentData("kio_thumbnail");
#else
// creating KApplication in a slave in not a very good idea,
// as dispatchLoop() doesn't allow it to process its messages,
// so it for example wouldn't reply to ksmserver - on the other
// hand, this slave uses QPixmaps for some reason, and they
// need QApplication
// and HTML previews need even KApplication :(
putenv(strdup("SESSION_MANAGER="));
//KApplication::disableAutoDcopRegistration();
KAboutData about("kio_thumbnail", 0, ki18n("kio_thumbmail"), "KDE 4.x.x");
KCmdLineArgs::init(&about);
KApplication app; QApplication app(argc, argv);
#endif KComponentData("kio_thumbnail", "kdelibs4");
KGlobal::locale();
ThumbnailProtocol slave(argv[1]); ThumbnailProtocol slave(argv[1]);
slave.dispatchLoop(); slave.dispatchLoop();
kDebug(7115) << "Done";
return 0; return 0;
} }