Read default values from .desktop files when finding out whether an effect is enabled,
otherwise the effect-for-alt+tab combo resets to no effect when the dialog is used the first time. svn path=/trunk/KDE/kdebase/workspace/; revision=866648
This commit is contained in:
parent
9ad12bc391
commit
0ca1edbfe8
2 changed files with 18 additions and 6 deletions
|
@ -286,25 +286,35 @@ void KWinCompositingConfig::loadGeneralTab()
|
||||||
#undef LOAD_EFFECT_CONFIG
|
#undef LOAD_EFFECT_CONFIG
|
||||||
|
|
||||||
// window switching
|
// window switching
|
||||||
if( effectconfig.readEntry("kwin4_effect_boxswitchEnabled", false) )
|
if( effectEnabled( "boxswitch", effectconfig ))
|
||||||
ui.windowSwitchingCombo->setCurrentIndex( 1 );
|
ui.windowSwitchingCombo->setCurrentIndex( 1 );
|
||||||
if( effectconfig.readEntry("kwin4_effect_coverswitchEnabled", false) )
|
if( effectEnabled( "coverswitch", effectconfig ))
|
||||||
ui.windowSwitchingCombo->setCurrentIndex( 3 );
|
ui.windowSwitchingCombo->setCurrentIndex( 3 );
|
||||||
if( effectconfig.readEntry("kwin4_effect_flipswitchEnabled", false) )
|
if( effectEnabled( "flipswitch", effectconfig ))
|
||||||
ui.windowSwitchingCombo->setCurrentIndex( 4 );
|
ui.windowSwitchingCombo->setCurrentIndex( 4 );
|
||||||
KConfigGroup presentwindowsconfig(mKWinConfig, "Effect-PresentWindows");
|
KConfigGroup presentwindowsconfig(mKWinConfig, "Effect-PresentWindows");
|
||||||
if( effectconfig.readEntry("kwin4_effect_presentwindowsEnabled", false) && presentwindowsconfig.readEntry("TabBox", false) )
|
if( effectEnabled( "presentwindows", effectconfig ) && presentwindowsconfig.readEntry("TabBox", false) )
|
||||||
ui.windowSwitchingCombo->setCurrentIndex( 2 );
|
ui.windowSwitchingCombo->setCurrentIndex( 2 );
|
||||||
|
|
||||||
// desktop switching
|
// desktop switching
|
||||||
if( effectconfig.readEntry("kwin4_effect_slideEnabled", false) )
|
if( effectEnabled( "slide", effectconfig ))
|
||||||
ui.desktopSwitchingCombo->setCurrentIndex( 1 );
|
ui.desktopSwitchingCombo->setCurrentIndex( 1 );
|
||||||
KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube");
|
KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube");
|
||||||
if( effectconfig.readEntry("kwin4_effect_cubeEnabled", false) && cubeconfig.readEntry("AnimateDesktopChange", false) )
|
if( effectEnabled( "cube", effectconfig ) && cubeconfig.readEntry("AnimateDesktopChange", false))
|
||||||
ui.desktopSwitchingCombo->setCurrentIndex( 2 );
|
ui.desktopSwitchingCombo->setCurrentIndex( 2 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool KWinCompositingConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const
|
||||||
|
{
|
||||||
|
KService::List services = KServiceTypeTrader::self()->query(
|
||||||
|
"KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + "'");
|
||||||
|
if( services.isEmpty())
|
||||||
|
return false;
|
||||||
|
QVariant v = services.first()->property("X-KDE-PluginInfo-EnabledByDefault");
|
||||||
|
return cfg.readEntry("kwin4_effect_" + effect + "Enabled", v.toBool());
|
||||||
|
}
|
||||||
|
|
||||||
void KWinCompositingConfig::loadEffectsTab()
|
void KWinCompositingConfig::loadEffectsTab()
|
||||||
{
|
{
|
||||||
ui.effectSelector->load();
|
ui.effectSelector->load();
|
||||||
|
|
|
@ -72,6 +72,8 @@ class KWinCompositingConfig : public KCModule
|
||||||
void initEffectSelector();
|
void initEffectSelector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const;
|
||||||
|
|
||||||
KSharedConfigPtr mKWinConfig;
|
KSharedConfigPtr mKWinConfig;
|
||||||
Ui::KWinCompositingConfig ui;
|
Ui::KWinCompositingConfig ui;
|
||||||
CompositingPrefs mDefaultPrefs;
|
CompositingPrefs mDefaultPrefs;
|
||||||
|
|
Loading…
Reference in a new issue