Bug 157320 - text colour does not obey colour scheme presets
Summary: text colour does not obey colour scheme presets
Status: RESOLVED FIXED
Alias: None
Product: kiten
Classification: Applications
Component: general (show other bugs)
Version: 1.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Joseph Kerian
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-07 08:26 UTC by Frederik Schwarzer
Modified: 2008-04-23 17:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederik Schwarzer 2008-02-07 08:26:02 UTC
Version:           1.2 (using KDE 4.0.0)
Installed from:    Debian testing/unstable Packages

I use the darkish color scheme "obsidian coast" which usually has light fonts on a dark background color.
In Kiten the fonts in text areas are still black.
Black fonts are hard to read on a dark background.
Comment 1 Joseph Kerian 2008-03-04 15:28:20 UTC
Excellent point. kiten was not actually supposed to be released as part of KDE4.0, but I'm leaving this open to remind me to fix it before 4.1.
Comment 2 djp8 2008-03-11 11:01:02 UTC
I can confirm this on KDE 4.0.2. I'm using Kiten 1.2 for KDE 3.5.9 until this bug is resolved.
Comment 3 Joseph Kerian 2008-04-22 16:38:37 UTC
Confirmed... can see this by running 'kcmshell4 colors' and opening kiten. It only effects the results display. Likely a problem in either the widget parentage of the khtml view, or the default css for that view.
Comment 4 Harald Hvaal 2008-04-23 15:26:32 UTC
Fixed with revision 800148.
Comment 5 Frederik Schwarzer 2008-04-23 17:29:03 UTC
Ciff and closing since it was not done automatically.

r800148

Index: resultsView.h                                                                         
===================================================================                          
--- resultsView.h       (revision 800147)                                                    
+++ resultsView.h       (revision 800148)                                                    
@@ -67,6 +67,7 @@                                                                            
                    const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments());
                                                                                              
                QString deLinkify(DOM::Node);                                                 
+               QString generateCSS();                                                        
                                                                                              
        private:                                                                              
                QString printText;                                                            
Index: resultsView.cpp                                                                        
===================================================================                           
--- resultsView.cpp     (revision 800147)                                                     
+++ resultsView.cpp     (revision 800148)                                                     
@@ -33,6 +33,7 @@                                                                             
 #include <kactionmenu.h>                                                                     
 #include <klocale.h>                                                                         
 #include <kactioncollection.h>                                                               
+#include <kcolorscheme.h>                                                                    
                                                                                              
 ResultView::ResultView(QWidget *parent, const char *name)                                    
        : KHTMLPart(parent, parent)                                                           
@@ -63,6 +64,7 @@                                                                             
 void ResultView::flush()                                                                     
 {                                                                                            
        begin();                                                                              
+       setUserStyleSheet(generateCSS());                                                     
        write(printText);                                                                     
        end();                                                                                
 //KDE4 CHANGE  setCursorPosition(0, 0);                                                      
@@ -74,8 +76,11 @@                                                                            
 {                                                                                            
                                                                                              
        begin();                                                                              
+       setUserStyleSheet(generateCSS());                                                     
        write(text);                                                                          
        end();                                                                                
+                                                                                             
+       kDebug() << "Set CSS to " << generateCSS();                                           
 //KDE4 CHANGE  setCursorPosition(0,0);                                                       
        ////////ensureCursorVisible();                                                        
 }                                                                                            
@@ -139,6 +144,11 @@                                                                          
 /** updates the font.  Used on font change */                                                
 void ResultView::updateFont()
 {
+       begin();
+       setUserStyleSheet(generateCSS());
+       //write(
+       end();
+
        ////////setFont(KitenConfigSkeleton::self()->font());
 }

@@ -168,5 +178,27 @@
        return word;
 }

+QString ResultView::generateCSS()
+{
+       KColorScheme scheme(QPalette::Active);
+       return QString(
+                       ".Word { font-size: x-large; }"
+                       ".Entry { color: %1; }"
+                       ".DictionaryHeader { color: %2; border-bottom: solid %3 }"
+                       "a:link { color: %4; }"
+                       "a:visited {color: %5} "
+                       "a:hover {color: %6 } "
+                       "a:active {color: %6}"
+                  )
+               .arg(scheme.foreground().color().name())
+               .arg(scheme.foreground(KColorScheme::InactiveText).color().name())
+               .arg(scheme.shade(KColorScheme::MidlightShade).name())
+               .arg(scheme.foreground(KColorScheme::LinkText).color().name())
+               .arg(scheme.foreground(KColorScheme::VisitedText).color().name())
+               .arg(scheme.foreground(KColorScheme::ActiveText).color().name())
+               ;

+}
+
+
 #include "resultsView.moc"