summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorzautrix <zautrix>2005-04-02 17:04:37 (UTC)
committer zautrix <zautrix>2005-04-02 17:04:37 (UTC)
commitf3c3a836ae97ef3e65cfbcd22156b0ba6eaae578 (patch) (side-by-side diff)
tree726772f4d535882705cda8cab76ae5460a29beab /korganizer/koagendaview.cpp
parent470327bf20835778a29cd2ce9414baa0cc176829 (diff)
downloadkdepimpi-f3c3a836ae97ef3e65cfbcd22156b0ba6eaae578.zip
kdepimpi-f3c3a836ae97ef3e65cfbcd22156b0ba6eaae578.tar.gz
kdepimpi-f3c3a836ae97ef3e65cfbcd22156b0ba6eaae578.tar.bz2
fixes
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp130
1 files changed, 26 insertions, 104 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 95388ef..880d399 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -122,10 +122,9 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
int timeHeight = fm.ascent();
- QFont nFont = p->font();
+ QFont nFont = font();
+ p->setFont( font());
if (!KGlobal::locale()->use12Clock()) {
- if ( QApplication::desktop()->width() <= 320 )
suffix = "00";
- else
- suffix = "00";
- }
+ } else
+ if (cell > 11) suffix = "pm";
@@ -150,7 +149,9 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
//sHei -= (sHei/4-2);
- int startW = this->width() - frameWidth()-2;
+ int startW = mMiniWidth - frameWidth()-2 ;
int tw2 = fmS.width(suffix);
- timeHeight = (timeHeight-1) /2 -1;
+ timeHeight = (timeHeight-1) /2 -1;
+ //testline
+ //p->drawLine(0,0,0,contentsHeight());
while (y < cy + ch+mCellHeight) {
- p->drawLine(startW-tw2+1 ,y,cw,y);
+ p->drawLine(startW-tw2 ,y,cw+2,y);
hour.setNum(cell);
@@ -158,5 +159,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
if (KGlobal::locale()->use12Clock()) {
- if (cell > 11) suffix = "pm";
- else
- suffix = "am";
+ if (cell == 12) suffix = "pm";
if (cell == 0) hour.setNum(12);
@@ -167,3 +166,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
int timeWidth = fm.width(hour);
- int offset = startW - timeWidth - tw2 ;
+ int offset = startW - timeWidth - tw2 -1 ;
p->setFont( nFont );
@@ -171,3 +170,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
p->setFont( sFont );
- offset = startW - tw2+1;
+ offset = startW - tw2;
p->drawText( offset, y -1, suffix);
@@ -182,78 +181,2 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
-#if 0
- mRedrawNeeded = true;
- if ( mRedrawNeeded ) {
- cx = contentsX() + frameWidth()*2;
- cw = contentsWidth() ;
- // end of workaround
-
- int cell = ((int)(cy/mCellHeight));
- int y = cell * mCellHeight;
- QFontMetrics fm = fontMetrics();
- QString hour;
- QString suffix;
- int timeHeight = fm.ascent();
- QFont nFont = p->font();
-
- if (!KGlobal::locale()->use12Clock()) {
- if ( QApplication::desktop()->width() <= 320 )
- suffix = "";
- else
- suffix = "00";
- }
-
- if ( timeHeight > mCellHeight ) {
- timeHeight = mCellHeight-1;
- int pointS = nFont.pointSize();
- while ( pointS > 4 ) {
- nFont.setPointSize( pointS );
- fm = QFontMetrics( nFont );
- if ( fm.ascent() < mCellHeight )
- break;
- -- pointS;
- }
- fm = QFontMetrics( nFont );
- timeHeight = fm.ascent();
- }
- //timeHeight -= (timeHeight/4-2);
- QFont sFont = nFont;
- sFont.setPointSize( sFont.pointSize()/2 );
- QFontMetrics fmS( sFont );
- int sHei = fmS.ascent() ;
- //sHei -= (sHei/4-2);
- int startW = this->width() - frameWidth()-2;
- int tw2 = fmS.width(suffix);
- while (y < cy + ch) {
- p->drawLine(cx,y,cw,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);
- tw2 = fmS.width(suffix);
- }
-
- // center and draw the time label
- int timeWidth = fm.width(hour);
- int offset = startW - timeWidth - tw2 ;
- p->setFont( nFont );
- p->drawText( offset, y+ timeHeight, hour);
- p->setFont( sFont );
- offset = startW - tw2+1;
- p->drawText( offset, y+ sHei, suffix);
-
- // increment indices
- y += mCellHeight;
- cell++;
- }
- } else {
- //qDebug("NO redraw ");
- }
- // double buffer not yet implemented
- //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
- //mRedrawNeeded = false;
-#endif
}
@@ -283,6 +206,3 @@ void TimeLabels::updateConfig()
else {
- if ( QApplication::desktop()->width() <= 320 )
- test = "00";
- else
- test = "00";
+ test = "00";
}
@@ -291,3 +211,4 @@ void TimeLabels::updateConfig()
QFontMetrics fmS( sFont );
- mMiniWidth += fmS.width( test ) + frameWidth()*2 +4 ;
+ mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ;
+ qDebug("testwid %d %d", mMiniWidth ,fmS.width( test ));
// update geometry restrictions based on new settings
@@ -736,2 +657,4 @@ void KOAgendaView::createDayLabels()
int newHight;
+ if ( !mSelectedDates.count())
+ return;
@@ -742,6 +665,4 @@ void KOAgendaView::createDayLabels()
int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2;
- if ( QApplication::desktop()->width() <= 320 )
- maxWid -= 10;
mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
- if ( maxWid < 0 )
+ if ( maxWid < 20 )
maxWid = 20;
@@ -751,2 +672,3 @@ void KOAgendaView::createDayLabels()
int selCount = mSelectedDates.count();
+ int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1;
QString dayTest = "Mon 20";
@@ -755,3 +677,6 @@ void KOAgendaView::createDayLabels()
//maxWid -= ( selCount * 3 ); //working for QLabels
- maxWid -= ( selCount * 3 ); //working for QPushButton
+ if ( QApplication::desktop()->width() <= 320 )
+ maxWid -= ( selCount * 3 ); //working for QPushButton
+ else
+ maxWid -= ( selCount * 3 ); //working for QPushButton
if ( maxWid < 0 )
@@ -914,6 +839,4 @@ void KOAgendaView::createDayLabels()
//dayLabel->hide();//test only
- int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()- (mAgenda->frameWidth()*2) ) % mSelectedDates.count() ;
- if ( offset < 0 ) offset = 0;
- //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
- dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
+
+ dayLabel->setText(">");
dayLabel->setFont( dlf );
@@ -922,5 +845,4 @@ void KOAgendaView::createDayLabels()
dayLabel->setNum( -2 );
- dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
+ dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ widModulo );
- //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
//mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);