summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 5508210..f287216 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -118,49 +118,61 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
// these two assignments fix the weird redraw bug
cx = contentsX() + 2;
cw = contentsWidth() - 2;
// end of workaround
int cell = ((int)(cy/mCellHeight));
int y = cell * mCellHeight;
QFontMetrics fm = fontMetrics();
QString hour;
QString suffix;
QString fullTime;
int tW = fm.width("24:00i");
+ int timeHeight = fm.height();
+ if ( timeHeight > mCellHeight )
+ timeHeight = mCellHeight-1;
+ int borderWidth = 5;
+ QFont nFont = p->font();
+ QFont sFont = nFont;
+ sFont.setPointSize( sFont.pointSize()/2+2 );
+ if (!KGlobal::locale()->use12Clock())
+ suffix = "00";
+ QFontMetrics fmS( sFont );
+ int sHei = fmS.height();
while (y < cy + ch) {
p->drawLine(cx,y,cx+tW,y);
hour.setNum(cell);
- suffix = "am";
// handle 24h and am/pm time formats
if (KGlobal::locale()->use12Clock()) {
if (cell > 11) suffix = "pm";
+ else
+ suffix = "am";
if (cell == 0) hour.setNum(12);
if (cell > 12) hour.setNum(cell - 12);
- } else {
- suffix = ":00";
}
// create string in format of "XX:XX" or "XXpm/am"
- fullTime = hour + suffix;
+ fullTime = hour;// + suffix;
// center and draw the time label
int timeWidth = fm.width(fullTime+"i");
- int offset = this->width() - timeWidth;
- int borderWidth = 5;
- int timeHeight = fm.height();
- timeHeight = timeHeight + 2 - ( timeHeight / 4 );
- p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime);
+ int tw2 = fm.width(suffix);
+ int offset = this->width() - timeWidth - tw2;
+ p->setFont( nFont );
+ p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime);
+ p->setFont( sFont );
+ offset += timeWidth;
+ p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
// increment indices
y += mCellHeight;
cell++;
}
}
/**
Calculates the minimum width.
*/
int TimeLabels::minimumWidth() const
{
@@ -871,26 +883,24 @@ void KOAgendaView::updateView()
}
/*
Update configuration settings for the agenda view. This method is not
complete.
*/
void KOAgendaView::updateConfig()
{
if ( mBlockUpdating )
return;
-
-
// update config for children
mTimeLabels->updateConfig();
mAgenda->storePosition();
mAgenda->updateConfig();
mAllDayAgenda->updateConfig();
// widget synchronization
//TODO: find a better way, maybe signal/slot
mTimeLabels->positionChanged();
// for some reason, this needs to be called explicitly
mTimeLabels->repaint();