diff --git a/kdecore/kernel/kcmdlineargs.cpp b/kdecore/kernel/kcmdlineargs.cpp index b14744a4..e159f003 100644 --- a/kdecore/kernel/kcmdlineargs.cpp +++ b/kdecore/kernel/kcmdlineargs.cpp @@ -269,6 +269,7 @@ KCmdLineArgsStatic::KCmdLineArgsStatic () { qt_options.add("title ", ki18n("sets the application title (caption)")); qt_options.add("reverse", ki18n("mirrors the whole layout of widgets")); qt_options.add("stylesheet <file.qss>", ki18n("applies the Katie stylesheet to the application widgets")); + qt_options.add("style <style>", ki18n("sets the application GUI style")); // KDE options kde_options.add("caption <caption>", ki18n("Use 'caption' as name in the titlebar")); kde_options.add("icon <icon>", ki18n("Use 'icon' as the application icon")); @@ -277,7 +278,6 @@ KCmdLineArgsStatic::KCmdLineArgsStatic () { #ifdef Q_WS_X11 kde_options.add("waitforwm", ki18n("Waits for a WM_NET compatible windowmanager")); #endif - kde_options.add("style <style>", ki18n("sets the application GUI style")); kde_options.add("geometry <geometry>", ki18n("sets the client geometry of the main widget - see man X for the argument format (usually WidthxHeight+XPos+YPos)")); kde_options.add("smkey <sessionKey>"); // this option is obsolete and exists only to allow smooth upgrades from sessions } diff --git a/kdecore/kernel/kcomponentdata.cpp b/kdecore/kernel/kcomponentdata.cpp index dd1f16e7..23b952ee 100644 --- a/kdecore/kernel/kcomponentdata.cpp +++ b/kdecore/kernel/kcomponentdata.cpp @@ -31,7 +31,23 @@ #include "klocale.h" #include "kconfiggroup.h" #include "kstandarddirs.h" -#include <QtCore/qdebug.h> + +static int kInitAddLibraryAndPluginPaths() +{ + foreach (const QString &it, KGlobal::dirs()->resourceDirs("lib")) { + QCoreApplication::addLibraryPath(it); + } + foreach (const QString &it, KGlobal::dirs()->resourceDirs("module")) { + QCoreApplication::addLibraryPath(it); + } + + foreach (const QString &it, KGlobal::dirs()->resourceDirs("qtplugins")) { + QCoreApplication::addPluginPath(it); + } + return 0; +} +Q_CONSTRUCTOR_FUNCTION(kInitAddLibraryAndPluginPaths); + KComponentData::KComponentData() : d(0) @@ -67,8 +83,7 @@ bool KComponentData::operator==(const KComponentData &rhs) const enum KdeLibraryPathsAdded { NeedLazyInit, - LazyInitDone, - KdeLibraryPathsAddedDone + LazyInitDone }; static KdeLibraryPathsAdded kdeLibraryPathsAdded = NeedLazyInit; @@ -147,21 +162,6 @@ void KComponentDataPrivate::lazyInit(const KComponentData &component) sharedConfig = KSharedConfig::openConfig(component); } } - - // the first KComponentData adds the KDE plugin paths - if (kdeLibraryPathsAdded != KdeLibraryPathsAddedDone) { - kdeLibraryPathsAdded = KdeLibraryPathsAddedDone; - foreach (const QString &it, dirs->resourceDirs("lib")) { - QCoreApplication::addLibraryPath(it); - } - foreach (const QString &it, dirs->resourceDirs("module")) { - QCoreApplication::addLibraryPath(it); - } - - foreach (const QString &it, dirs->resourceDirs("qtplugins")) { - QCoreApplication::addPluginPath(it); - } - } } KStandardDirs *KComponentData::dirs() const diff --git a/kdeui/kernel/kapplication.cpp b/kdeui/kernel/kapplication.cpp index 3115dea3..17adf60c 100644 --- a/kdeui/kernel/kapplication.cpp +++ b/kdeui/kernel/kapplication.cpp @@ -151,12 +151,6 @@ public: { } - ~KApplicationPrivate() - { - } - - KConfig *config() { return KGlobal::config().data(); } - void _k_x11FilterDestroyed(); void _k_checkAppStartedSlot(); void _k_disableAutorestartSlot(); @@ -360,9 +354,6 @@ void KApplicationPrivate::init() // make sure the clipboard is created before setting the window icon (bug 209263) (void) QApplication::clipboard(); - // initialize qt plugin path (see KComponentDataPrivate::lazyInit) - (void) KGlobal::config(); - #if defined Q_WS_X11 KStartupInfoId id = KStartupInfo::currentStartupIdEnv(); KStartupInfo::resetStartupEnv(); @@ -623,16 +614,6 @@ void KApplicationPrivate::parseCommandLine( ) { KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde"); - if (args && args->isSet("style")) - { - extern QString kde_overrideStyle; // see KGlobalSettings. Should we have a static setter? - QString reqStyle(args->getOption("style").toLower()); - if (QStyleFactory::keys().contains(reqStyle, Qt::CaseInsensitive)) - kde_overrideStyle = reqStyle; - else - qWarning() << i18n("The style '%1' was not found", reqStyle); - } - if (args && args->isSet("config")) { QString config = args->getOption("config"); diff --git a/kdeui/kernel/kglobalsettings.cpp b/kdeui/kernel/kglobalsettings.cpp index 96521b0f..a4830f45 100644 --- a/kdeui/kernel/kglobalsettings.cpp +++ b/kdeui/kernel/kglobalsettings.cpp @@ -65,10 +65,6 @@ class KGlobalSettings::Private Private(KGlobalSettings *q) : q(q), activated(false), paletteCreated(false) { - kdeFullSession = !qgetenv("KDE_FULL_SESSION").isEmpty(); - if (!kdeFullSession) { - kdeFullSession = (QProcess::execute("kcheckrunning") == 0); - } } QPalette createApplicationPalette(const KSharedConfigPtr &config); @@ -79,12 +75,10 @@ class KGlobalSettings::Private void kdisplaySetPalette(); void kdisplaySetStyle(); void kdisplaySetFont(); - void applyGUIStyle(); KGlobalSettings *q; bool activated; bool paletteCreated; - bool kdeFullSession; QPalette applicationPalette; }; @@ -507,28 +501,6 @@ void KGlobalSettings::Private::_k_slotNotifyChange(int changeType, int arg) } } -// Set by KApplication -QString kde_overrideStyle; - -void KGlobalSettings::Private::applyGUIStyle() -{ - if (!kdeFullSession) { - return; - } - - if (qApp->type() == KAPPLICATION_GUI_TYPE) { - if (kde_overrideStyle.isEmpty()) { - const KConfigGroup pConfig(KGlobal::config(), "General"); - kde_overrideStyle = pConfig.readEntry("widgetStyle", KStyle::defaultStyle()); - } - if (!kde_overrideStyle.isEmpty()) { - qApp->setStyle(kde_overrideStyle); - } - } - - emit q->kdisplayStyleChanged(); -} - QPalette KGlobalSettings::createApplicationPalette(const KSharedConfigPtr &config) { return self()->d->createApplicationPalette(config); @@ -601,23 +573,12 @@ QPalette KGlobalSettings::Private::createNewApplicationPalette(const KSharedConf void KGlobalSettings::Private::kdisplaySetPalette() { - if (!kdeFullSession) { - return; - } - - if (qApp->type() == KAPPLICATION_GUI_TYPE) { - QApplication::setPalette(q->createApplicationPalette()); - } emit q->kdisplayPaletteChanged(); emit q->appearanceChanged(); } void KGlobalSettings::Private::kdisplaySetFont() { - if (!kdeFullSession) { - return; - } - if (qApp->type() == KAPPLICATION_GUI_TYPE) { QApplication::setFont(KGlobalSettings::generalFont()); const QFont menuFont = KGlobalSettings::menuFont(); @@ -632,7 +593,7 @@ void KGlobalSettings::Private::kdisplaySetFont() void KGlobalSettings::Private::kdisplaySetStyle() { if (qApp->type() == KAPPLICATION_GUI_TYPE) { - applyGUIStyle(); + emit q->kdisplayStyleChanged(); // Reread palette from config file. kdisplaySetPalette(); diff --git a/kdeui/tests/kglobalsettingstest.cpp b/kdeui/tests/kglobalsettingstest.cpp index 2a0373d4..d637bef3 100644 --- a/kdeui/tests/kglobalsettingstest.cpp +++ b/kdeui/tests/kglobalsettingstest.cpp @@ -40,11 +40,6 @@ QTEST_KDEMAIN( KGlobalSettingsTest, GUI ) void KGlobalSettingsTest::initTestCase() { - // Some signals are only emitted when we are running a full KDE session. If - // we are not then KDE applications follow the platform palette and font - // settings. - qputenv("KDE_FULL_SESSION", "1"); - QDBusConnectionInterface *bus = 0; if (!QDBusConnection::sessionBus().isConnected() || !(bus = QDBusConnection::sessionBus().interface())) { QFAIL("Session bus not found");