standardize link colors

svn path=/trunk/KDE/kdelibs/; revision=993491
This commit is contained in:
Aaron J. Seigo 2009-07-08 19:25:20 +00:00
parent 1300eea396
commit 47b8b802ac
3 changed files with 15 additions and 4 deletions

View File

@ -57,6 +57,7 @@ public:
: q(theme),
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
buttonColorScheme(QPalette::Active, KColorScheme::Button, KSharedConfigPtr(0)),
viewColorScheme(KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0))),
defaultWallpaperTheme(DEFAULT_WALLPAPER_THEME),
defaultWallpaperSuffix(DEFAULT_WALLPAPER_SUFFIX),
defaultWallpaperWidth(DEFAULT_WALLPAPER_WIDTH),
@ -140,6 +141,7 @@ public:
KSharedConfigPtr colors;
KColorScheme colorScheme;
KColorScheme buttonColorScheme;
KColorScheme viewColorScheme;
KConfigGroup cfg;
QFont generalFont;
QString defaultWallpaperTheme;
@ -253,6 +255,7 @@ void ThemePrivate::colorsChanged()
discardCache(true);
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
emit q->themeChanged();
}
@ -439,6 +442,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
hasWallpapers = KStandardDirs::exists(KStandardDirs::locateLocal("data", "desktoptheme/" + theme + "/wallpapers/"));
if (isDefault && writeSettings) {
@ -598,6 +602,12 @@ QColor Theme::color(ColorRole role) const
case ButtonBackgroundColor:
return d->buttonColorScheme.background(KColorScheme::ActiveBackground).color();
break;
case LinkColor:
return d->viewColorScheme.foreground(KColorScheme::LinkText).color();
case VisitedLinkColor:
return d->viewColorScheme.foreground(KColorScheme::VisitedText).color();
}
return QColor();

View File

@ -65,7 +65,9 @@ class PLASMA_EXPORT Theme : public QObject
on the background */
BackgroundColor = 2, /**< the default background color */
ButtonTextColor = 4, /** text color for buttons */
ButtonBackgroundColor = 8 /** background color for buttons*/
ButtonBackgroundColor = 8, /** background color for buttons*/
LinkColor = 16, /** color for clickable links */
VisitedLinkColor = 32 /** color visited clickable links */
};
enum FontRole {

View File

@ -76,9 +76,8 @@ public:
p.setColor(QPalette::Normal, QPalette::WindowText, color);
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Plasma::Theme::defaultTheme()->colorScheme());
p.setColor(QPalette::Normal, QPalette::Link, colorScheme.foreground(KColorScheme::LinkText).color());
p.setColor(QPalette::Normal, QPalette::LinkVisited, colorScheme.foreground(KColorScheme::VisitedText).color());
p.setColor(QPalette::Normal, QPalette::Link, Theme::defaultTheme()->color(Theme::LinkColor));
p.setColor(QPalette::Normal, QPalette::LinkVisited, Theme::defaultTheme()->color(Theme::VisitedLinkColor));
native->setPalette(p);
native->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
}