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

View File

@ -65,7 +65,9 @@ class PLASMA_EXPORT Theme : public QObject
on the background */ on the background */
BackgroundColor = 2, /**< the default background color */ BackgroundColor = 2, /**< the default background color */
ButtonTextColor = 4, /** text color for buttons */ 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 { enum FontRole {

View File

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