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

List:       kde-commits
Subject:    kdebase/kicker/applets/clock
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2005-02-12 9:59:13
Message-ID: 20050212095913.91C631CB12 () office ! kde ! org
[Download RAW message or body]

CVS commit by aseigo: 

yet more fixes for transparency. still probably breaks if you change the
colorscheme and have a custom color setting for the date/day and then log
out and back in. haven't confirmed that yet though


  M +77 -28    clock.cpp   1.203
  M +1 -0      clock.h   1.57
  M +1 -1      prefs.kcfgc   1.3


--- kdebase/kicker/applets/clock/clock.cpp  #1.202:1.203
@@ -885,4 +885,5 @@ ClockApplet::ClockApplet(const QString& 
     connect(m_layoutTimer, SIGNAL(timeout()), this, SLOT(fixupLayout()));
     connect(_timer, SIGNAL(timeout()), SLOT(slotUpdate()));
+    connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(globalPaletteChange()));
 
     reconfigure();    // initialize clock widget
@@ -1231,12 +1232,20 @@ void ClockApplet::setBackground()
             toreset = false;
             _clock->widget()->setPaletteBackgroundPixmap(*brush);
+            QColor globalBgroundColor = \
KApplication::palette().active().background();  
-            if (_date && _date->paletteBackgroundColor() == \
palette().active().background()) +            // See if the clock wants to show the \
day of week. +            // use same font/color as for date
+            showDayOfWeek = _clock->showDayOfWeek();
+            if (showDayOfWeek)
             {
-                _date->setBackgroundOrigin(AncestorOrigin);
-                _date->setPaletteBackgroundPixmap(*brush);
-            }
+                _dayOfWeek->setBackgroundColor(_prefs->dateBackgroundColor());
 
-            if (_dayOfWeek && _dayOfWeek->paletteBackgroundColor() == \
palette().active().background()) +                \
_dayOfWeek->setFont(_prefs->dateFont()); +                QPalette pal = \
_dayOfWeek->palette(); +                pal.setColor(QColorGroup::Foreground, \
_prefs->dateForegroundColor()); +                \
pal.setColor(QColorGroup::Background, _prefs->dateBackgroundColor()); +               \
_dayOfWeek->setPalette(pal); +
+                if (_dayOfWeek->paletteBackgroundColor() == globalBgroundColor)
             {
                 _dayOfWeek->setBackgroundOrigin(AncestorOrigin);
@@ -1244,4 +1253,11 @@ void ClockApplet::setBackground()
             }
         }
+
+            if (_date && _date->paletteBackgroundColor() == globalBgroundColor)
+            {
+                _date->setBackgroundOrigin(AncestorOrigin);
+                _date->setPaletteBackgroundPixmap(*brush);
+            }
+        }
     }
 
@@ -1254,8 +1270,41 @@ void ClockApplet::setBackground()
 }
 
+void ClockApplet::globalPaletteChange()
+{
+    if (!m_followBackgroundSetting)
+    {
+        return;
+    }
+
+    // we need to makes sure we have the background color synced!
+    // otherwise when we switch color schemes again or restart kicker
+    // it might come back non-transparent
+    QColor globalBgroundColor = KApplication::palette().active().background();
+    switch (_prefs->type())
+    {
+        case Prefs::EnumType::Plain:
+            _prefs->setPlainBackgroundColor(globalBgroundColor);
+            break;
+        case Prefs::EnumType::Analog:
+            _prefs->setAnalogBackgroundColor(globalBgroundColor);
+            break;
+        case Prefs::EnumType::Fuzzy:
+            _prefs->setFuzzyBackgroundColor(globalBgroundColor);
+            break;
+        case Prefs::EnumType::Digital:
+        default:
+            _prefs->setDigitalBackgroundColor(globalBgroundColor);
+            break;
+    }
+    _prefs->writeConfig();
+    setBackground();
+}
+
 void ClockApplet::slotUpdate()
 {
   if (_lastDate != clockGetDate())
+    {
     updateDateLabel();
+    }
 
   _clock->updateClock();

--- kdebase/kicker/applets/clock/clock.h  #1.56:1.57
@@ -293,4 +293,5 @@ protected slots:
         void aboutToShowContextMenu();
         void fixupLayout();
+        void globalPaletteChange();
 
 protected:

--- kdebase/kicker/applets/clock/prefs.kcfgc  #1.2:1.3
@@ -3,4 +3,4 @@
 ClassName=Prefs
 Singleton=false
-Mutators=Type,CalendarSize,CalendarFullWindow
+Mutators=Type,CalendarSize,CalendarFullWindow,PlainBackgroundColor,AnalogBackgroundColor,FuzzyBackgroundColor,DigitalBackgroundColor
  # MemberVariables=public


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

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