Fix theme manager overwriting undefined theme settings with garbage

This resolves Bug 1174
Fix tderandrtray displaying profile list when only the default profile is available
pull/2/head
Timothy Pearson 11 years ago
parent f08ddb4652
commit 77cbd6e957

@ -410,22 +410,21 @@ void KTheme::apply()
desktopConf.writeEntry( "DeskNum", desktopElem.attribute( "number", "0" ).toUInt() ); desktopConf.writeEntry( "DeskNum", desktopElem.attribute( "number", "0" ).toUInt() );
desktopConf.setGroup( TQString( "Desktop%1" ).arg( i ) ); desktopConf.setGroup( TQString( "Desktop%1" ).arg( i ) );
desktopConf.writeEntry( "BackgroundMode", getProperty( desktopElem, "mode", "id" ) ); if (getProperty( desktopElem, "mode", "id" ) != TQString::null) desktopConf.writeEntry( "BackgroundMode", getProperty( desktopElem, "mode", "id" ) );
desktopConf.writeEntry( "Color1", TQColor( getProperty( desktopElem, "color1", "rgb" ) ) ); if (getProperty( desktopElem, "color1", "rgb" ) != TQString::null) desktopConf.writeEntry( "Color1", TQColor( getProperty( desktopElem, "color1", "rgb" ) ) );
desktopConf.writeEntry( "Color2", TQColor( getProperty( desktopElem, "color2", "rgb" ) ) ); if (getProperty( desktopElem, "color2", "rgb" ) != TQString::null) desktopConf.writeEntry( "Color2", TQColor( getProperty( desktopElem, "color2", "rgb" ) ) );
desktopConf.writeEntry( "BlendMode", getProperty( desktopElem, "blending", "mode" ) ); if (getProperty( desktopElem, "blending", "mode" ) != TQString::null) desktopConf.writeEntry( "BlendMode", getProperty( desktopElem, "blending", "mode" ) );
desktopConf.writeEntry( "BlendBalance", getProperty( desktopElem, "blending", "balance" ) ); if (getProperty( desktopElem, "blending", "balance" ) != TQString::null) desktopConf.writeEntry( "BlendBalance", getProperty( desktopElem, "blending", "balance" ) );
desktopConf.writeEntry( "ReverseBlending", if (getProperty( desktopElem, "blending", "reverse" ) != TQString::null) desktopConf.writeEntry( "ReverseBlending", static_cast<bool>( getProperty( desktopElem, "blending", "reverse" ).toUInt() ) );
static_cast<bool>( getProperty( desktopElem, "blending", "reverse" ).toUInt() ) ); if (getProperty( desktopElem, "pattern", "name" ) != TQString::null) desktopConf.writeEntry( "Pattern", getProperty( desktopElem, "pattern", "name" ) );
desktopConf.writeEntry( "Pattern", getProperty( desktopElem, "pattern", "name" ) ); if (getProperty( desktopElem, "wallpaper", "url" ) != TQString::null) desktopConf.writeEntry( "Wallpaper", unprocessFilePath( "desktop", getProperty( desktopElem, "wallpaper", "url" ) ) );
desktopConf.writeEntry( "Wallpaper", if (getProperty( desktopElem, "wallpaper", "mode" ) != TQString::null) desktopConf.writeEntry( "WallpaperMode", getProperty( desktopElem, "wallpaper", "mode" ) );
unprocessFilePath( "desktop", getProperty( desktopElem, "wallpaper", "url" ) ) );
desktopConf.writeEntry( "WallpaperMode", getProperty( desktopElem, "wallpaper", "mode" ) ); if ( common ) {
if ( common )
break; // stop here break; // stop here
} }
} }
}
// 11. Screensaver // 11. Screensaver
TQDomElement saverElem = m_dom.elementsByTagName( "screensaver" ).item( 0 ).toElement(); TQDomElement saverElem = m_dom.elementsByTagName( "screensaver" ).item( 0 ).toElement();
@ -439,8 +438,9 @@ void KTheme::apply()
desktopConf.sync(); // TODO sync and signal only if <desktop> elem present desktopConf.sync(); // TODO sync and signal only if <desktop> elem present
// reconfigure kdesktop. kdesktop will notify all clients // reconfigure kdesktop. kdesktop will notify all clients
DCOPClient *client = kapp->dcopClient(); DCOPClient *client = kapp->dcopClient();
if ( !client->isAttached() ) if ( !client->isAttached() ) {
client->attach(); client->attach();
}
client->send("kdesktop", "KBackgroundIface", "configure()", TQString("")); client->send("kdesktop", "KBackgroundIface", "configure()", TQString(""));
// FIXME Xinerama // FIXME Xinerama
@ -457,30 +457,37 @@ void KTheme::apply()
{ {
TQDomElement iconSubElem = iconList.item( i ).toElement(); TQDomElement iconSubElem = iconList.item( i ).toElement();
TQString object = iconSubElem.attribute( "object" ); TQString object = iconSubElem.attribute( "object" );
if ( object == "desktop" ) if ( object == "desktop" ) {
iconConf->setGroup( "DesktopIcons" ); iconConf->setGroup( "DesktopIcons" );
else if ( object == "mainToolbar" ) }
else if ( object == "mainToolbar" ) {
iconConf->setGroup( "MainToolbarIcons" ); iconConf->setGroup( "MainToolbarIcons" );
else if ( object == "panel" ) }
else if ( object == "panel" ) {
iconConf->setGroup( "PanelIcons" ); iconConf->setGroup( "PanelIcons" );
else if ( object == "small" ) }
else if ( object == "small" ) {
iconConf->setGroup( "SmallIcons" ); iconConf->setGroup( "SmallIcons" );
else if ( object == "toolbar" ) }
else if ( object == "toolbar" ) {
iconConf->setGroup( "ToolbarIcons" ); iconConf->setGroup( "ToolbarIcons" );
}
TQString iconName = iconSubElem.tagName(); TQString iconName = iconSubElem.tagName();
if ( iconName.contains( "Color" ) ) if ( iconName.contains( "Color" ) ) {
{
TQColor iconColor = TQColor( iconSubElem.attribute( "rgb" ) ); TQColor iconColor = TQColor( iconSubElem.attribute( "rgb" ) );
iconConf->writeEntry( iconName, iconColor, true, true ); iconConf->writeEntry( iconName, iconColor, true, true );
} }
else if ( iconName.contains( "Value" ) || iconName == "Size" ) else if ( iconName.contains( "Value" ) || iconName == "Size" ) {
iconConf->writeEntry( iconName, iconSubElem.attribute( "value" ).toUInt(), true, true ); iconConf->writeEntry( iconName, iconSubElem.attribute( "value" ).toUInt(), true, true );
else if ( iconName.contains( "Effect" ) ) }
else if ( iconName.contains( "Effect" ) ) {
iconConf->writeEntry( iconName, iconSubElem.attribute( "name" ), true, true ); iconConf->writeEntry( iconName, iconSubElem.attribute( "name" ), true, true );
else }
else {
iconConf->writeEntry( iconName, static_cast<bool>( iconSubElem.attribute( "value" ).toUInt() ), true, true ); iconConf->writeEntry( iconName, static_cast<bool>( iconSubElem.attribute( "value" ).toUInt() ), true, true );
} }
}
iconConf->sync(); iconConf->sync();
for ( int i = 0; i < TDEIcon::LastGroup; i++ ) for ( int i = 0; i < TDEIcon::LastGroup; i++ )
@ -576,21 +583,22 @@ void KTheme::apply()
TDEConfig twinConf( "twinrc" ); TDEConfig twinConf( "twinrc" );
twinConf.setGroup( "Style" ); twinConf.setGroup( "Style" );
TQString type = wmElem.attribute( "type" ); TQString type = wmElem.attribute( "type" );
if ( type == "builtin" ) if ( type == "builtin" ) {
twinConf.writeEntry( "PluginLib", wmElem.attribute( "name" ) ); twinConf.writeEntry( "PluginLib", wmElem.attribute( "name" ) );
}
//else // TODO support custom themes //else // TODO support custom themes
TQDomNodeList buttons = wmElem.elementsByTagName ("buttons"); TQDomNodeList buttons = wmElem.elementsByTagName ("buttons");
if ( buttons.count() > 0 ) if ( buttons.count() > 0 )
{ {
twinConf.writeEntry( "CustomButtonPositions", true ); twinConf.writeEntry( "CustomButtonPositions", true );
twinConf.writeEntry( "ButtonsOnLeft", getProperty( wmElem, "buttons", "left" ) ); if (getProperty( wmElem, "buttons", "left" ) != TQString::null) twinConf.writeEntry( "ButtonsOnLeft", getProperty( wmElem, "buttons", "left" ) );
twinConf.writeEntry( "ButtonsOnRight", getProperty( wmElem, "buttons", "right" ) ); if (getProperty( wmElem, "buttons", "right" ) != TQString::null) twinConf.writeEntry( "ButtonsOnRight", getProperty( wmElem, "buttons", "right" ) );
} }
else else
{ {
twinConf.writeEntry( "CustomButtonPositions", false ); twinConf.writeEntry( "CustomButtonPositions", false );
} }
twinConf.writeEntry( "BorderSize", getProperty( wmElem, "border", "size" ) ); if (getProperty( wmElem, "border", "size" ) != TQString::null) twinConf.writeEntry( "BorderSize", getProperty( wmElem, "border", "size" ) );
twinConf.sync(); twinConf.sync();
client->send( "twin", "", "reconfigure()", TQString("") ); client->send( "twin", "", "reconfigure()", TQString("") );
@ -603,8 +611,8 @@ void KTheme::apply()
{ {
TDEConfig konqConf( "konquerorrc" ); TDEConfig konqConf( "konquerorrc" );
konqConf.setGroup( "Settings" ); konqConf.setGroup( "Settings" );
konqConf.writeEntry( "BgImage", unprocessFilePath( "konqueror", getProperty( konqElem, "wallpaper", "url" ) ) ); if (getProperty( konqElem, "wallpaper", "url" ) != TQString::null) konqConf.writeEntry( "BgImage", unprocessFilePath( "konqueror", getProperty( konqElem, "wallpaper", "url" ) ) );
konqConf.writeEntry( "BgColor", TQColor( getProperty( konqElem, "bgcolor", "rgb" ) ) ); if (getProperty( konqElem, "bgcolor", "rgb" ) != TQString::null) konqConf.writeEntry( "BgColor", TQColor( getProperty( konqElem, "bgcolor", "rgb" ) ) );
konqConf.sync(); konqConf.sync();
client->send("konqueror*", "KonquerorIface", "reparseConfiguration()", TQString("")); // FIXME seems not to work :( client->send("konqueror*", "KonquerorIface", "reparseConfiguration()", TQString("")); // FIXME seems not to work :(
@ -621,18 +629,13 @@ void KTheme::apply()
if ( !kickerBgUrl.isEmpty() ) if ( !kickerBgUrl.isEmpty() )
{ {
kickerConf.writeEntry( "UseBackgroundTheme", true ); kickerConf.writeEntry( "UseBackgroundTheme", true );
kickerConf.writeEntry( "BackgroundTheme", unprocessFilePath( "panel", kickerBgUrl ) ); if (getProperty( panelElem, "panel", kickerBgUrl ) != TQString::null) kickerConf.writeEntry( "BackgroundTheme", unprocessFilePath( "panel", kickerBgUrl ) );
kickerConf.writeEntry( "ColorizeBackground", if (getProperty( panelElem, "background", "colorize" ) != TQString::null) kickerConf.writeEntry( "ColorizeBackground", static_cast<bool>( getProperty( panelElem, "background", "colorize" ).toUInt() ) );
static_cast<bool>( getProperty( panelElem, "background", "colorize" ).toUInt() ) );
} }
kickerConf.writeEntry( "Transparent", if (getProperty( panelElem, "transparent", "value" ) != TQString::null) kickerConf.writeEntry( "Transparent", static_cast<bool>( getProperty( panelElem, "transparent", "value" ).toUInt() ) );
static_cast<bool>( getProperty( panelElem, "transparent", "value" ).toUInt() ) ); if (getProperty( panelElem, "position", "value" ) != TQString::null) kickerConf.writeEntry( "Position", static_cast<int> (getProperty( panelElem, "position", "value" ).toUInt() ));
if (getProperty( panelElem, "showlefthidebutton", "value" ) != TQString::null) kickerConf.writeEntry( "ShowLeftHideButton", static_cast<bool>( getProperty( panelElem, "showlefthidebutton", "value").toInt()));
kickerConf.writeEntry( "Position", static_cast<int> (getProperty( panelElem, "position", "value" ).toUInt() )); if (getProperty( panelElem, "showrighthidebutton", "value" ) != TQString::null) kickerConf.writeEntry( "ShowRightHideButton", static_cast<bool>( getProperty( panelElem, "showrighthidebutton", "value").toInt()));
kickerConf.writeEntry( "ShowLeftHideButton", static_cast<bool>( getProperty( panelElem, "showlefthidebutton", "value").toInt()));
kickerConf.writeEntry( "ShowRightHideButton", static_cast<bool>( getProperty( panelElem, "showrighthidebutton", "value").toInt()));
kickerConf.sync(); kickerConf.sync();
client->send("kicker", "Panel", "configure()", TQString("")); client->send("kicker", "Panel", "configure()", TQString(""));

@ -280,9 +280,8 @@ void KRandRSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu)
// Find any display profiles // Find any display profiles
TQStringList displayProfiles; TQStringList displayProfiles;
displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true)); displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true));
if (displayProfiles.isEmpty() == false) { if (!displayProfiles.isEmpty()) {
menu->insertTitle(SmallIcon("background"), i18n("Display Profiles")); menu->insertTitle(SmallIcon("background"), i18n("Display Profiles"));
}
lastIndex = menu->insertItem(SmallIcon("bookmark"), "<default>"); lastIndex = menu->insertItem(SmallIcon("bookmark"), "<default>");
menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int))); menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int)));
for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t) { for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t) {
@ -290,6 +289,7 @@ void KRandRSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu)
menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int))); menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int)));
} }
} }
}
menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation")); menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation"));

Loading…
Cancel
Save