summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorzautrix <zautrix>2005-03-27 13:04:11 (UTC)
committer zautrix <zautrix>2005-03-27 13:04:11 (UTC)
commit9e3e43aaca0986ae224c752d2d3a760661be61b6 (patch) (side-by-side diff)
tree18295c0cc7177be6022a7abec716131f06b2a756 /korganizer/koagendaview.cpp
parent1800cf5f3af1f666dddcbfffe3171adcd467ae3d (diff)
downloadkdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.zip
kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.gz
kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.bz2
fixes
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 18f242c..f6f390b 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -122,13 +122,12 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
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();
//timeHeight -= (timeHeight/4-2);
int borderWidth = 0;
QFont nFont = p->font();
@@ -152,13 +151,14 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
}
timeHeight -= (timeHeight/4-2);
QFont sFont = nFont;
sFont.setPointSize( sFont.pointSize()/2+2 );
QFontMetrics fmS( sFont );
int sHei = fmS.height();
-
+ sHei -= (sHei/4-2);
+ int startW = this->width() - frameWidth();
while (y < cy + ch) {
p->drawLine(cx,y,cx+tW,y);
hour.setNum(cell);
// handle 24h and am/pm time formats
if (KGlobal::locale()->use12Clock()) {
@@ -166,23 +166,20 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
else
suffix = "am";
if (cell == 0) hour.setNum(12);
if (cell > 12) hour.setNum(cell - 12);
}
- // create string in format of "XX:XX" or "XXpm/am"
- fullTime = hour;// + suffix;
-
// center and draw the time label
- int timeWidth = fm.width(fullTime+"i");
+ int timeWidth = fm.width(hour+"i");
int tw2 = fm.width(suffix);
- int offset = this->width() - timeWidth - tw2;
+ int offset = startW - timeWidth - tw2 ;
p->setFont( nFont );
- p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime);
+ p->drawText(cx - borderWidth + offset, y+ timeHeight, hour);
p->setFont( sFont );
- offset += timeWidth;
+ offset = startW - tw2-1;
p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
// increment indices
y += mCellHeight;
cell++;
}
@@ -200,13 +197,16 @@ int TimeLabels::minimumWidth() const
void TimeLabels::updateConfig()
{
// set the font
// config->setGroup("Fonts");
// QFont font = config->readFontEntry("TimeBar Font");
setFont(KOPrefs::instance()->mTimeBarFont);
- mMiniWidth = fontMetrics().width("88:88") + 2 ;
+ QString test = "88:88";
+ if (KGlobal::locale()->use12Clock())
+ test += "i";
+ mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ;
// update geometry restrictions based on new settings
setFixedWidth(minimumWidth());
// update HourSize
mCellHeight = KOPrefs::instance()->mHourSize*4;
resizeContents(50,mRows * mCellHeight);
@@ -833,17 +833,14 @@ void KOAgendaView::createDayLabels()
while ( dayLabel ) {
//qDebug("!dayLabel %d",dayLabel );
dayLabel->hide();
dayLabel = mDayLabelsList.next();
}
}
- //mDayLabelsFrame->show();
- //mDayLabels->show();
- //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
- //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
- mDayLabelsFrame->setFixedHeight( newHight );
+
+ mDayLabelsFrame->setFixedHeight( newHight + 4 );
}
int KOAgendaView::maxDatesHint()
{
// Not sure about the max number of events, so return 0 for now.
return 0;