author | zautrix <zautrix> | 2005-03-27 13:04:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-27 13:04:11 (UTC) |
commit | 9e3e43aaca0986ae224c752d2d3a760661be61b6 (patch) (side-by-side diff) | |
tree | 18295c0cc7177be6022a7abec716131f06b2a756 /korganizer/koagendaview.cpp | |
parent | 1800cf5f3af1f666dddcbfffe3171adcd467ae3d (diff) | |
download | kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.zip kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.gz kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.bz2 |
fixes
-rw-r--r-- | korganizer/koagendaview.cpp | 27 |
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 @@ -120,17 +120,16 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 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(); //timeHeight -= (timeHeight/4-2); int borderWidth = 0; QFont nFont = p->font(); if (!KGlobal::locale()->use12Clock()) suffix = "00"; @@ -150,41 +149,39 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) borderWidth = 4; timeHeight = fm.height(); } 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()) { if (cell > 11) suffix = "pm"; 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++; } } @@ -198,17 +195,20 @@ int TimeLabels::minimumWidth() const /** updates widget's internal state */ 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); } @@ -831,21 +831,18 @@ void KOAgendaView::createDayLabels() if ( !appendLabels ) { dayLabel = mDayLabelsList.next(); 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; } |