-rw-r--r-- | korganizer/komonthview.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 6d6ae8a..e66ddce 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1633,54 +1633,64 @@ void KOMonthView::computeLayoutWeek() wid -= weeklabelwid; int colWid = wid / daysToShow; int lastCol = wid - ( colWid*6 ); int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); int colModulo = wid % daysToShow; int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; //qDebug("rowmod %d ", rowModulo); int i; int x,y,w,h; x= 0; y= 0; w = colWid; h = dayLabelHei ; for ( i = 0; i < 7; i++) { if ( i && !( i % daysToShow) && i < 6) { y += hei/(5-daysToShow); x = 0; w = colWid; } if ( ((i) % daysToShow) >= daysToShow-colModulo ) { ++w; } - if ( i >= 5 ) { - mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); - x -= (w/2 ); + if ( i >= 5 ) { + int wi = width() - x - weeklabelwid; + if ( i == 5 ) { + mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); + } else { + mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); + } + x = x - w + wi - (wi/2 ); + } + else { + int wi = w; + if ( !(( i+1) % daysToShow)) { + wi = width() - x - weeklabelwid; + } + mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); } - else - mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); x += w; } x= 0; y= dayLabelHei; w = colWid; h = cellHei; int max = 0; for ( i = 0; i < mCellsW.count(); ++i) { if ( i > 6 ) { mCellsW[i]->hide(); continue; } w = colWid; if ( ((i) % daysToShow) >= daysToShow-colModulo ) { ++w; } if ( i == (daysToShow-1-rowModulo)*7) ++h; if ( i >= 5 ) { if ( i ==5 ) { max = h/2; mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); @@ -1755,77 +1765,83 @@ void KOMonthView::computeLayout() lastHei = height(); //qDebug("KOMonthView::computeLayout() MMM ------------------- "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; int colWid = wid / daysToShow; int lastCol = wid - ( colWid*6 ); int dayLabelHei = mDayLabels[0]->sizeHint().height(); int cellHei = (hei - dayLabelHei) /6; int colModulo = wid % daysToShow; int rowModulo = (hei- dayLabelHei) % 6; //qDebug("rowmod %d ", rowModulo); int i; int x,y,w,h; x= 0; y= 0; w = colWid; h = dayLabelHei ; for ( i = 0; i < 7; i++) { if ( i == daysToShow-colModulo ) ++w; if ( combinedSatSun ) { if ( i >= daysToShow-1 ) { - mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); + + if ( i == 6 ) + mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); + else + mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); x -= w/2 ; } else mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); } else mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); x += w; } x= 0; y= dayLabelHei; w = colWid; h = cellHei ; int max = 0; for ( i = 0; i < mCells.count(); ++i) { //qDebug("iii %d ", i); w = colWid; if ( ((i) % 7) >= 7-colModulo ) { ++w; } if ( i == (6-rowModulo)*7) ++h; if ( combinedSatSun ) { if ( (i)%7 >= daysToShow-1 ) { if ( (i)%7 == daysToShow-1 ) { + w = width()-x-weeklabelwid; max = h/2; mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); x -= w ;y += h/2; } else { + w = width()-x-weeklabelwid; max = h-h/2; mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); y -= h/2; } } else { max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); } } else { max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); } x += w; if ( x + w/2 > wid ) { x = 0; y += h; } //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); } y= dayLabelHei; h = cellHei ; for ( i = 0; i < 6; i++) { |