[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-03-04 19:10:26
Message-ID: 20050304191026.9C3FE157B9 () office ! kde ! org
[Download RAW message or body]
CVS commit by aseigo:
layout fix for date-before-clock when scrolling through the timezones
M +44 -33 clock.cpp 1.208
--- kdebase/kicker/applets/clock/clock.cpp #1.207:1.208
@@ -961,14 +961,13 @@ int ClockApplet::widthForHeight(int h) c
}
- static int lastWidth = -1;
int clockWidth = _clock->preferedWidthForHeight(KMAX(0, h - shareDateHeight - \
shareDayOfWeekHeight)); int w = clockWidth;
if (!mustShowDate && !showDayOfWeek)
{
- if (lastWidth == w)
- {
- return w;
- }
+ // resize the date widgets in case the are to the left of the clock
_clock->widget()->setFixedSize(w, h);
+ _clock->widget()->move(0,0);
+ _dayOfWeek->move(clockWidth + 4, 0);
+ _date->move(clockWidth + 4, 0);
}
else
@@ -980,10 +979,4 @@ int ClockApplet::widthForHeight(int h) c
{
w += dateWidth + dayOfWeekWidth;
-
- if (lastWidth == w)
- {
- return w;
- }
-
bool dateFirst = false;
@@ -1013,4 +1006,6 @@ int ClockApplet::widthForHeight(int h) c
{
_clock->widget()->setFixedSize(clockWidth, h);
+ _clock->widget()->move(0,0);
+
if (showDayOfWeek)
{
@@ -1030,9 +1025,4 @@ int ClockApplet::widthForHeight(int h) c
w = KMAX(KMAX(w, dateWidth), dayOfWeekWidth);
- if (lastWidth == w)
- {
- return w;
- }
-
_clock->widget()->setFixedSize(w, h - shareDateHeight - \
shareDayOfWeekHeight);
_clock->widget()->setMinimumSize(w, h - shareDateHeight - \
shareDayOfWeekHeight); @@ -1517,9 +1507,9 @@ void ClockApplet::showZone(int z)
{
zone->setZone(z);
+ zone->writeSettings();
TZoffset = zone->calc_TZ_offset( zone->zone() );
- updateDateLabel();
+ _clock->updateClock();
_clock->forceUpdate(); /* force repaint */
- slotUpdate();
- zone->writeSettings();
+ updateDateLabel();
}
@@ -1556,14 +1546,7 @@ void ClockApplet::mousePressEvent(QMouse
void ClockApplet::wheelEvent(QWheelEvent* e)
{
- if (_clock->showDate() || zone->zoneIndex())
- {
// delay the updating so it isn't so hurky-jurky
// when scrolling through the applet.
- m_layoutDelay = 500;
- }
- else
- {
- m_layoutDelay = 0;
- }
+ m_layoutDelay = 300;
if (e->delta() < 0)
@@ -1603,5 +1586,5 @@ void ClockApplet::updateDateLabel(bool r
_dayOfWeek->setText(KGlobal::locale()->calendar()->weekDayName(_lastDate));
- if (zone->zoneIndex())
+ if (zone->zoneIndex() != 0)
{
QString zone_s = i18n(zone->zone().utf8());
@@ -1632,6 +1614,35 @@ void ClockApplet::fixupLayout()
{
m_layoutDelay = 0;
- _date->adjustSize();
- _dayOfWeek->adjustSize();
+
+ // ensure we have the right widget line up in horizontal mode
+ // when we are showing date beside the clock
+ // this fixes problems triggered by having the date first
+ // because of the date format (e.g. YY/MM/DD) and then hiding
+ // the date
+ if (orientation() == Qt::Horizontal && height() < 32)
+ {
+ bool showDate = showDate || (zone->zoneIndex() != 0);
+
+ if (!showDate && !showDayOfWeek)
+ {
+ _clock->widget()->move(0,0);
+ }
+
+ int dayWidth = 0;
+ if (!showDayOfWeek)
+ {
+ _dayOfWeek->move(_clock->widget()->width() + 4, 0);
+ }
+ else
+ {
+ dayWidth = _dayOfWeek->width();
+ }
+
+ if (!showDate)
+ {
+ _date->move(_clock->widget()->width() + dayWidth + 4, 0);
+ }
+ }
+
emit updateLayout();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic