Port theme away from KGlobalSettings

This commit is contained in:
Sebastian Kügler 2013-10-05 06:11:08 +02:00
parent 18c12fb520
commit c244c5a24a
2 changed files with 17 additions and 4 deletions

View File

@ -539,11 +539,13 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
if (colorsFile.isEmpty()) {
colors = 0;
// QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
// this, SLOT(colorsChanged()), Qt::UniqueConnection);
if (qApp) {
installEventFilter(qApp);
}
} else {
// QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
// this, SLOT(colorsChanged()));
if (qApp) {
removeEventFilter(qApp);
}
colors = KSharedConfig::openConfig(colorsFile);
}
@ -567,6 +569,16 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
scheduleThemeChangeNotification(SvgElementsCache);
}
bool ThemePrivate::eventFilter(QObject *watched, QEvent *event)
{
if (watched == QCoreApplication::instance()) {
if (event->type() == QEvent::ApplicationPaletteChange) {
colorsChanged();
}
}
return QObject::eventFilter(watched, event);
}
}
#include "moc_theme_p.cpp"

View File

@ -115,6 +115,7 @@ public:
KColorScheme colorScheme;
KColorScheme buttonColorScheme;
KColorScheme viewColorScheme;
bool eventFilter(QObject *watched, QEvent *event);
KConfigGroup cfg;
QString defaultWallpaperTheme;
QString defaultWallpaperSuffix;