diff --git a/kdecoration/config/breezeconfigwidget.cpp b/kdecoration/config/breezeconfigwidget.cpp --- a/kdecoration/config/breezeconfigwidget.cpp +++ b/kdecoration/config/breezeconfigwidget.cpp @@ -125,6 +125,15 @@ m_internalSettings->setShadowStrength( qRound( qreal(m_ui.shadowStrength->value()*255)/100 ) ); m_internalSettings->setShadowColor( m_ui.shadowColor->color() ); + // Store in the global animation settings + KSharedConfig::Ptr config = KSharedConfig::openConfig(); + KConfigGroup cg(config, QStringLiteral("KDE")); + if (m_ui.animationsEnabled->isChecked()) { + cg.writeEntry("AnimationDurationFactor", float(m_ui.animationsDuration->value()) / m_ui.animationsDuration->maximum()); + } else { + cg.writeEntry("AnimationDurationFactor", 0.f); + } + // save configuration m_internalSettings->save(); diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -154,6 +154,10 @@ //* update configuration void configurationChanged(); + //* global configuration changed + void globalConfigurationChanged(int type, int arg); + void loadGlobalAnimationSettings(); + //* standard icons QIcon standardIconImplementation( StandardPixmap, const QStyleOption*, const QWidget* ) const; diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -183,6 +183,10 @@ QStringLiteral( "/BreezeDecoration" ), QStringLiteral( "org.kde.Breeze.Style" ), QStringLiteral( "reparseConfiguration" ), this, SLOT(configurationChanged()) ); + dbus.connect( QString(), + QStringLiteral( "/KGlobalSettings" ), + QStringLiteral( "org.kde.KGlobalSettings" ), + QStringLiteral( "notifyChange" ), this, SLOT(configurationChanged()) ); #if QT_VERSION < 0x050D00 // Check if Qt version < 5.13 this->addEventFilter(qApp); #else @@ -1333,6 +1337,41 @@ } + //_____________________________________________________________________ + void Style::loadGlobalAnimationSettings() + { + KSharedConfig::Ptr config = KSharedConfig::openConfig(); + const KConfigGroup cg(config, QStringLiteral("KDE")); + const int animationsDuration = cg.readEntry("AnimationDurationFactor", StyleConfigData::animationsDuration() / 100.0f) * 100; + if (animationsDuration > 0) { + StyleConfigData::setAnimationsDuration(animationsDuration); + StyleConfigData::setAnimationsEnabled(true); + } else { + StyleConfigData::setAnimationsEnabled(false); + } + } + + //_____________________________________________________________________ + void Style::globalConfigurationChanged(int type, int arg) + { + Q_UNUSED(arg); + + // 3 == SettingsChanged, which is manually redefined in + // plasma-integration/src/platformtheme/khintssettings.h and fetched + // from KGlobalConfig in kdelibs4support in plasma-desktop/kcms/*, + // seems to be agreed on by everything in plasma is what sets the + // animation duration + if (type != 3) { + return; + } + + // Reload the new values + loadGlobalAnimationSettings(); + + // reinitialize engines + _animations->setupEngines(); + } + //____________________________________________________________________ QIcon Style::standardIconImplementation( StandardPixmap standardPixmap, const QStyleOption* option, const QWidget* widget ) const { @@ -1382,6 +1421,8 @@ // load helper configuration _helper->loadConfig(); + loadGlobalAnimationSettings(); + // reinitialize engines _animations->setupEngines(); _windowManager->initialize();