[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Alternate color fixes
From:       Antonio Larrosa =?iso-8859-1?q?Jim=E9nez?= <larrosa () kde ! org>
Date:       2001-07-23 18:13:21
[Download RAW message or body]

Hi,

This patch fixes some problems with the alternate color in listviews.
On one hand, it recalculates the correct alternate color given the current 
color schema so that you don't get a list view with (for example) when 
using alternate "orange" and "dark grey" rows but "orange" and "slightly 
dark orange" when using the "Media Peach" color scheme.

Also, it fixes it to reload the correct colors in runtime after changing 
the color scheme in kcontrol (currently, just for KFileDialogs, I'm having 
a look to fix it in Konqueror's list views).

Please review the attached patches (for kdecore, kdeui, kfile and 
kcontrol/colors). I'll commit it later tonight or tomorrow afternoon if I 
find any problem tonight.

Greetings,

--
Antonio Larrosa Jimenez
KDE Core developer  - larrosa@kde.org
SuSE Labs developer - larrosa@suse.de
http://perso.wanadoo.es/antlarr
KDE - The development framework of the future, today.

["colorscm.cpp.diff" (text/x-diff)]

Index: colorscm.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/colors/colorscm.cpp,v
retrieving revision 1.25
diff -u -p -r1.25 colorscm.cpp
--- colorscm.cpp	2001/06/27 03:09:40	1.25
+++ colorscm.cpp	2001/07/23 18:00:43
@@ -161,7 +161,7 @@ KColorScheme::KColorScheme(QWidget *pare
     setColorName(i18n("Inactive title button"), CSM_Inactive_title_button);
     setColorName(i18n("Link"), CSM_Link);
     setColorName(i18n("Followed Link"), CSM_Followed_Link);
-	setColorName(i18n("Alternate background in lists"), CSM_Alternate_background);
+    setColorName(i18n("Alternate background in lists"), CSM_Alternate_background);
 
     wcCombo->adjustSize();
     connect(wcCombo, SIGNAL(activated(int)), SLOT(slotWidgetColor(int)));
@@ -522,8 +522,8 @@ QColor &KColorScheme::color(int index)
     return cs->link;
     case CSM_Followed_Link:
     return cs->visitedLink;
-	case CSM_Alternate_background:
-	return cs->alternateBackground;
+    case CSM_Alternate_background:
+    return cs->alternateBackground;
     }
 
     assert(0); // Should never be here!
@@ -592,7 +592,7 @@ void KColorScheme::readScheme( int index
 
     QColor link(0, 0, 192);
     QColor visitedLink(128, 0,128);
-	QColor alternate(240, 240, 240);
+    QColor alternate(240, 240, 240);
 
     // note: keep default color scheme in sync with default Current Scheme
     if (index == 1) {
@@ -615,7 +615,7 @@ void KColorScheme::readScheme( int index
       cs->iTitleBtn   = cs->back;
       cs->link        = link;
       cs->visitedLink = visitedLink;
-	  cs->alternateBackground = alternate;
+      cs->alternateBackground = alternate;
 
       cs->contrast    = 7;
 
@@ -647,7 +647,8 @@ void KColorScheme::readScheme( int index
     cs->buttonTxt = config->readColorEntry( "buttonForeground", &black );
     cs->link = config->readColorEntry( "linkColor", &link );
     cs->visitedLink = config->readColorEntry( "visitedLinkColor", &visitedLink );
-	cs->alternateBackground = config->readColorEntry( "alternateBackground", &alternate );
+    alternate = cs->window.dark(106);
+    cs->alternateBackground = config->readColorEntry( "alternateBackground", &alternate );
 
     if (index == 0)
       config->setGroup( "WM" );

["kglobalsettings.diff" (text/x-diff)]

Index: kglobalsettings.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kglobalsettings.cpp,v
retrieving revision 1.44
diff -u -p -r1.44 kglobalsettings.cpp
--- kglobalsettings.cpp	2001/06/12 14:56:09	1.44
+++ kglobalsettings.cpp	2001/07/23 18:01:11
@@ -47,7 +47,8 @@ QFont *KGlobalSettings::_windowTitleFont
 QFont *KGlobalSettings::_taskbarFont = 0;
 QColor *KGlobalSettings::kde2Blue = 0;
 QColor *KGlobalSettings::kde2Gray = 0;
-QColor *KGlobalSettings::kde2LightGray = 0;
+QColor *KGlobalSettings::kde2AlternateColor = 0;
+
 KGlobalSettings::KMouseSettings *KGlobalSettings::s_mouseSettings = 0;
 
 int KGlobalSettings::dndEventDelay()
@@ -234,7 +235,8 @@ QColor KGlobalSettings::alternateBackgro
     initColors();
     KConfig *c = KGlobal::config();
     KConfigGroupSaver cgs( c, QString::fromLatin1("General") );
-    return c->readColorEntry( "alternateBackground", kde2LightGray );
+    *kde2AlternateColor=baseColor().dark(106);
+    return c->readColorEntry( "alternateBackground", kde2AlternateColor );
 }
 
 QColor KGlobalSettings::linkColor()
@@ -434,8 +436,8 @@ void KGlobalSettings::initColors()
       else
         kde2Blue = new QColor(0, 0, 192);
     }
-    if (!kde2LightGray)
-      kde2LightGray = new QColor(240, 240, 240);
+    if (!kde2AlternateColor)
+      kde2AlternateColor = new QColor(240, 240, 240);
 }
 
 void KGlobalSettings::rereadFontSettings()
Index: kglobalsettings.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kglobalsettings.h,v
retrieving revision 1.24
diff -u -p -r1.24 kglobalsettings.h
--- kglobalsettings.h	2001/07/15 19:22:12	1.24
+++ kglobalsettings.h	2001/07/23 18:01:12
@@ -279,7 +279,7 @@ private:
     static QFont *_taskbarFont;
     static QColor * kde2Gray;
     static QColor * kde2Blue;
-    static QColor * kde2LightGray;
+    static QColor * kde2AlternateColor;
     static KMouseSettings *s_mouseSettings;
 
     friend class KApplication;

["klistview.cpp.diff" (text/x-diff)]

Index: klistview.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/klistview.cpp,v
retrieving revision 1.145
diff -u -p -r1.145 klistview.cpp
--- klistview.cpp	2001/07/01 11:47:56	1.145
+++ klistview.cpp	2001/07/23 18:01:31
@@ -541,6 +541,14 @@ void KListView::leaveEvent( QEvent *e )
   QListView::leaveEvent( e );
 }
 
+bool KListView::event( QEvent *e )
+{
+  if (e->type() == QEvent::ApplicationPaletteChange)
+    d->alternateBackground=KGlobalSettings::alternateBackgroundColor();
+  
+  return QListView::event(e);
+}
+
 void KListView::contentsMousePressEvent( QMouseEvent *e )
 {
   if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) )
@@ -1741,7 +1749,7 @@ const QColor &KListViewItem::backgroundC
     if (d->odd)
       return lv->alternateBackground();
   }
-  return listView()->viewport()->backgroundColor();
+  return listView()->viewport()->colorGroup().base();
 }
 
 void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)

["kdiroperator.cpp.diff" (text/x-diff)]

Index: kdiroperator.cpp
===================================================================
RCS file: /home/kde/kdelibs/kfile/kdiroperator.cpp,v
retrieving revision 1.99
diff -u -p -r1.99 kdiroperator.cpp
--- kdiroperator.cpp	2001/07/11 14:47:29	1.99
+++ kdiroperator.cpp	2001/07/23 18:01:51
@@ -147,6 +147,7 @@ KDirOperator::KDirOperator(const KURL& u
     setupMenu();
 
     setFocusPolicy(QWidget::WheelFocus);
+    setBackgroundMode( PaletteBase );
 }
 
 KDirOperator::~KDirOperator()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic